aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Daemon/Cache_query.php
diff options
context:
space:
mode:
authorHilmar R <u02@u29lx193>2021-02-28 21:06:16 +0100
committerHilmar R <u02@u29lx193>2021-03-01 18:48:11 +0100
commitc26dede97f626b52b7bf8962ed55d1dbda86abe8 (patch)
tree3c8c9bc97aa09f7ce9afe9bf467cf87bbf2c7d0b /Zotlabs/Daemon/Cache_query.php
parentea3390d626f85b7293a750958bfd1b5460958365 (diff)
downloadvolse-hubzilla-c26dede97f626b52b7bf8962ed55d1dbda86abe8.tar.gz
volse-hubzilla-c26dede97f626b52b7bf8962ed55d1dbda86abe8.tar.bz2
volse-hubzilla-c26dede97f626b52b7bf8962ed55d1dbda86abe8.zip
get dev
Diffstat (limited to 'Zotlabs/Daemon/Cache_query.php')
-rw-r--r--Zotlabs/Daemon/Cache_query.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/Zotlabs/Daemon/Cache_query.php b/Zotlabs/Daemon/Cache_query.php
new file mode 100644
index 000000000..5f92ae6d0
--- /dev/null
+++ b/Zotlabs/Daemon/Cache_query.php
@@ -0,0 +1,36 @@
+<?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);
+
+ $arr = json_decode(base64_decode($argv[0]), true);
+
+ $r = call_user_func_array('q', $arr);
+ if($r)
+ Cache::set($key, serialize($r));
+
+ del_config('procid', $key);
+ }
+}