]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Conversation.php
Memcached_DataObject::pkeyGet() accepts null values
[quix0rs-gnu-social.git] / classes / Conversation.php
index ea8bd87b5636907893101255dccc67dac81942d4..e029c20ba0d095145cff147b35aaec6f49d5dd5b 100755 (executable)
@@ -63,7 +63,8 @@ class Conversation extends Memcached_DataObject
         }
 
         $orig = clone($conv);
-        $orig->uri = common_local_url('conversation', array('id' => $id));
+        $orig->uri = common_local_url('conversation', array('id' => $id),
+                                      null, null, false);
         $result = $orig->update($conv);
 
         if (empty($result)) {
@@ -74,5 +75,22 @@ class Conversation extends Memcached_DataObject
         return $conv;
     }
 
-}
+    static function noticeCount($id)
+    {
+        $keypart = sprintf('conversation:notice_count:%d', $id);
+
+        $cnt = self::cacheGet($keypart);
+
+        if ($cnt !== false) {
+            return $cnt;
+        }
 
+        $notice               = new Notice();
+        $notice->conversation = $id;
+        $cnt                  = $notice->count();
+
+        self::cacheSet($keypart, $cnt);
+
+        return $cnt;
+    }
+}