From d6619724d98c0c93fa934448539e7d7d2c9c11f0 Mon Sep 17 00:00:00 2001 From: joshuaruesweg Date: Thu, 4 Mar 2021 19:57:48 +0100 Subject: [PATCH] Save fetch url fetch date --- .../install/files/acp/database/update_com.woltlab.wcf_5.4.php | 4 +++- .../install/files/lib/data/unfurl/url/UnfurlUrl.class.php | 2 ++ .../system/background/job/UnfurlUrlBackgroundJob.class.php | 1 + wcfsetup/setup/db/install.sql | 3 ++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_5.4.php b/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_5.4.php index 11f481584c..a5e4fe7691 100644 --- a/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_5.4.php +++ b/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_5.4.php @@ -1,7 +1,7 @@ length(45), NotNullVarchar255DatabaseTableColumn::create('status') ->defaultValue('PENDING'), + NotNullInt10DatabaseTableColumn::create('lastFetch') + ->defaultValue(0) ]) ->indices([ DatabaseTablePrimaryIndex::create() diff --git a/wcfsetup/install/files/lib/data/unfurl/url/UnfurlUrl.class.php b/wcfsetup/install/files/lib/data/unfurl/url/UnfurlUrl.class.php index 4f3094b5bc..4cbdb4a68f 100644 --- a/wcfsetup/install/files/lib/data/unfurl/url/UnfurlUrl.class.php +++ b/wcfsetup/install/files/lib/data/unfurl/url/UnfurlUrl.class.php @@ -17,6 +17,7 @@ use wcf\util\Url; * @package WoltLabSuite\Core\Data\Unfurl\Url * @since 5.4 * + * @property-read int $urlID * @property-read string $url * @property-read string $urlHash * @property-read string $title @@ -24,6 +25,7 @@ use wcf\util\Url; * @property-read string $imageHash * @property-read string $imageUrl * @property-read string $imageType + * @property-read int $lastFetch */ class UnfurlUrl extends DatabaseObject { diff --git a/wcfsetup/install/files/lib/system/background/job/UnfurlUrlBackgroundJob.class.php b/wcfsetup/install/files/lib/system/background/job/UnfurlUrlBackgroundJob.class.php index 883d6d8c54..2aed901679 100644 --- a/wcfsetup/install/files/lib/system/background/job/UnfurlUrlBackgroundJob.class.php +++ b/wcfsetup/install/files/lib/system/background/job/UnfurlUrlBackgroundJob.class.php @@ -223,6 +223,7 @@ final class UnfurlUrlBackgroundJob extends AbstractBackgroundJob 'imageType' => $imageType, 'imageUrl' => $imageUrl, 'imageHash' => $imageHash, + 'lastFetch' => TIME_NOW, ], ]); $urlAction->executeAction(); diff --git a/wcfsetup/setup/db/install.sql b/wcfsetup/setup/db/install.sql index 5902ce9c92..c03971ed30 100644 --- a/wcfsetup/setup/db/install.sql +++ b/wcfsetup/setup/db/install.sql @@ -1456,7 +1456,8 @@ CREATE TABLE wcf1_unfurl_url ( imageUrl TEXT NOT NULL DEFAULT '', imageType VARCHAR(255) NOT NULL DEFAULT 'NOIMAGE', imageHash VARCHAR(45) NOT NULL DEFAULT '', - status VARCHAR(255) NOT NULL DEFAULT 'PENDING' + status VARCHAR(255) NOT NULL DEFAULT 'PENDING', + lastFetch INT(10) NOT NULL DEFAULT 0 ); DROP TABLE IF EXISTS wcf1_user; -- 2.20.1