本文整理汇总了PHP中LoadBalancer::getReadOnlyReason方法的典型用法代码示例。如果您正苦于以下问题:PHP LoadBalancer::getReadOnlyReason方法的具体用法?PHP LoadBalancer::getReadOnlyReason怎么用?PHP LoadBalancer::getReadOnlyReason使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoadBalancer
的用法示例。
在下文中一共展示了LoadBalancer::getReadOnlyReason方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resetNotificationTimestamp
/**
* Reset the notification timestamp of this entry
*
* @param User $user
* @param Title $title
* @param string $force Whether to force the write query to be executed even if the
* page is not watched or the notification timestamp is already NULL.
* 'force' in order to force
* @param int $oldid The revision id being viewed. If not given or 0, latest revision is assumed.
*
* @return bool success
*/
public function resetNotificationTimestamp(User $user, Title $title, $force = '', $oldid = 0)
{
// Only loggedin user can have a watchlist
if ($this->loadBalancer->getReadOnlyReason() !== false || $user->isAnon()) {
return false;
}
$item = null;
if ($force != 'force') {
$item = $this->loadWatchedItem($user, $title);
if (!$item || $item->getNotificationTimestamp() === null) {
return false;
}
}
// If the page is watched by the user (or may be watched), update the timestamp
$job = new ActivityUpdateJob($title, ['type' => 'updateWatchlistNotification', 'userid' => $user->getId(), 'notifTime' => $this->getNotificationTimestamp($user, $title, $item, $force, $oldid), 'curTime' => time()]);
// Try to run this post-send
// Calls DeferredUpdates::addCallableUpdate in normal operation
call_user_func($this->deferredUpdatesAddCallableUpdateCallback, function () use($job) {
$job->run();
});
$this->uncache($user, $title);
return true;
}