function getNoticeIds($offset, $limit, $since_id, $max_id)
 {
     $reply = new Reply();
     $reply->selectAdd();
     $reply->selectAdd('notice_id');
     $reply->whereAdd(sprintf('reply.profile_id = %u', $this->userId));
     Notice::addWhereSinceId($reply, $since_id, 'notice_id', 'reply.modified');
     Notice::addWhereMaxId($reply, $max_id, 'notice_id', 'reply.modified');
     if (!empty($this->selectVerbs)) {
         $reply->joinAdd(array('notice_id', 'notice:id'));
         $reply->whereAddIn('notice.verb', $this->selectVerbs, 'string');
     }
     $reply->orderBy('reply.modified DESC, reply.notice_id DESC');
     if (!is_null($offset)) {
         $reply->limit($offset, $limit);
     }
     $ids = array();
     if ($reply->find()) {
         while ($reply->fetch()) {
             $ids[] = $reply->notice_id;
         }
     }
     return $ids;
 }
Example #2
0
 /**
  * Pull the complete list of @-reply targets for this notice.
  *
  * @return array of integer profile ids
  */
 function getReplies()
 {
     // XXX: cache me
     $ids = array();
     $reply = new Reply();
     $reply->selectAdd();
     $reply->selectAdd('profile_id');
     $reply->notice_id = $this->id;
     if ($reply->find()) {
         while ($reply->fetch()) {
             $ids[] = $reply->profile_id;
         }
     }
     $reply->free();
     return $ids;
 }
Example #3
0
 /**
  * Pull the complete list of @-reply targets for this notice.
  *
  * @return array of integer profile ids
  */
 function getReplies()
 {
     $keypart = sprintf('notice:reply_ids:%d', $this->id);
     $idstr = self::cacheGet($keypart);
     if ($idstr !== false) {
         $ids = explode(',', $idstr);
     } else {
         $ids = array();
         $reply = new Reply();
         $reply->selectAdd();
         $reply->selectAdd('profile_id');
         $reply->notice_id = $this->id;
         if ($reply->find()) {
             while ($reply->fetch()) {
                 $ids[] = $reply->profile_id;
             }
         }
         self::cacheSet($keypart, implode(',', $ids));
     }
     return $ids;
 }