Hook to run a cron job.
7 {
9 assert(array_key_exists(
'summary',
$croninfo));
10 assert(array_key_exists(
'tag',
$croninfo));
11
13
14 try {
17
19 $stateFile =
$config->getPathValue(
'datadir',
'data/') .
'metarefresh-state.php';
20
21 foreach (
$sets AS $setkey => $set) {
22
23 $cronTags = $set->getArray('cron');
24 if (!in_array(
$croninfo[
'tag'], $cronTags,
true))
continue;
25
27
28 $expireAfter = $set->getInteger('expireAfter', NULL);
29 if ($expireAfter !== NULL) {
30 $expire = time() + $expireAfter;
31 } else {
33 }
34
37 $outputFormat = $set->getValueValidate('outputFormat', array('flatfile', 'serialize'), 'flatfile');
38
40 'type' => $outputFormat,
42 ));
43
45
46 # Get global blacklist, whitelist and caching info
47 $blacklist =
$mconfig->getArray(
'blacklist', array());
48 $whitelist =
$mconfig->getArray(
'whitelist', array());
49 $conditionalGET =
$mconfig->getBoolean(
'conditionalGET', FALSE);
50
51
52 $available_types = array(
53 'saml20-idp-remote',
54 'saml20-sp-remote',
55 'shib13-idp-remote',
56 'shib13-sp-remote',
57 'attributeauthority-remote'
58 );
59 $set_types = $set->getArrayize('types', $available_types);
60
61 foreach($set->getArray(
'sources') AS
$source) {
62
63
66 } else {
68 }
69
70 # Merge global and src specific blacklists
71 if(isset(
$source[
'blacklist'])) {
72 $source[
'blacklist'] = array_unique(array_merge(
$source[
'blacklist'], $blacklist));
73 } else {
74 $source[
'blacklist'] = $blacklist;
75 }
76
77 # Merge global and src specific whitelists
78 if(isset(
$source[
'whitelist'])) {
79 $source[
'whitelist'] = array_unique(array_merge(
$source[
'whitelist'], $whitelist));
80 } else {
81 $source[
'whitelist'] = $whitelist;
82 }
83
84 # Let src specific conditionalGET override global one
85 if(!isset(
$source[
'conditionalGET'])) {
86 $source[
'conditionalGET'] = $conditionalGET;
87 }
88
91 }
92
93
95
96 switch ($outputFormat) {
97 case 'flatfile':
99 break;
100 case 'serialize':
102 break;
103 }
104
105 if ($set->hasValue('arp')) {
108 }
109 }
110
111 } catch (Exception $e) {
112 $croninfo[
'summary'][] =
'Error during metarefresh: ' . $e->getMessage();
113 }
114}
static getOptionalConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.
static loadFromArray($config, $location='[ARRAY]', $instance=null)
Loads a configuration from the given array.