X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fcronhooks.php;h=bea0f6a198a13121fc9df746b5e8db8cf8b3eddf;hb=de5125a4c72309d5b167916e905eed1cad8d2679;hp=b6cf0e72378763d6b3e5ac697672dce67438ea02;hpb=a4dd0b835c90c5dcd611a39354370cb3f860c7d7;p=friendica.git diff --git a/include/cronhooks.php b/include/cronhooks.php index b6cf0e7237..bea0f6a198 100644 --- a/include/cronhooks.php +++ b/include/cronhooks.php @@ -1,37 +1,22 @@ 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'); + $last = get_config('system', 'last_cronhook'); $poll_interval = intval(get_config('system','cronhook_interval')); if(! $poll_interval) @@ -47,22 +32,20 @@ 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 (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]); + } + } logger('cronhooks: end'); - set_config('system','last_cronhook', time()); + set_config('system', 'last_cronhook', time()); return; } - -if (array_search(__file__,get_included_files())===0){ - cronhooks_run($_SERVER["argv"],$_SERVER["argc"]); - killme(); -}