From 5184c95cb7ef570918e2f6bc17eeab79c50878ab Mon Sep 17 00:00:00 2001 From: jan Date: Wed, 1 Aug 2012 18:52:30 +0200 Subject: [PATCH] Add feature to disable rollback edit count This change replaces I85f480726b41871cdf5349a19e3f650285d1dda6 (includes the change of Catrope). Add a feature to disable the rollback edit count (change 9bae2198c950040f9f9139893a23a1012d54d8d6) on special pages. Default it will be disabled on Recentchanges and Watchlist. Change-Id: Ifbbf802472ce678694b2b3ba4ef441344cc1d572 --- includes/Linker.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/includes/Linker.php b/includes/Linker.php index ae334c6b00..26e99cd98d 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1673,7 +1673,10 @@ class Linker { * @return String: HTML fragment */ public static function buildRollbackLink( $rev, IContextSource $context = null ) { - global $wgShowRollbackEditCount; + global $wgShowRollbackEditCount, $wgMiserMode; + + // To config which pages are effected by miser mode + $disableRollbackEditCountSpecialPage = array( 'Recentchanges', 'Watchlist' ); if ( $context === null ) { $context = RequestContext::getMain(); @@ -1690,13 +1693,24 @@ class Linker { $query['hidediff'] = '1'; // bug 15999 } - if( is_int( $wgShowRollbackEditCount ) && $wgShowRollbackEditCount > 0 ) { + $disableRollbackEditCount = false; + if( $wgMiserMode ) { + foreach( $disableRollbackEditCountSpecialPage as $specialPage ) { + if( $context->getTitle()->isSpecial( $specialPage ) ) { + $disableRollbackEditCount = true; + break; + } + } + } + + if( !$disableRollbackEditCount && is_int( $wgShowRollbackEditCount ) && $wgShowRollbackEditCount > 0 ) { $dbr = wfGetDB( DB_SLAVE ); // Up to the value of $wgShowRollbackEditCount revisions are counted $res = $dbr->select( 'revision', array( 'rev_id', 'rev_user_text' ), - array( 'rev_page' => $rev->getPage() ), + // $rev->getPage() returns null sometimes + array( 'rev_page' => $rev->getTitle()->getArticleID() ), __METHOD__, array( 'USE INDEX' => 'page_timestamp', 'ORDER BY' => 'rev_timestamp DESC', -- 2.20.1