ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
fetch.php
Go to the documentation of this file.
1 <?php
2 
5 
7 
9 
10 
11 $sets = $mconfig->getConfigList('sets', array());
12 
13 foreach ($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();
$expire
Definition: saml2-acs.php:140
static requireAdmin()
Require admin access to the current page.
Definition: Auth.php:60
static setCaptureLog($val=true)
Definition: Logger.php:235
static debug($string)
Definition: Logger.php:213
foreach($argv as $a) if(count($files)===0) $metaloader
foreach($sets AS $setkey=> $set) $logentries
Definition: fetch.php:90
static info($string)
Definition: Logger.php:201
static getCapturedLog()
Get the captured log.
Definition: Logger.php:244
$outputDir
Definition: metarefresh.php:28
Create styles array
The data for the language used.
static fromException(Exception $e)
Convert any exception into a SimpleSAML_Error_Exception.
Definition: Exception.php:66
$sets
Definition: fetch.php:11
$t
Definition: fetch.php:92
static getOptionalConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
$source
Definition: linkback.php:22
$config
Definition: fetch.php:3
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.
$mconfig
Definition: fetch.php:4