ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
fetch.php
Go to the documentation of this file.
1<?php
2
5
7
9
10
11$sets = $mconfig->getConfigList('sets', array());
12
13foreach ($sets AS $setkey => $set) {
14
15 SimpleSAML\Logger::info('[metarefresh]: Executing set [' . $setkey . ']');
16
17 try {
18
19
20 $expireAfter = $set->getInteger('expireAfter', NULL);
21 if ($expireAfter !== NULL) {
22 $expire = time() + $expireAfter;
23 } else {
24 $expire = NULL;
25 }
26
28
29 # Get global black/whitelists
30 $blacklist = $mconfig->getArray('blacklist', array());
31 $whitelist = $mconfig->getArray('whitelist', array());
32
33 // get global type filters
34 $available_types = array(
35 'saml20-idp-remote',
36 'saml20-sp-remote',
37 'shib13-idp-remote',
38 'shib13-sp-remote',
39 'attributeauthority-remote'
40 );
41 $set_types = $set->getArrayize('types', $available_types);
42
43 foreach($set->getArray('sources') AS $source) {
44
45 // filter metadata by type of entity
46 if (isset($source['types'])) {
47 $metaloader->setTypes($source['types']);
48 } else {
49 $metaloader->setTypes($set_types);
50 }
51
52 # Merge global and src specific blacklists
53 if(isset($source['blacklist'])) {
54 $source['blacklist'] = array_unique(array_merge($source['blacklist'], $blacklist));
55 } else {
56 $source['blacklist'] = $blacklist;
57 }
58
59 # Merge global and src specific whitelists
60 if(isset($source['whitelist'])) {
61 $source['whitelist'] = array_unique(array_merge($source['whitelist'], $whitelist));
62 } else {
63 $source['whitelist'] = $whitelist;
64 }
65
66 SimpleSAML\Logger::debug('[metarefresh]: In set [' . $setkey . '] loading source [' . $source['src'] . ']');
67 $metaloader->loadSource($source);
68 }
69
70 $outputDir = $set->getString('outputDir');
71 $outputDir = $config->resolvePath($outputDir);
72
73 $outputFormat = $set->getValueValidate('outputFormat', array('flatfile', 'serialize'), 'flatfile');
74 switch ($outputFormat) {
75 case 'flatfile':
76 $metaloader->writeMetadataFiles($outputDir);
77 break;
78 case 'serialize':
79 $metaloader->writeMetadataSerialize($outputDir);
80 break;
81 }
82 } catch (Exception $e) {
84 $e->logWarning();
85 }
86
87
88}
89
91
92$t = new SimpleSAML_XHTML_Template($config, 'metarefresh:fetch.tpl.php');
93$t->data['logentries'] = $logentries;
94$t->show();
$source
Definition: linkback.php:22
An exception for terminatinating execution or to throw for unit testing.
static info($string)
Definition: Logger.php:199
static getCapturedLog()
Get the captured log.
Definition: Logger.php:242
static setCaptureLog($val=true)
Definition: Logger.php:233
static debug($string)
Definition: Logger.php:211
static requireAdmin()
Require admin access to the current page.
Definition: Auth.php:60
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 fromException(Exception $e)
Convert any exception into a SimpleSAML_Error_Exception.
Definition: Exception.php:66
$t
Definition: fetch.php:92
$config
Definition: fetch.php:3
foreach($sets AS $setkey=> $set) $logentries
Definition: fetch.php:90
$mconfig
Definition: fetch.php:4
$sets
Definition: fetch.php:11
$expire
Definition: saml2-acs.php:140
foreach( $argv as $a) if(count($files)===0) $metaloader
$outputDir
Definition: metarefresh.php:28