aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Daemon/Cron.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2019-11-04 14:26:12 -0800
committerzotlabs <mike@macgirvin.com>2019-11-04 14:26:12 -0800
commit1358a81c32ff9dff2e88b196c63f299788b05b57 (patch)
treedc9210141cf787893eb5bbd9729b24b56bf4fa4d /Zotlabs/Daemon/Cron.php
parent2d08e0955a328fa53f373949f58995ca2a8b736a (diff)
parentaa137fb2d2ddd71f89eea4618cac1594d020ed3a (diff)
downloadvolse-hubzilla-1358a81c32ff9dff2e88b196c63f299788b05b57.tar.gz
volse-hubzilla-1358a81c32ff9dff2e88b196c63f299788b05b57.tar.bz2
volse-hubzilla-1358a81c32ff9dff2e88b196c63f299788b05b57.zip
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'Zotlabs/Daemon/Cron.php')
-rw-r--r--Zotlabs/Daemon/Cron.php16
1 files changed, 6 insertions, 10 deletions
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php
index a08d2b7d2..7b951e7d4 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 = "'" . 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)
);
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