]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
clear cache for Profile::hasRepeated() at Notice::insert() time
authorEvan Prodromou <evan@status.net>
Wed, 3 Feb 2010 17:31:25 +0000 (12:31 -0500)
committerEvan Prodromou <evan@status.net>
Wed, 3 Feb 2010 17:31:25 +0000 (12:31 -0500)
classes/Notice.php

index 42878d94f1aed2fc7da3c7355d41e9e64ac11268..f9f38635797f44456610cb973baf2611bdebd3a3 100644 (file)
@@ -1468,4 +1468,25 @@ class Notice extends Memcached_DataObject
             $handler->handle($this);
         }
     }
+
+    function insert()
+    {
+        $result = parent::insert();
+
+        if ($result) {
+            // Profile::hasRepeated() abuses pkeyGet(), so we
+            // have to clear manually
+            if (!empty($this->repeat_of)) {
+                $c = self::memcache();
+                if (!empty($c)) {
+                    $ck = self::multicacheKey('Notice',
+                                              array('profile_id' => $this->profile_id,
+                                                    'repeat_of' => $this->repeat_of));
+                    $c->delete($ck);
+                }
+            }
+        }
+
+        return $result;
+    }
 }