X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fcronhooks.php;h=4bb1e5f65960b3b3c1bbad1077d34628388040b0;hb=014fc5dccbf24a6473e0e2e9bdca810103d8b202;hp=b6cf0e72378763d6b3e5ac697672dce67438ea02;hpb=01b02dbcaa8532f965389375e961d9c47d74eeec;p=friendica.git diff --git a/include/cronhooks.php b/include/cronhooks.php index b6cf0e7237..4bb1e5f659 100644 --- a/include/cronhooks.php +++ b/include/cronhooks.php @@ -31,6 +31,17 @@ function cronhooks_run(&$argv, &$argc){ 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');