MediaWiki r27774 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r27773‎ | r27774 (on ViewVC)‎ | r27775 >
Date:11:27, 23 November 2007
Author:catrope
Status:old
Tags:
Comment:
Requiring suppressredirect right to suppress redirect creation
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -2193,7 +2193,8 @@
21942194 * @param bool $auth indicates whether $wgUser's permissions
21952195 * should be checked
21962196 * @param string $reason The reason for the move
2197 - * @param bool $createRedirect Whether to create a redirect from the old title to the new title
 2197+ * @param bool $createRedirect Whether to create a redirect from the old title to the new title.
 2198+ * Ignored if the user doesn't have the suppressredirect right.
21982199 * @return mixed true on success, message name on failure
21992200 */
22002201 public function moveTo( &$nt, $auth = true, $reason = '', $createRedirect = true ) {
@@ -2268,10 +2269,11 @@
22692270 * @param Title &$nt the page to move to, which should currently
22702271 * be a redirect
22712272 * @param string $reason The reason for the move
2272 - * @param bool $createRedirect Whether to leave a redirect at the old title
 2273+ * @param bool $createRedirect Whether to leave a redirect at the old title.
 2274+ * Ignored if the user doesn't have the suppressredirect right
22732275 */
22742276 private function moveOverExistingRedirect( &$nt, $reason = '', $createRedirect = true ) {
2275 - global $wgUseSquid;
 2277+ global $wgUseSquid, $wgUser;
22762278 $fname = 'Title::moveOverExistingRedirect';
22772279 $comment = wfMsgForContent( '1movedto2_redir', $this->getPrefixedText(), $nt->getPrefixedText() );
22782280
@@ -2309,7 +2311,7 @@
23102312 $linkCache->clearLink( $nt->getPrefixedDBkey() );
23112313
23122314 # Recreate the redirect, this time in the other direction.
2313 - if($createRedirect)
 2315+ if($createRedirect || !$wgUser->isAllowed('suppressredirect'))
23142316 {
23152317 $mwRedir = MagicWord::get( 'redirect' );
23162318 $redirectText = $mwRedir->getSynonym( 0 ) . ' [[' . $nt->getPrefixedText() . "]]\n";
@@ -2351,9 +2353,10 @@
23522354 * @param Title &$nt the new Title
23532355 * @param string $reason The reason for the move
23542356 * @param bool $createRedirect Whether to create a redirect from the old title to the new title
 2357+ * Ignored if the user doesn't have the suppressredirect right
23552358 */
23562359 private function moveToNewTitle( &$nt, $reason = '', $createRedirect = true ) {
2357 - global $wgUseSquid;
 2360+ global $wgUseSquid, $wgUser;
23582361 $fname = 'MovePageForm::moveToNewTitle';
23592362 $comment = wfMsgForContent( '1movedto2', $this->getPrefixedText(), $nt->getPrefixedText() );
23602363 if ( $reason ) {
@@ -2384,7 +2387,7 @@
23852388
23862389 $linkCache->clearLink( $nt->getPrefixedDBkey() );
23872390
2388 - if($createRedirect)
 2391+ if($createRedirect || !$wgUser->isAllowed('suppressredirect'))
23892392 {
23902393 # Insert redirect
23912394 $mwRedir = MagicWord::get( 'redirect' );
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1097,6 +1097,7 @@
10981098 $wgGroupPermissions['sysop']['ipblock-exempt'] = true;
10991099 $wgGroupPermissions['sysop']['blockemail'] = true;
11001100 $wgGroupPermissions['sysop']['markbotedits'] = true;
 1101+$wgGroupPermissions['sysop']['suppressredirect'] = true;
11011102
11021103 // Permission to change users' group assignments
11031104 $wgGroupPermissions['bureaucrat']['userrights'] = true;

Status & tagging log

  • 15:22, 12 September 2011 Meno25 (talk | contribs) changed the status of r27774 [removed: ok added: old]