当前位置: 首页>>代码示例>>PHP>>正文


PHP LoadBalancer::getReadOnlyReason方法代码示例

本文整理汇总了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;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:35,代码来源:WatchedItemStore.php


注:本文中的LoadBalancer::getReadOnlyReason方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。