From dfe7d7be0483654ca3b9b96e379e79fb455bdb6d Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Thu, 27 May 2010 09:02:15 +0000
Subject: [PATCH] metarefresh: Avoid warning from cron when missing
 configuration file.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2325 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/metarefresh/hooks/hook_cron.php | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/metarefresh/hooks/hook_cron.php b/modules/metarefresh/hooks/hook_cron.php
index b16364b0e..ce5b3a0e1 100644
--- a/modules/metarefresh/hooks/hook_cron.php
+++ b/modules/metarefresh/hooks/hook_cron.php
@@ -13,9 +13,14 @@ function metarefresh_hook_cron(&$croninfo) {
 
 	try {
 		$config = SimpleSAML_Configuration::getInstance();
-		$mconfig = SimpleSAML_Configuration::getConfig('config-metarefresh.php');
+		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;
+		}
 
-		$sets = $mconfig->getConfigList('sets');
+		$sets = $mconfig->getConfigList('sets', array());
 
 		foreach ($sets AS $setkey => $set) {
 			// Only process sets where cron matches the current cron tag.
-- 
GitLab