From 510957e4d57f05b81b08d707d5d8a1d2cb2ec6bd Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Fri, 28 May 2010 06:20:48 +0000
Subject: [PATCH] metarefresh: Use getOptionalConfig to avoid errors when
 missing configuration file.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2326 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/metarefresh/hooks/hook_cron.php | 7 +------
 modules/metarefresh/www/fetch.php       | 4 ++--
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/modules/metarefresh/hooks/hook_cron.php b/modules/metarefresh/hooks/hook_cron.php
index ce5b3a0e1..f4a791c83 100644
--- a/modules/metarefresh/hooks/hook_cron.php
+++ b/modules/metarefresh/hooks/hook_cron.php
@@ -13,12 +13,7 @@ function metarefresh_hook_cron(&$croninfo) {
 
 	try {
 		$config = SimpleSAML_Configuration::getInstance();
-		try {
-			$mconfig = SimpleSAML_Configuration::getConfig('config-metarefresh.php');
-		} catch (Exception $e) {
-			SimpleSAML_Logger::info('cron [metarefresh]: Could not open configuration file for module - skipping.');
-			return;
-		}
+		$mconfig = SimpleSAML_Configuration::getOptionalConfig('config-metarefresh.php');
 
 		$sets = $mconfig->getConfigList('sets', array());
 
diff --git a/modules/metarefresh/www/fetch.php b/modules/metarefresh/www/fetch.php
index 246bf74af..20b6aec86 100644
--- a/modules/metarefresh/www/fetch.php
+++ b/modules/metarefresh/www/fetch.php
@@ -1,14 +1,14 @@
 <?php
 
 $config = SimpleSAML_Configuration::getInstance();
-$mconfig = SimpleSAML_Configuration::getConfig('config-metarefresh.php');
+$mconfig = SimpleSAML_Configuration::getOptionalConfig('config-metarefresh.php');
 
 SimpleSAML_Utilities::requireAdmin();
 
 SimpleSAML_Logger::setCaptureLog(TRUE);
 
 
-$sets = $mconfig->getConfigList('sets');
+$sets = $mconfig->getConfigList('sets', array());
 
 foreach ($sets AS $setkey => $set) {
 
-- 
GitLab