Merge "registration: Don't let extensions load late"
[lhc/web/wiklou.git] / includes / specials / SpecialWatchlist.php
index 15691f2..4824961 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * A special page that lists last changes made to the wiki,
  * limited to user-defined list of titles.
@@ -311,7 +313,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
         * @return IDatabase
         */
        protected function getDB() {
-               return wfGetDB( DB_SLAVE, 'watchlist' );
+               return wfGetDB( DB_REPLICA, 'watchlist' );
        }
 
        /**
@@ -341,7 +343,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                $user = $this->getUser();
                $output = $this->getOutput();
 
-               # Show a message about slave lag, if applicable
+               # Show a message about replica DB lag, if applicable
                $lag = wfGetLB()->safeGetLag( $dbr );
                if ( $lag > 0 ) {
                        $output->showLagWarning( $lag );
@@ -365,7 +367,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                if ( $this->getConfig()->get( 'RCShowWatchingUsers' )
                        && $user->getOption( 'shownumberswatching' )
                ) {
-                       $watchedItemStore = WatchedItemStore::getDefaultInstance();
+                       $watchedItemStore = MediaWikiServices::getInstance()->getWatchedItemStore();
                }
 
                $s = $list->beginRecentChangesList();
@@ -427,7 +429,10 @@ class SpecialWatchlist extends ChangesListSpecialPage {
 
                $out->addSubtitle(
                        $this->msg( 'watchlistfor2', $user->getName() )
-                               ->rawParams( SpecialEditWatchlist::buildTools( null ) )
+                               ->rawParams( SpecialEditWatchlist::buildTools(
+                                       $this->getLanguage(),
+                                       $this->getLinkRenderer()
+                               ) )
                );
 
                $this->setTopText( $opts );
@@ -613,9 +618,10 @@ class SpecialWatchlist extends ChangesListSpecialPage {
 
                $form .= Xml::openElement( 'form', [
                        'method' => 'get',
-                       'action' => $this->getPageTitle()->getLocalURL(),
+                       'action' => wfScript(),
                        'id' => 'mw-watchlist-form'
                ] );
+               $form .= Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() );
                $form .= Xml::fieldset(
                        $this->msg( 'watchlist-options' )->text(),
                        false,
@@ -646,7 +652,8 @@ class SpecialWatchlist extends ChangesListSpecialPage {
         * @return int
         */
        protected function countItems() {
-               $count = WatchedItemStore::getDefaultInstance()->countWatchedItems( $this->getUser() );
+               $store = MediaWikiServices::getInstance()->getWatchedItemStore();
+               $count = $store->countWatchedItems( $this->getUser() );
                return floor( $count / 2 );
        }
 }