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 $statconfig = SimpleSAML_Configuration::getConfig('module_statistics.php');
14
15 if (is_null($statconfig->getValue('cron_tag', null))) {
16 return;
17 }
18 if ($statconfig->getValue('cron_tag', null) !== $croninfo['tag']) {
19 return;
20 }
21
22 $maxtime = $statconfig->getInteger('time_limit', null);
23 if ($maxtime) {
24 set_time_limit($maxtime);
25 }
26
27 try {
29 $results = $aggregator->aggregate();
30 if (empty($results)) {
31 SimpleSAML\Logger::notice('Output from statistics aggregator was empty.');
32 } else {
33 $aggregator->store($results);
34 }
35 } catch (Exception $e) {
36 $message = 'Loganalyzer threw exception: ' . $e->getMessage();
38 $croninfo['summary'][] = $message;
39 }
40}
An exception for terminatinating execution or to throw for unit testing.
static warning($string)
Definition: Logger.php:177
static notice($string)
Definition: Logger.php:188
static getConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
$croninfo
Definition: cron.php:23
catch(Exception $e) $message
foreach($argv as $a) $aggregator
Definition: loganalyzer.php:53
$statconfig
Definition: showstats.php:4
statistics_hook_cron(&$croninfo)
Hook to run a cron job.
Definition: hook_cron.php:7
$results
Definition: svg-scanner.php:47