ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Cron.php
Go to the documentation of this file.
1<?php
2
4
8class Cron
9{
14 private $cronconfig;
15
16 /*
17 * @param \SimpleSAML_Configuration $cronconfig The cron configuration to use. If not specified defaults
18 * to `config/module_cron.php`
19 */
21 {
22 if ($cronconfig == null) {
24 }
25 $this->cronconfig = $cronconfig;
26 }
27
34 public function runTag($tag)
35 {
36
37 if (!$this->isValidTag($tag)) {
38 throw new \Exception("Invalid cron tag '$tag''");
39 }
40
41 $summary = array();
42 $croninfo = array(
43 'summary' => &$summary,
44 'tag' => $tag,
45 );
46
48
49 foreach ($summary as $s) {
50 \SimpleSAML\Logger::debug('Cron - Summary: ' . $s);
51 }
52
53 return $croninfo;
54 }
55
56 public function isValidTag($tag)
57 {
58 if (!is_null($this->cronconfig->getValue('allowed_tags'))) {
59 return in_array($tag, $this->cronconfig->getArray('allowed_tags'), true);
60 }
61 return true;
62 }
63}
An exception for terminatinating execution or to throw for unit testing.
static debug($string)
Definition: Logger.php:211
Handles interactions with SSP's cron system/hooks.
Definition: Cron.php:9
__construct(\SimpleSAML_Configuration $cronconfig=null)
Definition: Cron.php:20
runTag($tag)
Invoke the cron hook for the given tag.
Definition: Cron.php:34
static callHooks($hook, &$data=null)
Call a hook in all enabled modules.
Definition: Module.php:281
static getConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
if(function_exists( 'posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35
$croninfo
Definition: cron.php:23
$summary
Definition: cron.php:24
$s
Definition: pwgen.php:45