Rename DB_SLAVE constant to DB_REPLICA
[lhc/web/wiklou.git] / includes / actions / InfoAction.php
index f7c30b7..43bff87 100644 (file)
@@ -22,6 +22,8 @@
  * @ingroup Actions
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * Displays information about a page.
  *
@@ -476,16 +478,18 @@ class InfoAction extends FormlessAction {
                if ( $firstRev ) {
                        $firstRevUser = $firstRev->getUserText( Revision::FOR_THIS_USER );
                        if ( $firstRevUser !== '' ) {
-                               $batch->add( NS_USER, $firstRevUser );
-                               $batch->add( NS_USER_TALK, $firstRevUser );
+                               $firstRevUserTitle = Title::makeTitle( NS_USER, $firstRevUser );
+                               $batch->addObj( $firstRevUserTitle );
+                               $batch->addObj( $firstRevUserTitle->getTalkPage() );
                        }
                }
 
                if ( $lastRev ) {
                        $lastRevUser = $lastRev->getUserText( Revision::FOR_THIS_USER );
                        if ( $lastRevUser !== '' ) {
-                               $batch->add( NS_USER, $lastRevUser );
-                               $batch->add( NS_USER_TALK, $lastRevUser );
+                               $lastRevUserTitle = Title::makeTitle( NS_USER, $lastRevUser );
+                               $batch->addObj( $lastRevUserTitle );
+                               $batch->addObj( $lastRevUserTitle->getTalkPage() );
                        }
                }
 
@@ -667,17 +671,17 @@ class InfoAction extends FormlessAction {
 
                return ObjectCache::getMainWANInstance()->getWithSetCallback(
                        self::getCacheKey( $page->getTitle(), $page->getLatest() ),
-                       86400 * 7,
+                       WANObjectCache::TTL_WEEK,
                        function ( $oldValue, &$ttl, &$setOpts ) use ( $page, $config, $fname ) {
                                $title = $page->getTitle();
                                $id = $title->getArticleID();
 
-                               $dbr = wfGetDB( DB_SLAVE );
-                               $dbrWatchlist = wfGetDB( DB_SLAVE, 'watchlist' );
+                               $dbr = wfGetDB( DB_REPLICA );
+                               $dbrWatchlist = wfGetDB( DB_REPLICA, 'watchlist' );
 
                                $setOpts += Database::getCacheSetOptions( $dbr, $dbrWatchlist );
 
-                               $watchedItemStore = WatchedItemStore::getDefaultInstance();
+                               $watchedItemStore = MediaWikiServices::getInstance()->getWatchedItemStore();
 
                                $result = [];
                                $result['watchers'] = $watchedItemStore->countWatchers( $title );