mirror of
https://github.com/YGGverse/YGGo.git
synced 2025-01-24 13:34:25 +00:00
fix crawl queue message
This commit is contained in:
parent
d912caeb0c
commit
f4bf6b9fa4
@ -163,6 +163,7 @@ class MySQL {
|
||||
return $query->fetch()->total;
|
||||
}
|
||||
|
||||
/* not in use
|
||||
public function getTotalPagesByHttpCode(mixed $httpCode) {
|
||||
|
||||
if (is_null($httpCode)) {
|
||||
@ -179,6 +180,7 @@ class MySQL {
|
||||
|
||||
return $query->fetch()->total;
|
||||
}
|
||||
*/
|
||||
|
||||
public function getHostPage(int $hostId, int $crc32uri) {
|
||||
|
||||
@ -662,6 +664,21 @@ class MySQL {
|
||||
return $query->fetchAll();
|
||||
}
|
||||
|
||||
public function getHostPageCrawlQueueTotal(int $timeFrom) {
|
||||
|
||||
$query = $this->_db->prepare('SELECT COUNT(*) AS `total`
|
||||
|
||||
FROM `hostPage`
|
||||
JOIN `host` ON (`host`.`hostId` = `hostPage`.`hostId`)
|
||||
|
||||
WHERE (`hostPage`.`timeUpdated` IS NULL OR `hostPage`.`timeUpdated` < ? ) AND `host`.`status` <> ?
|
||||
AND `hostPage`.`timeBanned` IS NULL');
|
||||
|
||||
$query->execute([$timeFrom, 0]);
|
||||
|
||||
return $query->fetch()->total;
|
||||
}
|
||||
|
||||
public function updateHostPageCrawlQueue(int $hostPageId, int $timeUpdated, int $httpCode, int $size) {
|
||||
|
||||
$query = $this->_db->prepare('UPDATE `hostPage` SET `timeUpdated` = ?, `httpCode` = ?, `size` = ? WHERE `hostPageId` = ? LIMIT 1');
|
||||
|
@ -274,7 +274,7 @@ $placeholder = Filter::plural($totalPages, [sprintf(_('Over %s page or enter the
|
||||
<?php } else { ?>
|
||||
<div style="text-align:center">
|
||||
<span><?php echo _('Not found') ?></span>
|
||||
<?php if ($queueTotal = $db->getTotalPagesByHttpCode(null)) { ?>
|
||||
<?php if ($queueTotal = $db->getHostPageCrawlQueueTotal(time() - CRAWL_PAGE_SECONDS_OFFSET)) { ?>
|
||||
<span><?php echo sprintf(_('* Please wait for all pages crawl to complete (%s in queue).'), $queueTotal) ?></span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
@ -321,7 +321,7 @@ if (filter_var($q, FILTER_VALIDATE_URL) && preg_match(CRAWL_URL_REGEXP, $q)) {
|
||||
<?php if ($results) { ?>
|
||||
<div>
|
||||
<span><?php echo sprintf(_('Total found: %s'), $resultsTotal) ?></span>
|
||||
<?php if ($queueTotal = $db->getTotalPagesByHttpCode(null)) { ?>
|
||||
<?php if ($queueTotal = $db->getHostPageCrawlQueueTotal(time() - CRAWL_PAGE_SECONDS_OFFSET)) { ?>
|
||||
<span><?php echo sprintf(_('* Please wait for all pages crawl to complete (%s in queue).'), $queueTotal) ?></span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
@ -391,7 +391,7 @@ if (filter_var($q, FILTER_VALIDATE_URL) && preg_match(CRAWL_URL_REGEXP, $q)) {
|
||||
<?php } else { ?>
|
||||
<div style="text-align:center">
|
||||
<span><?php echo sprintf(_('Total found: %s'), $resultsTotal) ?></span>
|
||||
<?php if ($q && $queueTotal = $db->getTotalPagesByHttpCode(null)) { ?>
|
||||
<?php if ($q && $queueTotal = $db->getHostPageCrawlQueueTotal(time() - CRAWL_PAGE_SECONDS_OFFSET)) { ?>
|
||||
<span><?php echo sprintf(_('* Please wait for all pages crawl to complete (%s in queue).'), $queueTotal) ?></span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user