Aude has uploaded a new change for review.

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

Change subject: Move rcShowChangedSize up to constructor in EnhancedChangesList
......................................................................

Move rcShowChangedSize up to constructor in EnhancedChangesList

Instead of obtaining it from config in multiple places
in the class.

Change-Id: If9d9f3360140e7103a16aee251a49b88288969b9
---
M includes/changes/EnhancedChangesList.php
1 file changed, 12 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/16/269116/1

diff --git a/includes/changes/EnhancedChangesList.php 
b/includes/changes/EnhancedChangesList.php
index 1c49545..1a1b0d0 100644
--- a/includes/changes/EnhancedChangesList.php
+++ b/includes/changes/EnhancedChangesList.php
@@ -33,6 +33,11 @@
        protected $rc_cache;
 
        /**
+        * @var bool
+        */
+       private $rcShowChangedSize;
+
+       /**
         * @param IContextSource|Skin $obj
         * @throws MWException
         */
@@ -56,6 +61,8 @@
                        $context,
                        $this->message
                );
+
+               $this->rcShowChangedSize = $this->getConfig()->get( 
'RCShowChangedSize' );
        }
 
        /**
@@ -185,7 +192,7 @@
                # Some catalyst variables...
                $namehidden = true;
                $allLogs = true;
-               $RCShowChangedSize = $this->getConfig()->get( 
'RCShowChangedSize' );
+
                $collectedRcFlags = array(
                        // All are by bots?
                        'bot' => true,
@@ -196,6 +203,7 @@
                        // Contains an unpatrolled edit?
                        'unpatrolled' => false,
                );
+
                foreach ( $block as $rcObj ) {
                        if ( $rcObj->mAttribs['rc_type'] == RC_NEW ) {
                                $collectedRcFlags['newpage'] = true;
@@ -284,7 +292,7 @@
 
                # Character difference (does not apply if only log items)
                $charDifference = false;
-               if ( $RCShowChangedSize && !$allLogs ) {
+               if ( $this->rcShowChangedSize === true && !$allLogs ) {
                        $last = 0;
                        $first = count( $block ) - 1;
                        # Some events (like logs) have an "empty" size, so we 
need to skip those...
@@ -336,8 +344,6 @@
         * @throws MWException
         */
        protected function getLineData( array $block, RCCacheEntry $rcObj, 
array $queryParams = array() ) {
-               $RCShowChangedSize = $this->getConfig()->get( 
'RCShowChangedSize' );
-
                # Classes to apply -- TODO implement
                $classes = array();
                $type = $rcObj->mAttribs['rc_type'];
@@ -395,7 +401,7 @@
                $data['separatorAfterCurrentAndLastLinks'] = $separator;
 
                # Character diff
-               if ( $RCShowChangedSize ) {
+               if ( $this->rcShowChangedSize === true ) {
                        $cd = $this->formatCharacterDifference( $rcObj );
                        if ( $cd !== '' ) {
                                $data['characterDiff'] = $cd;
@@ -610,7 +616,7 @@
                $data['separatorAfterLinks'] = ' <span 
class="mw-changeslist-separator">. .</span> ';
 
                # Character diff
-               if ( $this->getConfig()->get( 'RCShowChangedSize' ) ) {
+               if ( $this->rcShowChangedSize === true ) {
                        $cd = $this->formatCharacterDifference( $rcObj );
                        if ( $cd !== '' ) {
                                $data['characterDiff'] = $cd;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If9d9f3360140e7103a16aee251a49b88288969b9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to