From: Evan Prodromou Date: Mon, 4 Jul 2011 16:49:09 +0000 (-0400) Subject: SearchSub respects empty set from memcache. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6ff314908284fca776cace8af00a51981b676ea5;p=quix0rs-gnu-social.git SearchSub respects empty set from memcache. --- diff --git a/plugins/SearchSub/SearchSub.php b/plugins/SearchSub/SearchSub.php index b903e88e2e..7e9a94caa9 100644 --- a/plugins/SearchSub/SearchSub.php +++ b/plugins/SearchSub/SearchSub.php @@ -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));