示例#1
0
 function clearReplies()
 {
     $replyNotice = new Notice();
     $replyNotice->reply_to = $this->id;
     //Null any notices that are replies to this notice
     if ($replyNotice->find()) {
         while ($replyNotice->fetch()) {
             $orig = clone $replyNotice;
             $replyNotice->reply_to = null;
             $replyNotice->update($orig);
         }
     }
     // Reply records
     $reply = new Reply();
     $reply->notice_id = $this->id;
     if ($reply->find()) {
         while ($reply->fetch()) {
             self::blow('reply:stream:%d', $reply->profile_id);
             $reply->delete();
         }
     }
     $reply->free();
 }
示例#2
0
 function blowRepliesCache($blowLast = false)
 {
     $cache = common_memcache();
     if ($cache) {
         $reply = new Reply();
         $reply->notice_id = $this->id;
         if ($reply->find()) {
             while ($reply->fetch()) {
                 $cache->delete(common_cache_key('user:replies:' . $reply->profile_id));
                 if ($blowLast) {
                     $cache->delete(common_cache_key('user:replies:' . $reply->profile_id . ';last'));
                 }
             }
         }
         $reply->free();
         unset($reply);
     }
 }