From 7f8ed89b31194047466388686468717a961475bb Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel Date: Tue, 16 Mar 2010 13:22:38 +0100 Subject: [PATCH] Fix some decorator problems. --- .../lib/Horde/Kolab/Server/Decorator/Count.php | 60 ++++++++++++++++++---- .../lib/Horde/Kolab/Server/Decorator/Log.php | 5 +- 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Count.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Count.php index a3d51f547..11fc564c5 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Count.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Count.php @@ -96,7 +96,11 @@ implements Horde_Kolab_Server_Interface public function connectGuid($guid = null, $pass = null) { $this->_server->connectGuid($guid, $pass); - $this->_count['connectGuid']++; + if (!isset($this->_count['connectGuid'])) { + $this->_count['connectGuid'] = 1; + } else { + $this->_count['connectGuid']++; + } } /** @@ -132,8 +136,12 @@ implements Horde_Kolab_Server_Interface */ public function read($guid, array $attrs = array()) { + if (!isset($this->_count['read'])) { + $this->_count['read'] = 1; + } else { + $this->_count['read']++; + } return $this->_server->read($guid); - $this->_count['read']++; } /** @@ -150,8 +158,12 @@ implements Horde_Kolab_Server_Interface */ public function readAttributes($guid, array $attrs) { + if (!isset($this->_count['readAttributes'])) { + $this->_count['readAttributes'] = 1; + } else { + $this->_count['readAttributes']++; + } return $this->_server->readAttributes($guid, $attrs); - $this->_count['readAttributes']++; } /** @@ -166,8 +178,12 @@ implements Horde_Kolab_Server_Interface */ public function find($query, array $params = array()) { + if (!isset($this->_count['find'])) { + $this->_count['find'] = 1; + } else { + $this->_count['find']++; + } return $this->_server->find($query, $params); - $this->_count['find']++; } /** @@ -183,8 +199,12 @@ implements Horde_Kolab_Server_Interface */ public function findBelow($query, $parent, array $params = array()) { + if (!isset($this->_count['findBelow'])) { + $this->_count['findBelow'] = 1; + } else { + $this->_count['findBelow']++; + } return $this->_server->findBelow($query, $parent, $params); - $this->_count['findBelow']++; } /** @@ -203,7 +223,11 @@ implements Horde_Kolab_Server_Interface array $data ) { $this->_server->save($object, $data); - $this->_count['save']++; + if (!isset($this->_count['save'])) { + $this->_count['save'] = 1; + } else { + $this->_count['save']++; + } } /** @@ -222,7 +246,11 @@ implements Horde_Kolab_Server_Interface array $data ) { $this->_server->add($object, $data); - $this->_count['add']++; + if (!isset($this->_count['add'])) { + $this->_count['add'] = 1; + } else { + $this->_count['add']++; + } } /** @@ -237,7 +265,11 @@ implements Horde_Kolab_Server_Interface public function delete($guid) { $this->_server->delete($guid); - $this->_count['delete']++; + if (!isset($this->_count['delete'])) { + $this->_count['delete'] = 1; + } else { + $this->_count['delete']++; + } } /** @@ -253,7 +285,11 @@ implements Horde_Kolab_Server_Interface public function rename($guid, $new) { $this->_server->rename($guid, $new); - $this->_count['rename']++; + if (!isset($this->_count['rename'])) { + $this->_count['rename'] = 1; + } else { + $this->_count['rename']++; + } } /** @@ -266,7 +302,11 @@ implements Horde_Kolab_Server_Interface public function getSchema() { return $this->_server->getSchema(); - $this->_count['getSchema']++; + if (!isset($this->_count['getSchema'])) { + $this->_count['getSchema'] = 1; + } else { + $this->_count['getSchema']++; + } } /** diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Log.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Log.php index 5fe6ab8a4..f356ce211 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Log.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Log.php @@ -80,10 +80,11 @@ implements Horde_Kolab_Server_Interface } catch (Horde_Kolab_Server_Exception $e) { $this->_logger->info( sprintf( - "Failed saving object \"%s\"! Error: %s", - $object->getGuid(), $e->getMessage() + "Failed connecting to the Kolab Server as \"%s\"! Error: %s", + $guid, $e->getMessage() ) ); + throw $e; } } -- 2.11.0