From ff621bdc8de72b81fe2043c40461f5a0bfef9ced Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Fri, 3 Jan 2014 16:48:06 +0100 Subject: [PATCH] ChangesListSpecialPage: Stop mutating $opts in buildMainQueryConds() Change-Id: I25bd15c3018e56ede05a529e38e577d6744c103e --- includes/specialpage/ChangesListSpecialPage.php | 17 ++++++++--------- includes/specials/SpecialRecentchanges.php | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) 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 -- 2.20.1