Commit bed9876d authored by Mario's avatar Mario

Merge branch 'cherry-pick-9ad4c652' into 'dev'

hopefully fix query for postgres

See merge request !1780
parents d22766f4 158b8aea
Pipeline #183784 passed with stage
in 5 minutes and 34 seconds
......@@ -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']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment