aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Daemon/Expire.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-11-05 08:46:42 +0000
committerMario <mario@mariovavti.com>2020-11-05 08:46:42 +0000
commitbafbf0416462c6f18c3fb6c8c06a063c8d6fdae6 (patch)
tree8929845be585b09d0f420621281c5531e1efad3e /Zotlabs/Daemon/Expire.php
parent6f93d9848c43019d43ea76c27d42d657ba031cd7 (diff)
parentfdefa101d84dc2a9424eaedbdb003a4c30ec5d01 (diff)
downloadvolse-hubzilla-bafbf0416462c6f18c3fb6c8c06a063c8d6fdae6.tar.gz
volse-hubzilla-bafbf0416462c6f18c3fb6c8c06a063c8d6fdae6.tar.bz2
volse-hubzilla-bafbf0416462c6f18c3fb6c8c06a063c8d6fdae6.zip
Merge branch '5.0RC'5.0
Diffstat (limited to 'Zotlabs/Daemon/Expire.php')
-rw-r--r--Zotlabs/Daemon/Expire.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/Zotlabs/Daemon/Expire.php b/Zotlabs/Daemon/Expire.php
index 398425861..a688d6f97 100644
--- a/Zotlabs/Daemon/Expire.php
+++ b/Zotlabs/Daemon/Expire.php
@@ -8,6 +8,15 @@ class Expire {
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;
+ }
+
+ $pid = getmypid();
+ set_config('expire', 'procid', $pid);
// perform final cleanup on previously delete items
@@ -32,7 +41,7 @@ class Expire {
if (intval(get_config('system', 'optimize_items')))
q("optimize table item");
- logger('expire: start', LOGGER_DEBUG);
+ 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'));
@@ -90,5 +99,7 @@ class Expire {
logger('Expire: sys: done', LOGGER_DEBUG);
}
+
+ del_config('expire', 'procid');
}
}