X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fcronhooks.php;h=72b86be427cc9f4dc034f5f64fb50aef5f4640a8;hb=95bb8d38e87d8b09ef37404c4b23c08b6feb9da4;hp=b6cf0e72378763d6b3e5ac697672dce67438ea02;hpb=2e9d233367068fceac8005126d14a2002539c772;p=friendica.git diff --git a/include/cronhooks.php b/include/cronhooks.php index b6cf0e7237..72b86be427 100644 --- a/include/cronhooks.php +++ b/include/cronhooks.php @@ -1,7 +1,8 @@ maxload_reached()) return; if (App::is_already_running('cronhooks', 'include/cronhooks.php', 1140)) return; } + load_hooks(); + + if (($argc == 2) AND is_array($a->hooks) AND array_key_exists("cron", $a->hooks)) { + foreach ($a->hooks["cron"] as $hook) + if ($hook[1] == $argv[1]) { + logger("Calling cron hook '".$hook[1]."'", LOGGER_DEBUG); + call_single_hook($a, $name, $hook, $data); + } + return; + } + $last = get_config('system','last_cronhook'); $poll_interval = intval(get_config('system','cronhook_interval')); @@ -47,13 +58,17 @@ function cronhooks_run(&$argv, &$argc){ $a->set_baseurl(get_config('system','url')); - load_hooks(); - logger('cronhooks: start'); $d = datetime_convert(); - call_hooks('cron', $d); + if (get_config("system", "worker") AND is_array($a->hooks) AND array_key_exists("cron", $a->hooks)) { + foreach ($a->hooks["cron"] as $hook) { + logger("Calling cronhooks for '".$hook[1]."'", LOGGER_DEBUG); + proc_run(PRIORITY_MEDIUM, "include/cronhooks.php", $hook[1]); + } + } else + call_hooks('cron', $d); logger('cronhooks: end');