Browse Source

hopefully fix query for postgres

(cherry picked from commit 9ad4c6528c)
master
Mario 1 year ago
parent
commit
158b8aea38
1 changed files with 8 additions and 5 deletions
  1. +8
    -5
      Zotlabs/Daemon/Cron.php

+ 8
- 5
Zotlabs/Daemon/Cron.php View File

@ -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']);

Loading…
Cancel
Save