Fix broken serialization for Share and Group packages (at least for the Sql driver)
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 8 Nov 2010 17:40:56 +0000 (10:40 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 8 Nov 2010 17:40:56 +0000 (10:40 -0700)
framework/Group/lib/Horde/Group.php
framework/Group/lib/Horde/Group/Sql.php
framework/Share/lib/Horde/Share.php
framework/Share/lib/Horde/Share/Sql.php

index 11093ce..a31f694 100644 (file)
@@ -147,7 +147,7 @@ class Horde_Group
      */
     public function shutdown()
     {
-        // TODO: Mve to core.
+        // TODO: Move to core.
         $GLOBALS['session']->store($this, false, 'horde_group');
     }
 
index 4e99285..7c41737 100644 (file)
@@ -42,6 +42,7 @@ class Horde_Group_Sql extends Horde_Group
      */
     public function __sleep()
     {
+        return array();
     }
 
     /**
index cd61cda..ea23c17 100644 (file)
@@ -133,7 +133,7 @@ class Horde_Share
      * (re)connect the share object to this share driver. Userful for when
      * share objects are unserialized from a cache separate from the share
      * driver.
-     * 
+     *
      * @param Horde_Share_Object $object
      */
     public function initShareObject($object)
@@ -483,8 +483,8 @@ class Horde_Share
      *
      * @param string $type   The callback to run
      * @param array $params  The parameters to pass to the callback.
-     * 
-     * @return mixed 
+     *
+     * @return mixed
      */
     public function runCallback($type, $params)
     {
index 6149018..c6bbe2f 100644 (file)
@@ -76,7 +76,9 @@ class Horde_Share_Sql extends Horde_Share implements Serializable
             $this->_shareMap,
             $this->_listcache,
             $this->_shareObject,
-            $this->_permsObject);
+            $this->_permsObject,
+            $this->_groups
+        );
 
         return serialize($data);
     }
@@ -103,7 +105,8 @@ class Horde_Share_Sql extends Horde_Share implements Serializable
         $this->_shareMap = $data[4];
         $this->_listcache = $data[5];
         $this->_shareObject = $data[6];
-        $this->_permsObject = $data [7];
+        $this->_permsObject = $data[7];
+        $this->_groups = $data[8];
 
         $this->_table = $this->_app . '_shares';
 
@@ -379,7 +382,7 @@ class Horde_Share_Sql extends Horde_Share implements Serializable
         foreach ($rows as $share) {
             $shares[(int)$share['share_id']] = $this->_fromDriverCharset($share);
         }
-        
+
         // Get users permissions
         try {
             $rows = $this->_db->selectAll('SELECT share_id, user_uid, perm FROM ' . $this->_table . '_users');
@@ -610,7 +613,7 @@ class Horde_Share_Sql extends Horde_Share implements Serializable
         $tables = array($this->_table,
                         $this->_table . '_users',
                         $this->_table . '_groups');
-        foreach ($tables as $table) { 
+        foreach ($tables as $table) {
             try {
                 $this->_db->delete('DELETE FROM ' . $table . ' WHERE share_id = ?', $params);
             } catch (Horde_Db_Exception $e) {
@@ -631,7 +634,7 @@ class Horde_Share_Sql extends Horde_Share implements Serializable
      * @throws Horde_Share_Exception
      */
     protected function _exists($share)
-    {   
+    {
         try {
             return (boolean)$this->_db->selectOne('SELECT 1 FROM ' . $this->_table . ' WHERE share_name = ?', array($share));
         } catch (Horde_Db_Exception $e) {
@@ -674,7 +677,6 @@ class Horde_Share_Sql extends Horde_Share implements Serializable
             . ' AND (' . Horde_SQL::buildClause($this->_db, 'u.perm', '&', $perm) . '))';
 
             // If the user has any group memberships, check for those also.
-            // @TODO: Inject the group driver
             try {
                 $groups = $this->_groups->getGroupMemberships($userid, true);
                 if ($groups) {