本文整理汇总了PHP中Notice::free方法的典型用法代码示例。如果您正苦于以下问题:PHP Notice::free方法的具体用法?PHP Notice::free怎么用?PHP Notice::free使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notice
的用法示例。
在下文中一共展示了Notice::free方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNoticeIds
function getNoticeIds($offset, $limit, $since_id, $max_id)
{
$notice = new Notice();
$qry = null;
$qry = 'SELECT notice.* FROM notice ';
$qry .= 'INNER JOIN happening ON happening.uri = notice.uri ';
$qry .= 'AND notice.is_local != ' . Notice::GATEWAY . ' ';
if ($since_id != 0) {
$qry .= 'AND notice.id > ' . $since_id . ' ';
}
if ($max_id != 0) {
$qry .= 'AND notice.id <= ' . $max_id . ' ';
}
// NOTE: we sort by event time, not by notice time!
$qry .= 'ORDER BY happening.created DESC ';
if (!is_null($offset)) {
$qry .= "LIMIT {$limit} OFFSET {$offset}";
}
$notice->query($qry);
$ids = array();
while ($notice->fetch()) {
$ids[] = $notice->id;
}
$notice->free();
unset($notice);
return $ids;
}
示例2: conversationRoot
/**
* Grab the earliest notice from this conversation.
*
* @return Notice or null
*/
function conversationRoot($profile = -1)
{
// XXX: can this happen?
if (empty($this->conversation)) {
return null;
}
// Get the current profile if not specified
if (is_int($profile) && $profile == -1) {
$profile = Profile::current();
}
// If this notice is out of scope, no root for you!
if (!$this->inScope($profile)) {
return null;
}
// If this isn't a reply to anything, then it's its own
// root if it's the earliest notice in the conversation:
if (empty($this->reply_to)) {
$root = new Notice();
$root->conversation = $this->conversation;
$root->orderBy('notice.created ASC');
$root->find(true);
// true means "fetch first result"
$root->free();
return $root;
}
if (is_null($profile)) {
$keypart = sprintf('notice:conversation_root:%d:null', $this->id);
} else {
$keypart = sprintf('notice:conversation_root:%d:%d', $this->id, $profile->id);
}
$root = self::cacheGet($keypart);
if ($root !== false && $root->inScope($profile)) {
return $root;
}
$last = $this;
while (true) {
try {
$parent = $last->getParent();
if ($parent->inScope($profile)) {
$last = $parent;
continue;
}
} catch (NoParentNoticeException $e) {
// Latest notice has no parent
} catch (NoResultException $e) {
// Notice was not found, so we can't go further up in the tree.
// FIXME: Maybe we should do this in a more stable way where deleted
// notices won't break conversation chains?
}
// No parent, or parent out of scope
$root = $last;
break;
}
self::cacheSet($keypart, $root);
return $root;
}
示例3: array
function _repeatsOfMeDirect($offset, $limit, $since_id, $max_id)
{
$qry = 'SELECT DISTINCT original.id AS id ' . 'FROM notice original JOIN notice rept ON original.id = rept.repeat_of ' . 'WHERE original.profile_id = ' . $this->id . ' ';
if ($since_id != 0) {
$qry .= 'AND original.id > ' . $since_id . ' ';
}
if ($max_id != 0) {
$qry .= 'AND original.id <= ' . $max_id . ' ';
}
// NOTE: we sort by fave time, not by notice time!
$qry .= 'ORDER BY original.id DESC ';
if (!is_null($offset)) {
$qry .= "LIMIT {$limit} OFFSET {$offset}";
}
$ids = array();
$notice = new Notice();
$notice->query($qry);
while ($notice->fetch()) {
$ids[] = $notice->id;
}
$notice->free();
$notice = NULL;
return $ids;
}
示例4: Notice
function _repeatStreamDirect($limit)
{
$notice = new Notice();
$notice->selectAdd();
// clears it
$notice->selectAdd('id');
$notice->repeat_of = $this->id;
$notice->orderBy('created');
// NB: asc!
if (!is_null($offset)) {
$notice->limit($offset, $limit);
}
$ids = array();
if ($notice->find()) {
while ($notice->fetch()) {
$ids[] = $notice->id;
}
}
$notice->free();
$notice = NULL;
return $ids;
}
示例5: conversationRoot
/**
* Grab the earliest notice from this conversation.
*
* @return Notice or null
*/
function conversationRoot($profile = -1)
{
// XXX: can this happen?
if (empty($this->conversation)) {
return null;
}
// Get the current profile if not specified
if (is_int($profile) && $profile == -1) {
$profile = Profile::current();
}
// If this notice is out of scope, no root for you!
if (!$this->inScope($profile)) {
return null;
}
// If this isn't a reply to anything, then it's its own
// root if it's the earliest notice in the conversation:
if (empty($this->reply_to)) {
$root = new Notice();
$root->conversation = $this->conversation;
$root->orderBy('notice.created ASC');
$root->find();
$root->fetch();
$root->free();
return $root;
}
if (is_null($profile)) {
$keypart = sprintf('notice:conversation_root:%d:null', $this->id);
} else {
$keypart = sprintf('notice:conversation_root:%d:%d', $this->id, $profile->id);
}
$root = self::cacheGet($keypart);
if ($root !== false && $root->inScope($profile)) {
return $root;
}
$last = $this;
while (true) {
try {
$parent = $last->getParent();
if ($parent->inScope($profile)) {
$last = $parent;
continue;
}
} catch (NoParentNoticeException $e) {
// Latest notice has no parent
}
// No parent, or parent out of scope
$root = $last;
break;
}
self::cacheSet($keypart, $root);
return $root;
}
示例6: array
function _repeatsOfMeDirect($offset, $limit, $since_id, $max_id)
{
$qry = 'SELECT DISTINCT original.id AS id ' . 'FROM notice original JOIN notice rept ON original.id = rept.repeat_of ' . 'WHERE original.profile_id = ' . $this->id . ' ';
$since = Notice::whereSinceId($since_id, 'original.id', 'original.created');
if ($since) {
$qry .= "AND ({$since}) ";
}
$max = Notice::whereMaxId($max_id, 'original.id', 'original.created');
if ($max) {
$qry .= "AND ({$max}) ";
}
$qry .= 'ORDER BY original.created, original.id DESC ';
if (!is_null($offset)) {
$qry .= "LIMIT {$limit} OFFSET {$offset}";
}
$ids = array();
$notice = new Notice();
$notice->query($qry);
while ($notice->fetch()) {
$ids[] = $notice->id;
}
$notice->free();
$notice = NULL;
return $ids;
}