3 * @file src/Worker/CronHooks.php
6 namespace Friendica\Worker;
8 use Friendica\Core\Addon;
9 use Friendica\Core\Config;
10 use Friendica\Core\Worker;
13 public static function execute($hook = '') {
16 require_once 'include/datetime.php';
18 if (($hook != '') && is_array($a->hooks) && array_key_exists("cron", $a->hooks)) {
19 foreach ($a->hooks["cron"] as $single_hook) {
20 if ($single_hook[1] == $hook) {
21 logger("Calling cron hook '" . $hook . "'", LOGGER_DEBUG);
22 Addon::callSingleHook($a, $hook, $single_hook);
28 $last = Config::get('system', 'last_cronhook');
30 $poll_interval = intval(Config::get('system', 'cronhook_interval'));
31 if (!$poll_interval) {
36 $next = $last + ($poll_interval * 60);
38 logger('cronhook intervall not reached');
43 $a->set_baseurl(Config::get('system', 'url'));
45 logger('cronhooks: start');
47 $d = datetime_convert();
49 if (is_array($a->hooks) && array_key_exists("cron", $a->hooks)) {
50 foreach ($a->hooks["cron"] as $hook) {
51 logger("Calling cronhooks for '" . $hook[1] . "'", LOGGER_DEBUG);
52 Worker::add(PRIORITY_MEDIUM, "CronHooks", $hook[1]);
56 logger('cronhooks: end');
58 Config::set('system', 'last_cronhook', time());