diff --git a/modules/metarefresh/www/fetch.php b/modules/metarefresh/www/fetch.php index 20b6aec868f8d87ab7c44ee08fb8218ac793b501..70f0ba0091623e4f75f14cc14ec88ddc7d9af6d4 100644 --- a/modules/metarefresh/www/fetch.php +++ b/modules/metarefresh/www/fetch.php @@ -14,32 +14,42 @@ foreach ($sets AS $setkey => $set) { SimpleSAML_Logger::info('[metarefresh]: Executing set [' . $setkey . ']'); - $expireAfter = $set->getInteger('expireAfter', NULL); - if ($expireAfter !== NULL) { - $expire = time() + $expireAfter; - } else { - $expire = NULL; - } - - $metaloader = new sspmod_metarefresh_MetaLoader($expire); - - foreach($set->getArray('sources') AS $source) { - SimpleSAML_Logger::debug('[metarefresh]: In set [' . $setkey . '] loading source [' . $source['src'] . ']'); - $metaloader->loadSource($source); - } - - $outputDir = $set->getString('outputDir'); - $outputDir = $config->resolvePath($outputDir); - - $outputFormat = $set->getValueValidate('outputFormat', array('flatfile', 'serialize'), 'flatfile'); - switch ($outputFormat) { - case 'flatfile': - $metaloader->writeMetadataFiles($outputDir); - break; - case 'serialize': - $metaloader->writeMetadataSerialize($outputDir); - break; + try { + + + $expireAfter = $set->getInteger('expireAfter', NULL); + if ($expireAfter !== NULL) { + $expire = time() + $expireAfter; + } else { + $expire = NULL; + } + + $metaloader = new sspmod_metarefresh_MetaLoader($expire); + + foreach($set->getArray('sources') AS $source) { + SimpleSAML_Logger::debug('[metarefresh]: In set [' . $setkey . '] loading source [' . $source['src'] . ']'); + $metaloader->loadSource($source); + } + + $outputDir = $set->getString('outputDir'); + $outputDir = $config->resolvePath($outputDir); + + $outputFormat = $set->getValueValidate('outputFormat', array('flatfile', 'serialize'), 'flatfile'); + switch ($outputFormat) { + case 'flatfile': + $metaloader->writeMetadataFiles($outputDir); + break; + case 'serialize': + $metaloader->writeMetadataSerialize($outputDir); + break; + } + } catch (Exception $e) { + if (! $e instanceof SimpleSAML_Error_Exception) { + $e = new SimpleSAML_Error_UnserializableException($e); + } + $e->logWarning(); } + }