From 23f436ee775c1b4e4e9f5049e022049a13566295 Mon Sep 17 00:00:00 2001 From: Adam Roses Wight Date: Mon, 19 Oct 2015 00:27:26 -0700 Subject: [PATCH] Clean up recentChangesFlags rollups Move ad-hoc variables under an array, in preparation for merging with RC flags implemented by extensions. Bug: T120921 Change-Id: I5dd91ba5e5ed36785d9fbf01673defcd227c8b01 --- includes/changes/EnhancedChangesList.php | 34 +++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/includes/changes/EnhancedChangesList.php b/includes/changes/EnhancedChangesList.php index 088398278a..ed374b0e61 100644 --- a/includes/changes/EnhancedChangesList.php +++ b/includes/changes/EnhancedChangesList.php @@ -178,18 +178,24 @@ class EnhancedChangesList extends ChangesList { # Collate list of users $userlinks = array(); # Other properties - $unpatrolled = false; - $isnew = false; - $allBots = true; - $allMinors = true; $curId = 0; # Some catalyst variables... $namehidden = true; $allLogs = true; $RCShowChangedSize = $this->getConfig()->get( 'RCShowChangedSize' ); + $collectedRcFlags = array( + // All are by bots? + 'bot' => true, + // Includes a new page? + 'newpage' => false, + // All are minor edits? + 'minor' => true, + // Contains an unpatrolled edit? + 'unpatrolled' => false, + ); foreach ( $block as $rcObj ) { if ( $rcObj->mAttribs['rc_type'] == RC_NEW ) { - $isnew = true; + $collectedRcFlags['newpage'] = true; } // If all log actions to this page were hidden, then don't // give the name of the affected page for this block! @@ -201,7 +207,7 @@ class EnhancedChangesList extends ChangesList { $userlinks[$u] = 0; } if ( $rcObj->unpatrolled ) { - $unpatrolled = true; + $collectedRcFlags['unpatrolled'] = true; } if ( $rcObj->mAttribs['rc_type'] != RC_LOG ) { $allLogs = false; @@ -213,10 +219,10 @@ class EnhancedChangesList extends ChangesList { } if ( !$rcObj->mAttribs['rc_bot'] ) { - $allBots = false; + $collectedRcFlags['bot'] = false; } if ( !$rcObj->mAttribs['rc_minor'] ) { - $allMinors = false; + $collectedRcFlags['minor'] = false; } $userlinks[$u]++; @@ -247,12 +253,9 @@ class EnhancedChangesList extends ChangesList { $r .= "$tl"; # Main line - $r .= '' . $this->recentChangesFlags( array( - 'newpage' => $isnew, # show, when one have this flag - 'minor' => $allMinors, # show only, when all have this flag - 'unpatrolled' => $unpatrolled, # show, when one have this flag - 'bot' => $allBots, # show only, when all have this flag - ) ); + $r .= '' . $this->recentChangesFlags( + $collectedRcFlags + ); # Timestamp $r .= ' ' . $block[0]->timestamp . ' '; @@ -289,7 +292,8 @@ class EnhancedChangesList extends ChangesList { return ''; } - $r .= $this->getLogText( $block, $queryParams, $allLogs, $isnew, $namehidden ); + $r .= $this->getLogText( $block, $queryParams, $allLogs, + $collectedRcFlags['newpage'], $namehidden ); $r .= ' . . '; -- 2.20.1