From 02d3a7d2971a6c7babea8fa7ca8abad9ef8e1176 Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel Date: Thu, 15 Jul 2010 22:36:55 +0200 Subject: [PATCH] MFB: Avoid a notice when checking for locked resources. Fix the package specific exception. Correct freebusy driver selection. Fix search call to Kolab_Server. --- .../Kolab_Resource/lib/Horde/Kolab/Resource.php | 2 +- .../lib/Horde/Kolab/Resource/Exception.php | 39 +--------------------- .../lib/Horde/Kolab/Resource/Freebusy.php | 6 +++- .../lib/Horde/Kolab/Resource/Freebusy/Kolab.php | 2 +- framework/Kolab_Resource/package.xml | 34 +++++++++---------- 5 files changed, 25 insertions(+), 58 deletions(-) diff --git a/framework/Kolab_Resource/lib/Horde/Kolab/Resource.php b/framework/Kolab_Resource/lib/Horde/Kolab/Resource.php index e08377405..3f2624067 100644 --- a/framework/Kolab_Resource/lib/Horde/Kolab/Resource.php +++ b/framework/Kolab_Resource/lib/Horde/Kolab/Resource.php @@ -495,7 +495,7 @@ class Kolab_Resource if (is_dir($lockdir)) { $lockfile = $lockdir . '/' . $resource . '.lock'; $counter = 0; - while ($counter < $timeout && @file_get_contents($lockfile) == 'LOCKED') { + while ($counter < $timeout && file_exists($lockfile)) { sleep(1); $counter++; } diff --git a/framework/Kolab_Resource/lib/Horde/Kolab/Resource/Exception.php b/framework/Kolab_Resource/lib/Horde/Kolab/Resource/Exception.php index 02c6ee957..a90dfd26c 100644 --- a/framework/Kolab_Resource/lib/Horde/Kolab/Resource/Exception.php +++ b/framework/Kolab_Resource/lib/Horde/Kolab/Resource/Exception.php @@ -25,48 +25,11 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Resource */ -class Horde_Kolab_Resource_Exception extends Horde_Exception +class Horde_Kolab_Resource_Exception extends Exception { /** * Constants to define the error type. */ const SYSTEM = 1; const NO_FREEBUSY = 2; - - /** - * The array of available error messages. These are connected to the error - * codes used above and might be used to differentiate between what we show - * the user in the frontend and what we actually log in the backend. - * - * @var array - */ - protected $messages; - - /** - * Exception constructor - * - * @param mixed $message The exception message, a PEAR_Error object, or an - * Exception object. - * @param mixed $code A numeric error code, or - * an array from error_get_last(). - */ - public function __construct($message = null, $code = null) - { - $this->setMessages(); - - parent::__construct($message, $code); - } - - /** - * Initialize the messages handled by this exception. - * - * @return NULL - */ - protected function setMessages() - { - $this->messages = array( - self::SYSTEM => _("An internal error occured."), - self::NO_FREEBUSY => _("There is no free/busy data available."), - ); - } } diff --git a/framework/Kolab_Resource/lib/Horde/Kolab/Resource/Freebusy.php b/framework/Kolab_Resource/lib/Horde/Kolab/Resource/Freebusy.php index 031e8badd..8ba2806b5 100644 --- a/framework/Kolab_Resource/lib/Horde/Kolab/Resource/Freebusy.php +++ b/framework/Kolab_Resource/lib/Horde/Kolab/Resource/Freebusy.php @@ -115,7 +115,11 @@ class Horde_Kolab_Resource_Freebusy } if (empty($driver)) { - $driver = $conf['freebusy']['driver']; + if (isset($conf['freebusy']['driver'])) { + $driver = $conf['freebusy']['driver']; + } else { + $driver = 'Kolab'; + } } ksort($params); diff --git a/framework/Kolab_Resource/lib/Horde/Kolab/Resource/Freebusy/Kolab.php b/framework/Kolab_Resource/lib/Horde/Kolab/Resource/Freebusy/Kolab.php index bc45cc69f..0560bc5b7 100644 --- a/framework/Kolab_Resource/lib/Horde/Kolab/Resource/Freebusy/Kolab.php +++ b/framework/Kolab_Resource/lib/Horde/Kolab/Resource/Freebusy/Kolab.php @@ -40,7 +40,7 @@ class Horde_Kolab_Resource_Freebusy_Kolab extends Horde_Kolab_Resource_Freebusy protected function getUrl($resource) { $server = Horde_Kolab_Server::singleton(); - $uid = $server->uidForIdOrMailOrAlias($resource); + $uid = $server->uidForMailAddress($resource); $result = $server->fetch($uid)->getServer('freebusy'); return sprintf('%s/%s.xfb', $result, $resource); } diff --git a/framework/Kolab_Resource/package.xml b/framework/Kolab_Resource/package.xml index d6c58266c..2b4694af1 100644 --- a/framework/Kolab_Resource/package.xml +++ b/framework/Kolab_Resource/package.xml @@ -22,8 +22,8 @@ jan@horde.org yes - 2010-07-06 - + 2010-07-15 + 0.1.0 0.1.0 @@ -60,9 +60,13 @@ + + + + - + @@ -79,6 +83,10 @@ 1.4.0b1 + HTTP_Request + pear.php.net + + Horde pear.horde.org 0.0.2 @@ -89,10 +97,6 @@ 0.0.3 - Argv - pear.horde.org - - Horde_MIME pear.horde.org 0.0.2 @@ -107,17 +111,11 @@ pear.horde.org 0.2.0 - - - Horde_Notification + Kolab_Storage pear.horde.org - - Horde_Prefs - pear.horde.org - - + @@ -130,8 +128,10 @@ + - + + @@ -144,7 +144,7 @@ alpha alpha - 2010-07-06 + 2010-07-14 LGPL * Extracted package from Kolab_Filter. -- 2.11.0