From 6ff314908284fca776cace8af00a51981b676ea5 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 4 Jul 2011 12:49:09 -0400 Subject: [PATCH] SearchSub respects empty set from memcache. --- plugins/SearchSub/SearchSub.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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));