ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
hook_cron.php
Go to the documentation of this file.
1<?php
8{
9 assert(is_array($croninfo));
10 assert(array_key_exists('summary', $croninfo));
11 assert(array_key_exists('tag', $croninfo));
12
13 SimpleSAML\Logger::info('cron [sanitycheck]: Running cron in cron tag [' . $croninfo['tag'] . '] ');
14
15 try {
16 $sconfig = SimpleSAML_Configuration::getOptionalConfig('config-sanitycheck.php');
17
18 $cronTag = $sconfig->getString('cron_tag', null);
19 if ($cronTag === null || $cronTag !== $croninfo['tag']) {
20 return;
21 }
22
23 $info = array();
24 $errors = array();
25 $hookinfo = array(
26 'info' => &$info,
27 'errors' => &$errors,
28 );
29
31
32 if (count($errors) > 0) {
33 foreach ($errors AS $err) {
34 $croninfo['summary'][] = 'Sanitycheck error: ' . $err;
35 }
36 }
37
38 } catch (Exception $e) {
39 $croninfo['summary'][] = 'Error executing sanity check: ' . $e->getMessage();
40 }
41}
An exception for terminatinating execution or to throw for unit testing.
static info($string)
Definition: Logger.php:199
static callHooks($hook, &$data=null)
Call a hook in all enabled modules.
Definition: Module.php:281
static getOptionalConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
$croninfo
Definition: cron.php:23
$errors
Definition: index.php:6
$hookinfo
Definition: index.php:7
$info
Definition: index.php:5
sanitycheck_hook_cron(&$croninfo)
Hook to run a cron job.
Definition: hook_cron.php:7