diff options
author | Max Kostikov <max@kostikov.co> | 2019-11-01 10:49:19 +0100 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2019-11-01 10:49:19 +0100 |
commit | 7594264725be0bfda2a9108e21985e73cd1dd4d1 (patch) | |
tree | 8b27d4e170c945c3c372eadaacc19351cbcd2798 | |
parent | b00db39739dfb9b47ee669b9d9567dcc032904b6 (diff) | |
parent | 69533ce8f5eb61ea4da2cbed1c91c5c743dc4645 (diff) | |
download | volse-hubzilla-7594264725be0bfda2a9108e21985e73cd1dd4d1.tar.gz volse-hubzilla-7594264725be0bfda2a9108e21985e73cd1dd4d1.tar.bz2 volse-hubzilla-7594264725be0bfda2a9108e21985e73cd1dd4d1.zip |
Merge branch 'dev' into 'dev'
Better photo cache expiry processing
See merge request hubzilla/core!1760
-rw-r--r-- | Zotlabs/Daemon/Cron.php | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php index a08d2b7d2..8835d8fca 100644 --- a/Zotlabs/Daemon/Cron.php +++ b/Zotlabs/Daemon/Cron.php @@ -97,13 +97,14 @@ class Cron { // 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') + $sql_interval = db_utcnow() . ' - 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) ); if($r) { + q("DELETE FROM photo WHERE photo_usage = %d AND expires < $sql_interval", + intval(PHOTO_CACHE) + ); foreach($r as $rr) { $file = dbunescbin($rr['content']); if(is_file($file)) { @@ -113,11 +114,6 @@ class Cron { } } } - 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 |