]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
SearchSub respects empty set from memcache.
authorEvan Prodromou <evan@status.net>
Mon, 4 Jul 2011 16:49:09 +0000 (12:49 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 4 Jul 2011 16:49:09 +0000 (12:49 -0400)
plugins/SearchSub/SearchSub.php

index b903e88e2eac85e0be06f68de9da64ed23be3af1..7e9a94caa9ef8ad79979918183f4dd9e61b3d8ea 100644 (file)
@@ -147,18 +147,18 @@ class SearchSub extends Managed_DataObject
         $keypart = sprintf('searchsub:by_profile:%d', $profile->id);
         $searchstring = self::cacheGet($keypart);
         
-        if ($searchstring !== false && !empty($searchstring)) {
-            $searches = explode(',', $searchstring);
+        if ($searchstring !== false) {
+               if (!empty($searchstring)) {
+               $searches = explode(',', $searchstring);
+               }
         } else {
             $searchsub = new SearchSub();
             $searchsub->profile_id = $profile->id;
+            $searchsub->selectAdd();
+            $searchsub->selectAdd('search');
 
             if ($searchsub->find()) {
-                while ($searchsub->fetch()) {
-                    if (!empty($searchsub->search)) {
-                        $searches[] = $searchsub->search;
-                    }
-                }
+                $searches = $searchsub->fetchAll('search');
             }
 
             self::cacheSet($keypart, implode(',', $searches));