From e23e3a3c79d0cbf092a0dc2698705917b6d7d053 Mon Sep 17 00:00:00 2001 From: Catrope Date: Thu, 19 Jul 2012 14:22:27 -0700 Subject: [PATCH] Fix bug in moveTo() with $auth=false and $createRedirect=false Even when $auth=false, moveToInternal() would unconditionally check $wgUser's 'suppressredirect' permissions and override $createRedirect. This means it was impossible to suppress redirect creation when moving pages in a maintenance script, even when telling moveTo() to disable permissions checks. Fixed by moving the check from moveToInternal() up into moveTo() and respecting $auth there Change-Id: I9b52dc67c7ae2dbda3ca62f78d4d7df118771c0f --- includes/Title.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index 6ddf6da4aa..4f7984ef23 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -3474,6 +3474,10 @@ class Title { $wgUser->spreadAnyEditBlock(); return $err; } + // Check suppressredirect permission + if ( $auth && !$wgUser->isAllowed( 'suppressredirect' ) ) { + $createRedirect = true; + } // If it is a file, move it first. // It is done before all other moving stuff is done because it's hard to revert. @@ -3570,8 +3574,8 @@ class Title { * * @param $nt Title the page to move to, which should be a redirect or nonexistent * @param $reason String The reason for the move - * @param $createRedirect Bool Whether to leave a redirect at the old title. Ignored - * if the user doesn't have the suppressredirect right + * @param $createRedirect Bool Whether to leave a redirect at the old title. Does not check + * if the user has the suppressredirect right * @throws MWException */ private function moveToInternal( &$nt, $reason = '', $createRedirect = true ) { @@ -3585,7 +3589,7 @@ class Title { $logType = 'move'; } - $redirectSuppressed = !$createRedirect && $wgUser->isAllowed( 'suppressredirect' ); + $redirectSuppressed = !$createRedirect; $logEntry = new ManualLogEntry( 'move', $logType ); $logEntry->setPerformer( $wgUser ); -- 2.20.1