diff options
author | Mario <mario@mariovavti.com> | 2021-01-18 14:00:21 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-01-18 14:00:21 +0000 |
commit | 9acfc44ac95864007778a837f7833143b271f4d6 (patch) | |
tree | 7321cb7b8e94db2cdab9c5408719bb5ba35e2262 /Zotlabs | |
parent | d5bd09b983f5d3edc44bf383a27ef84a9aa84f5a (diff) | |
download | volse-hubzilla-9acfc44ac95864007778a837f7833143b271f4d6.tar.gz volse-hubzilla-9acfc44ac95864007778a837f7833143b271f4d6.tar.bz2 volse-hubzilla-9acfc44ac95864007778a837f7833143b271f4d6.zip |
cleanup daemon/expire
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Daemon/Expire.php | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Zotlabs/Daemon/Expire.php b/Zotlabs/Daemon/Expire.php index a688d6f97..09a87a8f4 100644 --- a/Zotlabs/Daemon/Expire.php +++ b/Zotlabs/Daemon/Expire.php @@ -5,16 +5,16 @@ namespace Zotlabs\Daemon; class Expire { - static public function run($argc,$argv){ + static public function run($argc, $argv) { cli_startup(); - + $pid = get_config('expire', 'procid', false); if ($pid && (function_exists('posix_kill') ? posix_kill($pid, 0) : true)) { - logger('Expire: procedure already run with pid ' . $pid, LOGGER_DEBUG); - return; + logger('Expire: procedure already run with pid ' . $pid, LOGGER_DEBUG); + return; } - + $pid = getmypid(); set_config('expire', 'procid', $pid); @@ -32,19 +32,18 @@ class Expire { // physically remove anything that has been deleted for more than two months /** @FIXME - this is a wretchedly inefficient query */ - $r = q("delete from item where item_pending_remove = 1 and changed < %s - INTERVAL %s", - db_utcnow(), db_quoteinterval('36 DAY') + q("delete from item where item_pending_remove = 1 and changed < %s - INTERVAL %s", + db_utcnow(), + db_quoteinterval('36 DAY') ); - /** @FIXME make this optional as it could have a performance impact on large sites */ - if (intval(get_config('system', 'optimize_items'))) q("optimize table item"); logger('expire: start with pid ' . $pid, LOGGER_DEBUG); - $site_expire = intval(get_config('system', 'default_expire_days')); - $commented_days = intval(get_config('system','active_expire_days')); + $site_expire = intval(get_config('system', 'default_expire_days')); + $commented_days = intval(get_config('system', 'active_expire_days')); logger('site_expire: ' . $site_expire); @@ -64,11 +63,12 @@ class Expire { $channel_expire = $service_class_expire; else $channel_expire = $site_expire; - + if (intval($channel_expire) && (intval($channel_expire) < intval($rr['channel_expire_days'])) || intval($rr['channel_expire_days'] == 0)) { $expire_days = $channel_expire; - } else { + } + else { $expire_days = $rr['channel_expire_days']; } @@ -93,13 +93,13 @@ class Expire { } logger('Expire: sys interval: ' . $expire_days, LOGGER_DEBUG); - + if ($expire_days) item_expire($x['channel_id'], $expire_days, $commented_days); logger('Expire: sys: done', LOGGER_DEBUG); } - + del_config('expire', 'procid'); } } |