From: Chuck Hagenbuch Date: Mon, 4 Oct 2010 03:56:06 +0000 (-0400) Subject: Don't load drivers unless we need them. Also never try to list holidays if holidays... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=b4cdc46ba2287c3caa072be0fb2a4a9dafd4b569;p=horde.git Don't load drivers unless we need them. Also never try to list holidays if holidays are disabled. --- diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 276d9ea5b..dbadc0093 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -502,14 +502,16 @@ class Kronolith if ($showRemote) { /* Horde applications providing listTimeObjects. */ - $driver = self::getDriver('Horde'); - foreach ($GLOBALS['display_external_calendars'] as $external_cal) { - try { - $driver->open($external_cal); - $events = $driver->listEvents($startDate, $endDate, $showRecurrence); - self::mergeEvents($results, $events); - } catch (Kronolith_Exception $e) { - $GLOBALS['notification']->push($e); + if (count($GLOBALS['display_external_calendars'])) { + $driver = self::getDriver('Horde'); + foreach ($GLOBALS['display_external_calendars'] as $external_cal) { + try { + $driver->open($external_cal); + $events = $driver->listEvents($startDate, $endDate, $showRecurrence); + self::mergeEvents($results, $events); + } catch (Kronolith_Exception $e) { + $GLOBALS['notification']->push($e); + } } } @@ -525,14 +527,16 @@ class Kronolith } /* Holidays. */ - $driver = self::getDriver('Holidays'); - foreach ($GLOBALS['display_holidays'] as $holiday) { - try { - $driver->open($holiday); - $events = $driver->listEvents($startDate, $endDate, $showRecurrence); - self::mergeEvents($results, $events); - } catch (Kronolith_Exception $e) { - $GLOBALS['notification']->push($e); + if (count($GLOBALS['display_holidays']) && !empty($GLOBALS['conf']['holidays']['enable'])) { + $driver = self::getDriver('Holidays'); + foreach ($GLOBALS['display_holidays'] as $holiday) { + try { + $driver->open($holiday); + $events = $driver->listEvents($startDate, $endDate, $showRecurrence); + self::mergeEvents($results, $events); + } catch (Kronolith_Exception $e) { + $GLOBALS['notification']->push($e); + } } } }