Merge "Make WatchedItem members private"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 29 Jan 2016 19:59:56 +0000 (19:59 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 29 Jan 2016 19:59:56 +0000 (19:59 +0000)
1  2 
includes/WatchedItem.php

diff --combined includes/WatchedItem.php
   */
  class WatchedItem {
        /** @var Title */
-       public $mTitle;
+       private $mTitle;
  
        /** @var User */
-       public $mUser;
+       private $mUser;
  
        /** @var int */
-       public $mCheckRights;
+       private $mCheckRights;
  
        /** @var bool */
        private $loaded = false;
         */
        const CHECK_USER_RIGHTS = 1;
  
 -      /**
 -       * Do DB master updates right now
 -       * @since 1.26
 -       */
 -      const IMMEDIATE = 0;
 -      /**
 -       * Do DB master updates via the job queue
 -       * @since 1.26
 -       */
 -      const DEFERRED = 1;
 -
        /**
         * Create a WatchedItem object with the given user and title
         * @since 1.22 $checkRights parameter added
         * @param bool $force Whether to force the write query to be executed even if the
         *    page is not watched or the notification timestamp is already NULL.
         * @param int $oldid The revision id being viewed. If not given or 0, latest revision is assumed.
 -       * @mode int $mode WatchedItem::DEFERRED/IMMEDIATE
         */
        public function resetNotificationTimestamp(
 -              $force = '', $oldid = 0, $mode = self::IMMEDIATE
 +              $force = '', $oldid = 0
        ) {
                // Only loggedin user can have a watchlist
                if ( wfReadOnly() || $this->mUser->isAnon() || !$this->isAllowed( 'editmywatchlist' ) ) {
                }
  
                // If the page is watched by the user (or may be watched), update the timestamp
 -              if ( $mode === self::DEFERRED ) {
 -                      $job = new ActivityUpdateJob(
 -                              $title,
 -                              array(
 -                                      'type'      => 'updateWatchlistNotification',
 -                                      'userid'    => $this->getUserId(),
 -                                      'notifTime' => $notificationTimestamp,
 -                                      'curTime'   => time()
 -                              )
 -                      );
 -                      // Try to run this post-send
 -                      DeferredUpdates::addCallableUpdate( function() use ( $job ) {
 -                              $job->run();
 -                      } );
 -              } else {
 -                      $dbw = wfGetDB( DB_MASTER );
 -                      $dbw->update( 'watchlist',
 -                              array( 'wl_notificationtimestamp' => $dbw->timestampOrNull( $notificationTimestamp ) ),
 -                              $this->dbCond(),
 -                              __METHOD__
 -                      );
 -              }
 +              $job = new ActivityUpdateJob(
 +                      $title,
 +                      array(
 +                              'type'      => 'updateWatchlistNotification',
 +                              'userid'    => $this->getUserId(),
 +                              'notifTime' => $notificationTimestamp,
 +                              'curTime'   => time()
 +                      )
 +              );
 +              // Try to run this post-send
 +              DeferredUpdates::addCallableUpdate( function() use ( $job ) {
 +                      $job->run();
 +              } );
  
                $this->timestamp = null;
        }