diff options
author | M. Dent <dentm42@gmail.com> | 2018-12-02 19:33:54 +0100 |
---|---|---|
committer | M. Dent <dentm42@gmail.com> | 2018-12-02 19:33:54 +0100 |
commit | 0b38ab259c6179fc3465efe2a1ed721a73311ba8 (patch) | |
tree | d1cd6fca0a88c11782b4376faec133a1c2812bf2 /Zotlabs/Daemon/Cron.php | |
parent | 237c6eed5024d2507630f2321218685b3540c957 (diff) | |
parent | 2a57e00cb4a7dada0993e91e0e2176ad335cf12f (diff) | |
download | volse-hubzilla-0b38ab259c6179fc3465efe2a1ed721a73311ba8.tar.gz volse-hubzilla-0b38ab259c6179fc3465efe2a1ed721a73311ba8.tar.bz2 volse-hubzilla-0b38ab259c6179fc3465efe2a1ed721a73311ba8.zip |
Merge branch 'photocache' into 'dev'
Add Photo Cache addon support
See merge request hubzilla/core!1412
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 |