Umherirrender has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/155796

Change subject: Use getConfig for ChangesList
......................................................................

Use getConfig for ChangesList

Change-Id: I1f440a2fca2dd8f1973987d635c70954938b6ea6
---
M includes/changes/ChangesList.php
M includes/changes/EnhancedChangesList.php
M includes/changes/OldChangesList.php
3 files changed, 9 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/96/155796/1

diff --git a/includes/changes/ChangesList.php b/includes/changes/ChangesList.php
index 9b9c102..d3c44af 100644
--- a/includes/changes/ChangesList.php
+++ b/includes/changes/ChangesList.php
@@ -110,9 +110,8 @@
         * @return string
         */
        public function recentChangesFlags( $flags, $nothing = ' ' ) {
-               global $wgRecentChangesFlags;
                $f = '';
-               foreach ( array_keys( $wgRecentChangesFlags ) as $flag ) {
+               foreach ( array_keys( $this->getConfig()->get( 
'RecentChangesFlags' ) ) as $flag ) {
                        $f .= isset( $flags[$flag] ) && $flags[$flag]
                                ? self::flag( $flag )
                                : $nothing;
@@ -188,8 +187,6 @@
         * @return string
         */
        public static function showCharacterDifference( $old, $new, 
IContextSource $context = null ) {
-               global $wgRCChangedSizeThreshold, $wgMiserMode;
-
                if ( !$context ) {
                        $context = RequestContext::getMain();
                }
@@ -199,10 +196,11 @@
                $szdiff = $new - $old;
 
                $lang = $context->getLanguage();
+               $config = $context->getConfig();
                $code = $lang->getCode();
                static $fastCharDiff = array();
                if ( !isset( $fastCharDiff[$code] ) ) {
-                       $fastCharDiff[$code] = $wgMiserMode || $context->msg( 
'rc-change-size' )->plain() === '$1';
+                       $fastCharDiff[$code] = $config->get( 'MiserMode' ) || 
$context->msg( 'rc-change-size' )->plain() === '$1';
                }
 
                $formattedSize = $lang->formatNum( $szdiff );
@@ -211,7 +209,7 @@
                        $formattedSize = $context->msg( 'rc-change-size', 
$formattedSize )->text();
                }
 
-               if ( abs( $szdiff ) > abs( $wgRCChangedSizeThreshold ) ) {
+               if ( abs( $szdiff ) > abs( $config->get( 
'RCChangedSizeThreshold' ) ) ) {
                        $tag = 'strong';
                } else {
                        $tag = 'span';
diff --git a/includes/changes/EnhancedChangesList.php 
b/includes/changes/EnhancedChangesList.php
index 82e36d9..4ab7729 100644
--- a/includes/changes/EnhancedChangesList.php
+++ b/includes/changes/EnhancedChangesList.php
@@ -160,8 +160,6 @@
         * @return string
         */
        protected function recentChangesBlockGroup( $block ) {
-               global $wgRCShowChangedSize;
-
                wfProfileIn( __METHOD__ );
 
                # Add the namespace and title of the block as part of the class
@@ -191,6 +189,7 @@
                $namehidden = true;
                $allLogs = true;
                $oldid = '';
+               $RCShowChangedSize = $this->getConfig()->get( 
'RCShowChangedSize' );
                foreach ( $block as $rcObj ) {
                        $oldid = $rcObj->mAttribs['rc_last_oldid'];
                        if ( $rcObj->mAttribs['rc_type'] == RC_NEW ) {
@@ -364,7 +363,7 @@
                $r .= ' <span class="mw-changeslist-separator">. .</span> ';
 
                # Character difference (does not apply if only log items)
-               if ( $wgRCShowChangedSize && !$allLogs ) {
+               if ( $RCShowChangedSize && !$allLogs ) {
                        $last = 0;
                        $first = count( $block ) - 1;
                        # Some events (like logs) have an "empty" size, so we 
need to skip those...
@@ -442,7 +441,7 @@
                        $r .= ' <span class="mw-changeslist-separator">. 
.</span> ';
 
                        # Character diff
-                       if ( $wgRCShowChangedSize ) {
+                       if ( $RCShowChangedSize ) {
                                $cd = $this->formatCharacterDifference( $rcObj 
);
                                if ( $cd !== '' ) {
                                        $r .= $cd . ' <span 
class="mw-changeslist-separator">. .</span> ';
@@ -481,8 +480,6 @@
         * @return string A HTML formatted line (generated using $r)
         */
        protected function recentChangesBlockLine( $rcObj ) {
-               global $wgRCShowChangedSize;
-
                wfProfileIn( __METHOD__ );
                $query['curid'] = $rcObj->mAttribs['rc_cur_id'];
 
@@ -533,7 +530,7 @@
                }
                $r .= ' <span class="mw-changeslist-separator">. .</span> ';
                # Character diff
-               if ( $wgRCShowChangedSize ) {
+               if ( $this->getConfig()->get( 'RCShowChangedSize' ) ) {
                        $cd = $this->formatCharacterDifference( $rcObj );
                        if ( $cd !== '' ) {
                                $r .= $cd . ' <span 
class="mw-changeslist-separator">. .</span> ';
diff --git a/includes/changes/OldChangesList.php 
b/includes/changes/OldChangesList.php
index d590ff6..17c5b6e 100644
--- a/includes/changes/OldChangesList.php
+++ b/includes/changes/OldChangesList.php
@@ -31,7 +31,6 @@
         * @return string|bool
         */
        public function recentChangesLine( &$rc, $watched = false, $linenumber 
= null ) {
-               global $wgRCShowChangedSize;
                wfProfileIn( __METHOD__ );
 
                # Should patrol-related stuff be shown?
@@ -80,7 +79,7 @@
                # Edit/log timestamp
                $this->insertTimestamp( $s, $rc );
                # Bytes added or removed
-               if ( $wgRCShowChangedSize ) {
+               if ( $this->getConfig()->get( 'RCShowChangedSize' ) ) {
                        $cd = $this->formatCharacterDifference( $rc );
                        if ( $cd !== '' ) {
                                $s .= $cd . '  <span 
class="mw-changeslist-separator">. .</span> ';

-- 
To view, visit https://gerrit.wikimedia.org/r/155796
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f440a2fca2dd8f1973987d635c70954938b6ea6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to