3 use Friendica\Core\Config;
5 function cronhooks_run(&$argv, &$argc) {
8 require_once 'include/datetime.php';
10 if (($argc == 2) && is_array($a->hooks) && array_key_exists("cron", $a->hooks)) {
11 foreach ($a->hooks["cron"] as $hook) {
12 if ($hook[1] == $argv[1]) {
13 logger("Calling cron hook '" . $hook[1] . "'", LOGGER_DEBUG);
14 call_single_hook($a, $name, $hook, $data);
20 $last = get_config('system', 'last_cronhook');
22 $poll_interval = intval(get_config('system', 'cronhook_interval'));
23 if (! $poll_interval) {
28 $next = $last + ($poll_interval * 60);
30 logger('cronhook intervall not reached');
35 $a->set_baseurl(get_config('system', 'url'));
37 logger('cronhooks: start');
39 $d = datetime_convert();
41 if (is_array($a->hooks) && array_key_exists("cron", $a->hooks)) {
42 foreach ($a->hooks["cron"] as $hook) {
43 logger("Calling cronhooks for '" . $hook[1] . "'", LOGGER_DEBUG);
44 proc_run(PRIORITY_MEDIUM, "include/cronhooks.php", $hook[1]);
48 logger('cronhooks: end');
50 set_config('system', 'last_cronhook', time());