mirror of
https://github.com/YGGverse/YGGo.git
synced 2025-01-27 06:54:33 +00:00
remove hostPageToHostPage
.quantity
field because of implements wrong duplicates counting on reindex
This commit is contained in:
parent
eeeb3dceac
commit
d98b8f5c94
@ -16,7 +16,7 @@ source hostPage : common
|
|||||||
`hostPage`.`uri`, \
|
`hostPage`.`uri`, \
|
||||||
`host`.`name`, \
|
`host`.`name`, \
|
||||||
REGEXP_REPLACE(`hostPage`.`mime`, '^([A-z-]+)/[A-z-]+.*', '$1') AS `mime`, \
|
REGEXP_REPLACE(`hostPage`.`mime`, '^([A-z-]+)/[A-z-]+.*', '$1') AS `mime`, \
|
||||||
(SELECT SUM(`quantity`) FROM `hostPageToHostPage` \
|
(SELECT COUNT(*) FROM `hostPageToHostPage` \
|
||||||
WHERE `hostPageToHostPage`.`hostPageIdTarget` = `hostPage`.`hostPageId` \
|
WHERE `hostPageToHostPage`.`hostPageIdTarget` = `hostPage`.`hostPageId` \
|
||||||
AND (SELECT `hostPageSource`.`hostId` FROM `hostPage` AS `hostPageSource` \
|
AND (SELECT `hostPageSource`.`hostId` FROM `hostPage` AS `hostPageSource` \
|
||||||
WHERE `hostPageSource`.`hostPageId` = `hostPageToHostPage`.`hostPageIdSource`) <> `hostPage`.`hostId`) AS `rank`, \
|
WHERE `hostPageSource`.`hostPageId` = `hostPageToHostPage`.`hostPageIdSource`) <> `hostPage`.`hostId`) AS `rank`, \
|
||||||
|
Binary file not shown.
@ -327,9 +327,7 @@ class MySQL {
|
|||||||
|
|
||||||
public function addHostPageToHostPage(int $hostPageIdSource, int $hostPageIdTarget) {
|
public function addHostPageToHostPage(int $hostPageIdSource, int $hostPageIdTarget) {
|
||||||
|
|
||||||
$query = $this->_db->prepare('INSERT INTO `hostPageToHostPage` (`hostPageIdSource`, `hostPageIdTarget`, `quantity`) VALUES (?, ?, 1)
|
$query = $this->_db->prepare('INSERT IGNORE `hostPageToHostPage` (`hostPageIdSource`, `hostPageIdTarget`) VALUES (?, ?)');
|
||||||
|
|
||||||
ON DUPLICATE KEY UPDATE `quantity` = `quantity` + 1');
|
|
||||||
|
|
||||||
$query->execute([$hostPageIdSource, $hostPageIdTarget]);
|
$query->execute([$hostPageIdSource, $hostPageIdTarget]);
|
||||||
|
|
||||||
@ -355,7 +353,7 @@ class MySQL {
|
|||||||
|
|
||||||
public function getHostPageIdSourcesByHostPageIdTarget(int $hostPageIdTarget, int $limit = 1000) {
|
public function getHostPageIdSourcesByHostPageIdTarget(int $hostPageIdTarget, int $limit = 1000) {
|
||||||
|
|
||||||
$query = $this->_db->prepare('SELECT * FROM `hostPageToHostPage` WHERE `hostPageIdTarget` = ? ORDER BY `quantity` DESC LIMIT ' . (int) $limit);
|
$query = $this->_db->prepare('SELECT * FROM `hostPageToHostPage` WHERE `hostPageIdTarget` = ? LIMIT ' . (int) $limit);
|
||||||
|
|
||||||
$query->execute([$hostPageIdTarget]);
|
$query->execute([$hostPageIdTarget]);
|
||||||
|
|
||||||
|
@ -244,10 +244,6 @@ $placeholder = Filter::plural($totalPages, [sprintf(_('Over %s page or enter the
|
|||||||
<?php foreach ($db->getHostPageIdSourcesByHostPageIdTarget($hp) as $hostPageIdSource) { ?>
|
<?php foreach ($db->getHostPageIdSourcesByHostPageIdTarget($hp) as $hostPageIdSource) { ?>
|
||||||
<?php if ($hostPage = $db->getFoundHostPage($hostPageIdSource->hostPageIdSource)) { ?>
|
<?php if ($hostPage = $db->getFoundHostPage($hostPageIdSource->hostPageIdSource)) { ?>
|
||||||
<p>
|
<p>
|
||||||
<?php echo Filter::plural($hostPageIdSource->quantity, [sprintf(_('%s ref'), $hostPageIdSource->quantity),
|
|
||||||
sprintf(_('%s refs'), $hostPageIdSource->quantity),
|
|
||||||
sprintf(_('%s refs'), $hostPageIdSource->quantity),
|
|
||||||
]) ?>
|
|
||||||
<a href="<?php echo $hostPage->scheme . '://' . $hostPage->name . ($hostPage->port ? ':' . $hostPage->port : false) . $hostPage->uri ?>">
|
<a href="<?php echo $hostPage->scheme . '://' . $hostPage->name . ($hostPage->port ? ':' . $hostPage->port : false) . $hostPage->uri ?>">
|
||||||
<img src="<?php echo WEBSITE_DOMAIN; ?>/image.php?q=<?php echo urlencode($hostPage->name) ?>" alt="favicon" width="16" height="16" class="icon" />
|
<img src="<?php echo WEBSITE_DOMAIN; ?>/image.php?q=<?php echo urlencode($hostPage->name) ?>" alt="favicon" width="16" height="16" class="icon" />
|
||||||
<?php echo htmlentities(urldecode($hostPage->scheme . '://' . $hostPage->name . ($hostPage->port ? ':' . $hostPage->port : false)) . (mb_strlen(urldecode($hostPage->uri)) > 48 ? '...' . mb_substr(urldecode($hostPage->uri), -48) : urldecode($hostPage->uri))) ?>
|
<?php echo htmlentities(urldecode($hostPage->scheme . '://' . $hostPage->name . ($hostPage->port ? ':' . $hostPage->port : false)) . (mb_strlen(urldecode($hostPage->uri)) > 48 ? '...' . mb_substr(urldecode($hostPage->uri), -48) : urldecode($hostPage->uri))) ?>
|
||||||
|
@ -354,10 +354,6 @@ if (filter_var($q, FILTER_VALIDATE_URL) && preg_match(CRAWL_URL_REGEXP, $q)) {
|
|||||||
<?php if ($hostPage = $db->getFoundHostPage($hostPageIdSource->hostPageIdSource)) { ?>
|
<?php if ($hostPage = $db->getFoundHostPage($hostPageIdSource->hostPageIdSource)) { ?>
|
||||||
<?php $i++ ?>
|
<?php $i++ ?>
|
||||||
<p>
|
<p>
|
||||||
<?php echo Filter::plural($hostPageIdSource->quantity, [sprintf(_('%s ref'), $hostPageIdSource->quantity),
|
|
||||||
sprintf(_('%s refs'), $hostPageIdSource->quantity),
|
|
||||||
sprintf(_('%s refs'), $hostPageIdSource->quantity),
|
|
||||||
]) ?>
|
|
||||||
<a href="<?php echo $hostPage->scheme . '://' . $hostPage->name . ($hostPage->port ? ':' . $hostPage->port : false) . $hostPage->uri ?>">
|
<a href="<?php echo $hostPage->scheme . '://' . $hostPage->name . ($hostPage->port ? ':' . $hostPage->port : false) . $hostPage->uri ?>">
|
||||||
<img src="<?php echo WEBSITE_DOMAIN; ?>/image.php?q=<?php echo urlencode($hostPage->name) ?>" alt="favicon" width="16" height="16" class="icon" />
|
<img src="<?php echo WEBSITE_DOMAIN; ?>/image.php?q=<?php echo urlencode($hostPage->name) ?>" alt="favicon" width="16" height="16" class="icon" />
|
||||||
<?php echo htmlentities(urldecode($hostPage->scheme . '://' . $hostPage->name . ($hostPage->port ? ':' . $hostPage->port : false)) . (mb_strlen(urldecode($hostPage->uri)) > 36 ? '...' . mb_substr(urldecode($hostPage->uri), -36) : urldecode($hostPage->uri))) ?>
|
<?php echo htmlentities(urldecode($hostPage->scheme . '://' . $hostPage->name . ($hostPage->port ? ':' . $hostPage->port : false)) . (mb_strlen(urldecode($hostPage->uri)) > 36 ? '...' . mb_substr(urldecode($hostPage->uri), -36) : urldecode($hostPage->uri))) ?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user