]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/User_group.php
staticGet for sub-Managed_DataObject classes now calls parent
[quix0rs-gnu-social.git] / classes / User_group.php
index d343c622e3733279daaa3ff82ab84d5bc736231f..447dbded452811211e02d9860e9670b41d3ca2a5 100644 (file)
@@ -30,11 +30,6 @@ class User_group extends Managed_DataObject
     public $join_policy;                     // tinyint
     public $force_scope;                     // tinyint
 
-    /* Static get */
-    function staticGet($k,$v=NULL) {
-        return Memcached_DataObject::staticGet('User_group',$k,$v);
-    }
-    
     function multiGet($keyCol, $keyVals, $skipNulls=true)
     {
         return parent::multiGet('User_group', $keyCol, $keyVals, $skipNulls);
@@ -143,25 +138,28 @@ class User_group extends Managed_DataObject
     }
 
     function getMembers($offset=0, $limit=null) {
+        $ids = null;
         if (is_null($limit) || $offset + $limit > User_group::CACHE_WINDOW) {
-            return $this->realGetMembers($offset,
-                                         $limit);
+            $ids = $this->getMemberIDs($offset,
+                                       $limit);
         } else {
-            $key = sprintf('group:members:%d', $this->id);
+            $key = sprintf('group:member_ids:%d', $this->id);
             $window = self::cacheGet($key);
             if ($window === false) {
-                $members = $this->realGetMembers(0,
-                                                 User_group::CACHE_WINDOW);
-                $window = $members->fetchAll();
+                $window = $this->getMemberIDs(0,
+                                              User_group::CACHE_WINDOW);
                 self::cacheSet($key, $window);
             }
-            return new ArrayWrapper(array_slice($window,
-                                                $offset,
-                                                $limit));
+
+            $ids = array_slice($window,
+                               $offset,
+                               $limit);
         }
+
+        return Profile::multiGet('id', $ids);
     }
 
-    function realGetMembers($offset=0, $limit=null)
+    function getMemberIDs($offset=0, $limit=null)
     {
         $gm = new Group_member();
 
@@ -184,9 +182,7 @@ class User_group extends Managed_DataObject
             }
         }
 
-        $members = Profile::multiGet('id', $ids);
-
-        return $members;
+        return $ids;
     }
 
     /**
@@ -408,7 +404,7 @@ class User_group extends Managed_DataObject
 
         // Are there any matching remote groups this profile's in?
         if ($profile) {
-            $group = $profile->getGroups();
+            $group = $profile->getGroups(0, null);
             while ($group->fetch()) {
                 if ($group->nickname == $nickname) {
                     // @fixme is this the best way?