X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FWatchedItemStore.php;h=06f93c6b99270f4c7d526a7bda8ecf3f0de11a14;hb=7fdc3d09a3b6bbb7ae046f46e5dbf65fd7aca8e4;hp=caa3fdbe06692d85fbdf9461ae5121937f2da692;hpb=1df6b21c90965ec7bb204d6fbab6082cc5805c3a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/WatchedItemStore.php b/includes/WatchedItemStore.php index caa3fdbe06..06f93c6b99 100644 --- a/includes/WatchedItemStore.php +++ b/includes/WatchedItemStore.php @@ -1,11 +1,13 @@ loadBalancer = $loadBalancer; $this->cache = $cache; + $this->readOnlyMode = $readOnlyMode; $this->stats = new NullStatsdDataFactory(); $this->deferredUpdatesAddCallableUpdateCallback = [ 'DeferredUpdates', 'addCallableUpdate' ]; $this->revisionGetTimestampFromIdCallback = [ 'Revision', 'getTimestampFromId' ]; @@ -457,7 +467,7 @@ class WatchedItemStore implements StatsdAwareInterface { $item = new WatchedItem( $user, $target, - $row->wl_notificationtimestamp + wfTimestampOrNull( TS_MW, $row->wl_notificationtimestamp ) ); $this->cache( $item ); @@ -571,7 +581,8 @@ class WatchedItemStore implements StatsdAwareInterface { ); foreach ( $res as $row ) { - $timestamps[$row->wl_namespace][$row->wl_title] = $row->wl_notificationtimestamp; + $timestamps[$row->wl_namespace][$row->wl_title] = + wfTimestampOrNull( TS_MW, $row->wl_notificationtimestamp ); } return $timestamps; @@ -594,7 +605,7 @@ class WatchedItemStore implements StatsdAwareInterface { * @return bool success */ public function addWatchBatchForUser( User $user, array $targets ) { - if ( $this->loadBalancer->getReadOnlyReason() !== false ) { + if ( $this->readOnlyMode->isReadOnly() ) { return false; } // Only loggedin user can have a watchlist @@ -652,7 +663,7 @@ class WatchedItemStore implements StatsdAwareInterface { */ public function removeWatch( User $user, LinkTarget $target ) { // Only logged in user can have a watchlist - if ( $this->loadBalancer->getReadOnlyReason() !== false || $user->isAnon() ) { + if ( $this->readOnlyMode->isReadOnly() || $user->isAnon() ) { return false; } @@ -783,7 +794,7 @@ class WatchedItemStore implements StatsdAwareInterface { */ public function resetNotificationTimestamp( User $user, Title $title, $force = '', $oldid = 0 ) { // Only loggedin user can have a watchlist - if ( $this->loadBalancer->getReadOnlyReason() !== false || $user->isAnon() ) { + if ( $this->readOnlyMode->isReadOnly() || $user->isAnon() ) { return false; }