aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-11-10 14:17:58 +0100
committerMario <mario@mariovavti.com>2019-11-10 14:17:58 +0100
commitbed9876d68ac72a27f3c05fa3ed5c4ccad39b72e (patch)
tree476895b0b9677105a0f63a5f75826f16a6724eb4
parentd22766f458a8539a40a57f3946459a9be1f21cd6 (diff)
parent158b8aea387098e62e83920a8425549c02f17bdf (diff)
downloadvolse-hubzilla-bed9876d68ac72a27f3c05fa3ed5c4ccad39b72e.tar.gz
volse-hubzilla-bed9876d68ac72a27f3c05fa3ed5c4ccad39b72e.tar.bz2
volse-hubzilla-bed9876d68ac72a27f3c05fa3ed5c4ccad39b72e.zip
Merge branch 'cherry-pick-9ad4c652' into 'dev'
hopefully fix query for postgres See merge request hubzilla/core!1780
-rw-r--r--Zotlabs/Daemon/Cron.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php
index 7b951e7d4..8fa31e6ce 100644
--- a/Zotlabs/Daemon/Cron.php
+++ b/Zotlabs/Daemon/Cron.php
@@ -97,13 +97,16 @@ class Cron {
// Clean expired photos from cache
- $sql_interval = "'" . dbesc(datetime_convert()) . "' - INTERVAL " . db_quoteinterval(get_config('system','active_expire_days', '30') . ' DAY');
- $r = q("SELECT DISTINCT xchan, content FROM photo WHERE photo_usage = %d AND expires < $sql_interval",
- intval(PHOTO_CACHE)
+ $r = q("SELECT DISTINCT xchan, content FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s",
+ intval(PHOTO_CACHE),
+ db_utcnow(),
+ db_quoteinterval(get_config('system','active_expire_days', '30') . ' DAY')
);
if($r) {
- q("DELETE FROM photo WHERE photo_usage = %d AND expires < $sql_interval",
- intval(PHOTO_CACHE)
+ q("DELETE FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s",
+ intval(PHOTO_CACHE),
+ db_utcnow(),
+ db_quoteinterval(get_config('system','active_expire_days', '30') . ' DAY')
);
foreach($r as $rr) {
$file = dbunescbin($rr['content']);