From 0ffcee1efbf1adcb864bca27c5a9ba0fac937986 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 May 2023 15:53:21 +0300 Subject: [PATCH] fix image description updates timing --- crontab/crawler.php | 4 +++- library/mysql.php | 10 ++++++---- public/search.php | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/crontab/crawler.php b/crontab/crawler.php index 99ad76c..914a233 100644 --- a/crontab/crawler.php +++ b/crontab/crawler.php @@ -342,6 +342,7 @@ try { $lastHostImageDescription->alt, $lastHostImageDescription->title, $hostImageData, + time(), time()); } } @@ -628,7 +629,8 @@ try { $imageAlt, $imageTitle, null, - time()); + time(), + null); // Relate host image with host page was found $db->setHostImageToHostPage($hostImageId, $queueHostPage->hostPageId, time(), 1); diff --git a/library/mysql.php b/library/mysql.php index 6e12201..f0aaa64 100644 --- a/library/mysql.php +++ b/library/mysql.php @@ -263,7 +263,8 @@ class MySQL { string $alt, string $title, mixed $data, - int $time) { + int $timeAdded, + mixed $timeUpdated) { $query = $this->_db->prepare('INSERT INTO `hostImageDescription` (`hostImageId`, `crc32id`, @@ -275,7 +276,7 @@ class MySQL { `title` = ?, `timeUpdated` = ?'); - $query->execute([$hostImageId, $crc32id, $alt, $title, $time, $alt, $title, $time]); + $query->execute([$hostImageId, $crc32id, $alt, $title, $timeAdded, $alt, $title, $timeUpdated]); return $this->_db->lastInsertId(); } @@ -283,7 +284,8 @@ class MySQL { public function setHostImageDescriptionData(int $hostImageId, int $crc32id, mixed $data, - int $time) { + int $timeAdded, + mixed $timeUpdated) { $query = $this->_db->prepare('INSERT INTO `hostImageDescription` (`hostImageId`, `crc32id`, @@ -292,7 +294,7 @@ class MySQL { ON DUPLICATE KEY UPDATE `timeUpdated` = ?'); - $query->execute([$hostImageId, $crc32id, $data, $time, $time]); + $query->execute([$hostImageId, $crc32id, $data, $timeAdded, $timeUpdated]); return $this->_db->lastInsertId(); } diff --git a/public/search.php b/public/search.php index 639ee80..c3551c3 100644 --- a/public/search.php +++ b/public/search.php @@ -431,7 +431,8 @@ if (!empty($q)) { $db->setHostImageDescriptionData($result->id, crc32($hostImageURLencoded), $hostImage->crawlMetaOnly ? null : $hostImageURLencoded, - time()); + time(), + null); } ?>