From: Bartosz Dziewoński Date: Fri, 3 Jan 2014 15:48:06 +0000 (+0100) Subject: ChangesListSpecialPage: Stop mutating $opts in buildMainQueryConds() X-Git-Tag: 1.31.0-rc.0~17069^2 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=ff621bdc8de72b81fe2043c40461f5a0bfef9ced;p=lhc%2Fweb%2Fwiklou.git ChangesListSpecialPage: Stop mutating $opts in buildMainQueryConds() Change-Id: I25bd15c3018e56ede05a529e38e577d6744c103e --- diff --git a/includes/specialpage/ChangesListSpecialPage.php b/includes/specialpage/ChangesListSpecialPage.php index 03bc8c2f12..4e2556ccf6 100644 --- a/includes/specialpage/ChangesListSpecialPage.php +++ b/includes/specialpage/ChangesListSpecialPage.php @@ -192,7 +192,6 @@ abstract class ChangesListSpecialPage extends SpecialPage { /** * Return an array of conditions depending of options set in $opts - * @todo Whyyyy is this mutating $opts… * * @param FormOptions $opts * @return array @@ -202,15 +201,15 @@ abstract class ChangesListSpecialPage extends SpecialPage { $user = $this->getUser(); $conds = array(); - // It makes no sense to hide both anons and logged-in users - // Where this occurs, force anons to be shown - $botsOnly = false; + // It makes no sense to hide both anons and logged-in users. When this occurs, try a guess on + // what the user meant and either show only bots or force anons to be shown. + $botsonly = false; + $hideanons = $opts['hideanons']; if ( $opts['hideanons'] && $opts['hideliu'] ) { - // Check if the user wants to show bots only if ( $opts['hidebots'] ) { - $opts['hideanons'] = false; + $hideanons = false; } else { - $botsOnly = true; + $botsonly = true; } } @@ -224,13 +223,13 @@ abstract class ChangesListSpecialPage extends SpecialPage { if ( $user->useRCPatrol() && $opts['hidepatrolled'] ) { $conds['rc_patrolled'] = 0; } - if ( $botsOnly ) { + if ( $botsonly ) { $conds['rc_bot'] = 1; } else { if ( $opts['hideliu'] ) { $conds[] = 'rc_user = 0'; } - if ( $opts['hideanons'] ) { + if ( $hideanons ) { $conds[] = 'rc_user != 0'; } } diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 07da6d9ee6..7352de7674 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -144,11 +144,11 @@ class SpecialRecentChanges extends ChangesListSpecialPage { public function validateOptions( FormOptions $opts ) { global $wgFeedLimit; $opts->validateIntBounds( 'limit', 0, $this->feedFormat ? $wgFeedLimit : 5000 ); + parent::validateOptions( $opts ); } /** * Return an array of conditions depending of options set in $opts - * @todo Whyyyy is this mutating $opts… * * @param FormOptions $opts * @return array