From: Brad Jorsch Date: Thu, 6 Sep 2018 18:02:53 +0000 (-0400) Subject: Provide a RevisionRecord with the correct title after a move X-Git-Tag: 1.34.0-rc.0~4174^2 X-Git-Url: http://git.cyclocoop.org/%22.%20generer_url_ecrire%28%22sites_tous%22%2C%22%22%29.%20%22?a=commitdiff_plain;h=56fddb98a1280993a2c7ce90ff7be21e064e56fc;p=lhc%2Fweb%2Fwiklou.git Provide a RevisionRecord with the correct title after a move Currently we're creating the null revision for the move before actually updating the page's title, so when it gets passed through RevisionRenderer the output uses the old page's title in the

. To make that null revision have the correct title, let's try simply updating the page table before creating it instead. The ordering shouldn't matter since this all happens in an atomic section. Bug: T203661 Change-Id: I9ebdcbc566b11dea3a9bdd402ea4418c4e51b096 --- diff --git a/includes/MovePage.php b/includes/MovePage.php index ec44b6eb69..2ad315811c 100644 --- a/includes/MovePage.php +++ b/includes/MovePage.php @@ -523,15 +523,6 @@ class MovePage { $newpage = WikiPage::factory( $nt ); - # Save a null revision in the page's history notifying of the move - $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true, $user ); - if ( !is_object( $nullRevision ) ) { - throw new MWException( 'No valid null revision produced in ' . __METHOD__ ); - } - - $nullRevId = $nullRevision->insertOn( $dbw ); - $logEntry->setAssociatedRevId( $nullRevId ); - # Change the name of the target page: $dbw->update( 'page', /* SET */ [ @@ -542,6 +533,15 @@ class MovePage { __METHOD__ ); + # Save a null revision in the page's history notifying of the move + $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true, $user ); + if ( !is_object( $nullRevision ) ) { + throw new MWException( 'No valid null revision produced in ' . __METHOD__ ); + } + + $nullRevId = $nullRevision->insertOn( $dbw ); + $logEntry->setAssociatedRevId( $nullRevId ); + if ( !$redirectContent ) { // Clean up the old title *before* reset article id - T47348 WikiPage::onArticleDelete( $this->oldTitle );