r96847 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96846‎ | r96847 | r96848 >
Date:14:58, 12 September 2011
Author:nikerabbit
Status:fixme (Comments)
Tags:
Comment:
Start producing new style move log entries
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -3331,11 +3331,28 @@
33323332 private function moveOverExistingRedirect( &$nt, $reason = '', $createRedirect = true ) {
33333333 global $wgUser, $wgContLang, $wgEnableInterwikiTemplatesTracking, $wgGlobalDatabase;
33343334
3335 - $moveOverRedirect = $nt->exists();
 3335+ if ( $nt->exists() ) {
 3336+ $moveOverRedirect = true;
 3337+ $logtype = 'move_redir';
 3338+ } else {
 3339+ $moveOverRedirect = false;
 3340+ $logType = 'move';
 3341+ }
33363342
3337 - $commentMsg = ( $moveOverRedirect ? '1movedto2_redir' : '1movedto2' );
3338 - $comment = wfMsgForContent( $commentMsg, $this->getPrefixedText(), $nt->getPrefixedText() );
 3343+ $redirectSuppressed = !$createRedirect && $wgUser->isAllowed( 'suppressredirect' );
33393344
 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();
33403357 if ( $reason ) {
33413358 $comment .= wfMsgForContent( 'colon-separator' ) . $reason;
33423359 }
@@ -3442,16 +3459,13 @@
34433460 'pl_title' => $nt->getDBkey() ),
34443461 __METHOD__ );
34453462 }
3446 - $redirectSuppressed = false;
34473463 } else {
34483464 $this->resetArticleID( 0 );
3449 - $redirectSuppressed = true;
34503465 }
34513466
34523467 # 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 );
34563470
34573471 # Purge caches for old and new titles
34583472 if ( $moveOverRedirect ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r97043Fix variable name typo in r96847nikerabbit10:00, 14 September 2011
r97046Removed some more unused message made obsolete by r96847 (one was still refer...nikerabbit10:43, 14 September 2011

Comments

#Comment by MarkAHershberger (talk | contribs)   00:57, 8 March 2012

According to https://bugzilla.wikimedia.org/show_bug.cgi?id=34961#c2 this causes the username to be added to moves. enwiki (at least) would like it rolled back.

#Comment by Siebrand (talk | contribs)   07:02, 18 March 2012

There's nothing wrong with this as such. This is how the new log system works, and this is no reason for fixme, I think.

Status & tagging log