summaryrefslogtreecommitdiff
path: root/update.php
diff options
context:
space:
mode:
authorwn_ <invalid@email.com>2025-03-04 18:00:28 +0000
committerwn_ <invalid@email.com>2025-03-04 18:34:35 +0000
commit89b0332d3861ce2d9b37c690a32c98e961d7e219 (patch)
treee933c36f22eb1d929406278f3b2a3a60d8467f01 /update.php
parent532570ca17f1120a4bfc07195080e5e6a3c469fd (diff)
Add and use 'Db::now_comparison_qpart()'.
This introduces a helper to build a query part comparing a field against a past datetime (determined by '$now - $some_interval'), eliminating certain boilerplate code.
Diffstat (limited to 'update.php')
-rwxr-xr-xupdate.php9
1 files changed, 1 insertions, 8 deletions
diff --git a/update.php b/update.php
index d2a1287d1..471e323c8 100755
--- a/update.php
+++ b/update.php
@@ -33,14 +33,7 @@
}
function cleanup_tags(int $days = 14, int $limit = 1000): int {
-
- $days = (int) $days;
-
- if (Config::get(Config::DB_TYPE) == "pgsql") {
- $interval_query = "e.date_updated < NOW() - INTERVAL '$days days'";
- } else /*if (Config::get(Config::DB_TYPE) == "mysql") */ {
- $interval_query = "e.date_updated < DATE_SUB(NOW(), INTERVAL $days DAY)";
- }
+ $interval_query = Db::past_comparison_qpart('e.date_updated', '<', $days, 'day');
$tags_deleted = 0;
$limit_part = 500;