X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fcronhooks.php;h=7524a0c3a8883c80b4a914e54093d7cfa9351508;hb=66902c7956eedba02ea54aea6ea7aa417344ffbb;hp=b6cf0e72378763d6b3e5ac697672dce67438ea02;hpb=a4dd0b835c90c5dcd611a39354370cb3f860c7d7;p=friendica.git diff --git a/include/cronhooks.php b/include/cronhooks.php index b6cf0e7237..7524a0c3a8 100644 --- a/include/cronhooks.php +++ b/include/cronhooks.php @@ -25,12 +25,23 @@ function cronhooks_run(&$argv, &$argc){ // Don't check this stuff if the function is called by the poller if (App::callstack() != "poller_run") { - if (App::maxload_reached()) + if ($a->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');