From d35faa04c1927994916a46a1bd48f8420a3e2dfe Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 15 Jan 2010 13:06:21 -0800 Subject: [PATCH 1/2] Fix for background recalculation of groups; needs to get Group objects not IDs; also don't list any groups for repeats to match saveGroups behavior todo: merge calculation portion with saveGroups so they don't get out of sync --- classes/Notice.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index a43ce867b5..38b10db048 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -826,6 +826,10 @@ class Notice extends Memcached_DataObject return $ids; } + /** + * @param $groups array of Group *objects* + * @param $recipients array of profile *ids* + */ function whoGets($groups=null, $recipients=null) { $c = self::memcache(); @@ -925,6 +929,9 @@ class Notice extends Memcached_DataObject return $ids; } + /** + * @return array of Group objects + */ function saveGroups() { // Don't save groups for repeats @@ -1117,11 +1124,22 @@ class Notice extends Memcached_DataObject return $ids; } + /** + * Same calculation as saveGroups but without the saving + * @fixme merge the functions + * @return array of Group objects + */ function getGroups() { + // Don't save groups for repeats + + if (!empty($this->repeat_of)) { + return array(); + } + // XXX: cache me - $ids = array(); + $groups = array(); $gi = new Group_inbox(); @@ -1132,13 +1150,13 @@ class Notice extends Memcached_DataObject if ($gi->find()) { while ($gi->fetch()) { - $ids[] = $gi->group_id; + $groups[] = clone($gi); } } $gi->free(); - return $ids; + return $groups; } function asAtomEntry($namespace=false, $source=false) From 775c63b654dacf733e7bef99cb9f6f07aa824854 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 16 Jan 2010 13:39:05 -0800 Subject: [PATCH 2/2] Cleanup for memcached host/port split -- apparently we use ';' on purpose, restoring. Keeping fix for the notices spewing into the log. --- plugins/MemcachePlugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/MemcachePlugin.php b/plugins/MemcachePlugin.php index 5214ab9c89..8c8b8da6dc 100644 --- a/plugins/MemcachePlugin.php +++ b/plugins/MemcachePlugin.php @@ -170,8 +170,8 @@ class MemcachePlugin extends Plugin $servers = array($this->servers); } foreach ($servers as $server) { - if (strpos($server, ':') !== false) { - list($host, $port) = explode(':', $server); + if (strpos($server, ';') !== false) { + list($host, $port) = explode(';', $server); } else { $host = $server; $port = 11211;