Index: trunk/phase3/includes/Title.php |
— | — | @@ -3331,11 +3331,28 @@ |
3332 | 3332 | private function moveOverExistingRedirect( &$nt, $reason = '', $createRedirect = true ) { |
3333 | 3333 | global $wgUser, $wgContLang, $wgEnableInterwikiTemplatesTracking, $wgGlobalDatabase; |
3334 | 3334 | |
3335 | | - $moveOverRedirect = $nt->exists(); |
| 3335 | + if ( $nt->exists() ) { |
| 3336 | + $moveOverRedirect = true; |
| 3337 | + $logtype = 'move_redir'; |
| 3338 | + } else { |
| 3339 | + $moveOverRedirect = false; |
| 3340 | + $logType = 'move'; |
| 3341 | + } |
3336 | 3342 | |
3337 | | - $commentMsg = ( $moveOverRedirect ? '1movedto2_redir' : '1movedto2' ); |
3338 | | - $comment = wfMsgForContent( $commentMsg, $this->getPrefixedText(), $nt->getPrefixedText() ); |
| 3343 | + $redirectSuppressed = !$createRedirect && $wgUser->isAllowed( 'suppressredirect' ); |
3339 | 3344 | |
| 3345 | + $logEntry = new ManualLogEntry( 'move', $logType ); |
| 3346 | + $logEntry->setPerformer( $wgUser ); |
| 3347 | + $logEntry->setTarget( $this ); |
| 3348 | + $logEntry->setComment( $reason ); |
| 3349 | + $logEntry->setParameters( array( |
| 3350 | + '4::target' => $nt->getPrefixedText(), |
| 3351 | + '5::noredir' => $redirectSuppressed ? '1': '0', |
| 3352 | + ) ); |
| 3353 | + |
| 3354 | + $formatter = LogFormatter::newFromEntry( $logEntry ); |
| 3355 | + $formatter->setContext( RequestContext::newExtraneousContext( $this ) ); |
| 3356 | + $comment = $formatter->getPlainActionText(); |
3340 | 3357 | if ( $reason ) { |
3341 | 3358 | $comment .= wfMsgForContent( 'colon-separator' ) . $reason; |
3342 | 3359 | } |
— | — | @@ -3442,16 +3459,13 @@ |
3443 | 3460 | 'pl_title' => $nt->getDBkey() ), |
3444 | 3461 | __METHOD__ ); |
3445 | 3462 | } |
3446 | | - $redirectSuppressed = false; |
3447 | 3463 | } else { |
3448 | 3464 | $this->resetArticleID( 0 ); |
3449 | | - $redirectSuppressed = true; |
3450 | 3465 | } |
3451 | 3466 | |
3452 | 3467 | # Log the move |
3453 | | - $log = new LogPage( 'move' ); |
3454 | | - $logType = ( $moveOverRedirect ? 'move_redir' : 'move' ); |
3455 | | - $log->addEntry( $logType, $this, $reason, array( 1 => $nt->getPrefixedText(), 2 => $redirectSuppressed ) ); |
| 3468 | + $logid = $logEntry->insert(); |
| 3469 | + $logEntry->publish( $logid ); |
3456 | 3470 | |
3457 | 3471 | # Purge caches for old and new titles |
3458 | 3472 | if ( $moveOverRedirect ) { |