diff options
author | zotlabs <mike@macgirvin.com> | 2018-12-03 19:19:31 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-12-03 19:19:31 -0800 |
commit | ffc3dba6825933d8e3ddc1a9a1ee93785acb2fca (patch) | |
tree | 6b42761029370c325064d2790b4c3d8debb7dd38 /Zotlabs/Daemon/Cron.php | |
parent | 1acc5ceb5f17b3bd36eeba9245c4bb3923793c34 (diff) | |
parent | 5e14da67e1329947a14cc4f009cebcfe4a5ece2f (diff) | |
download | volse-hubzilla-ffc3dba6825933d8e3ddc1a9a1ee93785acb2fca.tar.gz volse-hubzilla-ffc3dba6825933d8e3ddc1a9a1ee93785acb2fca.tar.bz2 volse-hubzilla-ffc3dba6825933d8e3ddc1a9a1ee93785acb2fca.zip |
Merge branch 'dev' of https://framagit.org/hubzilla/core into xdev_merge
Diffstat (limited to 'Zotlabs/Daemon/Cron.php')
-rw-r--r-- | Zotlabs/Daemon/Cron.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php index 25e49b817..8b6b42c8a 100644 --- a/Zotlabs/Daemon/Cron.php +++ b/Zotlabs/Daemon/Cron.php @@ -94,6 +94,29 @@ class Cron { @time_sleep_until(microtime(true) + (float) $interval); } } + + // Clean expired photos from cache + + $age = get_config('system','active_expire_days', '30'); + $r = q("SELECT DISTINCT xchan, content FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s", + intval(PHOTO_CACHE), + db_utcnow(), + db_quoteinterval($age . ' DAY') + ); + if($r) { + foreach($r as $rr) { + $file = dbunescbin($rr['content']); + if(is_file($file)) { + @unlink($file); + logger('info: deleted cached photo file ' . $file, LOGGER_DEBUG); + } + } + } + q("DELETE FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s", + intval(PHOTO_CACHE), + db_utcnow(), + db_quoteinterval($age . ' DAY') + ); // publish any applicable items that were set to be published in the future // (time travel posts). Restrict to items that have come of age in the last |