本文整理汇总了PHP中Fave::blowCacheForProfileId方法的典型用法代码示例。如果您正苦于以下问题:PHP Fave::blowCacheForProfileId方法的具体用法?PHP Fave::blowCacheForProfileId怎么用?PHP Fave::blowCacheForProfileId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fave
的用法示例。
在下文中一共展示了Fave::blowCacheForProfileId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeEntry
public function removeEntry(Profile $actor, Notice $target)
{
$fave = new Fave();
$fave->user_id = $actor->getID();
$fave->notice_id = $target->getID();
if (!$fave->find(true)) {
// TRANS: Client error displayed when trying to remove a 'favor' when there is none in the first place.
throw new AlreadyFulfilledException(_('This is already not favorited.'));
}
$result = $fave->delete();
if ($result === false) {
common_log_db_error($fave, 'DELETE', __FILE__);
// TRANS: Server error displayed when removing a favorite from the database fails.
throw new ServerException(_('Could not delete favorite.'));
}
Fave::blowCacheForProfileId($actor->getID());
Fave::blowCacheForNoticeId($target->getID());
}
示例2: handle
/**
* Class handler.
*
* @param array $args query arguments
*
* @return void
*/
function handle($args)
{
parent::handle($args);
$profile = AnonymousFavePlugin::getAnonProfile();
if (empty($profile) || $_SERVER['REQUEST_METHOD'] != 'POST') {
$this->clientError(_m('Could not disfavor notice! Please make sure your browser has cookies enabled.'));
}
$id = $this->trimmed('notice');
$notice = Notice::getKV($id);
$token = $this->checkSessionToken();
$fave = new Fave();
$fave->user_id = $profile->id;
$fave->notice_id = $notice->id;
if (!$fave->find(true)) {
throw new NoResultException($fave);
}
$result = $fave->delete();
if (!$result) {
common_log_db_error($fave, 'DELETE', __FILE__);
// TRANS: Server error.
$this->serverError(_m('Could not delete favorite.'));
}
Fave::blowCacheForProfileId($profile->id);
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
// TRANS: Title.
$this->element('title', null, _m('Add to favorites'));
$this->elementEnd('head');
$this->elementStart('body');
$favor = new AnonFavorForm($this, $notice);
$favor->show();
$this->elementEnd('body');
$this->endHTML();
} else {
$this->returnToPrevious();
}
}
示例3: onProfileDeleteRelated
public function onProfileDeleteRelated(Profile $profile, array &$related)
{
$fave = new Fave();
$fave->user_id = $profile->id;
$fave->delete();
// Will perform a DELETE matching "user_id = {$user->id}"
$fave->free();
Fave::blowCacheForProfileId($profile->id);
return true;
}
示例4: handle
/**
* Handle the request
*
* Check the format and show the user info
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$this->clientError(_('This method requires a POST.'), 400, $this->format);
return;
}
if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError(_('API method not found.'), 404, $this->format);
return;
}
if (empty($this->notice)) {
$this->clientError(_('No status found with that ID.'), 404, $this->format);
return;
}
$fave = new Fave();
$fave->user_id = $this->user->id;
$fave->notice_id = $this->notice->id;
if (!$fave->find(true)) {
$this->clientError(_('That status is not a favorite.'), 403, $this->favorite);
return;
}
$result = $fave->delete();
if (!$result) {
common_log_db_error($fave, 'DELETE', __FILE__);
$this->clientError(_('Could not delete favorite.'), 404, $this->format);
return;
}
Fave::blowCacheForProfileId($this->user->id);
if ($this->format == 'xml') {
$this->showSingleXmlStatus($this->notice);
} elseif ($this->format == 'json') {
$this->show_single_json_status($this->notice);
}
}