Support selecting the master server for write access.
authorGunnar Wrobel <p@rdus.de>
Tue, 2 Jun 2009 19:16:51 +0000 (21:16 +0200)
committerGunnar Wrobel <p@rdus.de>
Tue, 2 Jun 2009 19:27:55 +0000 (21:27 +0200)
framework/Kolab_Server/lib/Horde/Kolab/Server.php

index 55e7900..34b2270 100644 (file)
@@ -206,6 +206,24 @@ abstract class Horde_Kolab_Server
     }
 
     /**
+     * Get the connection to the master server for write access.
+     *
+     * @return Horde_Kolab_Server The Horde_Kolab_Server reference to the master
+     *                            server.
+     */
+    function &getMaster()
+    {
+        if (!isset($this->params['host_master'])
+            || !emtpy($this->params['write'])
+            || $this->params['host_master'] == $this->params['host']) {
+            return $this;
+        }
+        $params = $this->params;
+        $params['write'] = true;
+        return Horde_Kolab_Server::singleton($params);
+    }
+
+    /**
      * Stores the attribute definitions in the cache.
      *
      * @return Horde_Kolab_Server The concrete Horde_Kolab_Server reference.