diff options
author | Mario Vavti <mario@mariovavti.com> | 2021-01-22 11:16:43 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2021-01-22 11:16:43 +0100 |
commit | 78716c42d6ff31bcd89c2316166bf9731a5ab3ab (patch) | |
tree | cc8b489e1744b611e0c08e1f52c2e6ee54e1d2b6 /Zotlabs/Daemon/Cache_query.php | |
parent | e6aed4fb8ef5853f27100a2b9e2903323c874ce8 (diff) | |
parent | 064effe5fd861be2623c7bd1f8a6037e6d470c29 (diff) | |
download | volse-hubzilla-78716c42d6ff31bcd89c2316166bf9731a5ab3ab.tar.gz volse-hubzilla-78716c42d6ff31bcd89c2316166bf9731a5ab3ab.tar.bz2 volse-hubzilla-78716c42d6ff31bcd89c2316166bf9731a5ab3ab.zip |
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'Zotlabs/Daemon/Cache_query.php')
-rw-r--r-- | Zotlabs/Daemon/Cache_query.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Zotlabs/Daemon/Cache_query.php b/Zotlabs/Daemon/Cache_query.php new file mode 100644 index 000000000..18d19cdf2 --- /dev/null +++ b/Zotlabs/Daemon/Cache_query.php @@ -0,0 +1,34 @@ +<?php + +namespace Zotlabs\Daemon; + +use Zotlabs\Lib\Cache; + +class Cache_query { + + static public function run($argc, $argv) { + + if(! $argc == 3) + return; + + $key = $argv[1]; + + $pid = get_config('procid', $key, false); + if ($pid && (function_exists('posix_kill') ? posix_kill($pid, 0) : true)) { + logger($key . ': procedure already run with pid ' . $pid, LOGGER_DEBUG); + return; + } + + $pid = getmypid(); + set_config('procid', $key, $pid); + + array_shift($argv); + array_shift($argv); + + $r = call_user_func_array('q', $argv); + if($r) + Cache::set($key, serialize($r)); + + del_config('procid', $key); + } +} |