X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2FMovePage.php;h=2cd9698c0f5a654a237ce4289fa5205c8ef0fc72;hp=989110602268a61d5dac81db936e5193e983fb96;hb=59ebff658ce912c1b0e7ef8d8f9bfec5a4e17b39;hpb=036934b14b4b82e5d819af70fffc0ad486d90c56 diff --git a/includes/MovePage.php b/includes/MovePage.php index 9891106022..2cd9698c0f 100644 --- a/includes/MovePage.php +++ b/includes/MovePage.php @@ -305,8 +305,8 @@ class MovePage { __METHOD__, array( 'IGNORE' ) ); - # Update the protection log - $log = new LogPage( 'protect' ); + + // Build comment for log $comment = wfMessage( 'prot_1movedto2', $this->oldTitle->getPrefixedText(), @@ -315,14 +315,6 @@ class MovePage { if ( $reason ) { $comment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $reason; } - // @todo FIXME: $params? - $logId = $log->addEntry( - 'move_prot', - $this->newTitle, - $comment, - array( $this->oldTitle->getPrefixedText() ), - $user - ); // reread inserted pr_ids for log relation $insertedPrIds = $dbw->select( @@ -335,7 +327,18 @@ class MovePage { foreach ( $insertedPrIds as $prid ) { $logRelationsValues[] = $prid->pr_id; } - $log->addRelations( 'pr_id', $logRelationsValues, $logId ); + + // Update the protection log + $logEntry = new ManualLogEntry( 'protect', 'move_prot' ); + $logEntry->setTarget( $this->newTitle ); + $logEntry->setComment( $comment ); + $logEntry->setPerformer( $user ); + $logEntry->setParameters( array( + '4::oldtitle' => $this->oldTitle->getPrefixedText(), + ) ); + $logEntry->setRelations( array( 'pr_id' => $logRelationsValues ) ); + $logId = $logEntry->insert(); + $logEntry->publish( $logId ); } // Update *_from_namespace fields as needed @@ -416,6 +419,13 @@ class MovePage { $redirectContent = null; } + // Figure out whether the content model is no longer the default + $oldDefault = ContentHandler::getDefaultModelFor( $this->oldTitle ); + $contentModel = $this->oldTitle->getContentModel(); + $newDefault = ContentHandler::getDefaultModelFor( $nt ); + $defaultContentModelChanging = ( $oldDefault !== $newDefault + && $oldDefault === $contentModel ); + // bug 57084: log_page should be the ID of the *moved* page $oldid = $this->oldTitle->getArticleID(); $logTitle = clone $this->oldTitle; @@ -493,6 +503,16 @@ class MovePage { $newpage->doEditUpdates( $nullRevision, $user, array( 'changed' => false, 'moved' => true, 'oldcountable' => $oldcountable ) ); + // If the default content model changes, we need to populate rev_content_model + if ( $defaultContentModelChanging ) { + $dbw->update( + 'revision', + array( 'rev_content_model' => $contentModel ), + array( 'rev_page' => $nt->getArticleID(), 'rev_content_model IS NULL' ), + __METHOD__ + ); + } + if ( !$moveOverRedirect ) { WikiPage::onArticleCreate( $nt ); }