X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FMovePage.php;h=2ad315811c9e10a01edf960d1bdaa26b807c7b29;hb=06e235b99fe2d9b69383198a25ce2c55a4eb73c4;hp=fc9f6a6676614227ffe2c87c5f6521bf63641f24;hpb=18a2fd3268d1864d1480d5bfef0a69abf55a0dd4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MovePage.php b/includes/MovePage.php index fc9f6a6676..2ad315811c 100644 --- a/includes/MovePage.php +++ b/includes/MovePage.php @@ -57,7 +57,7 @@ class MovePage { // Convert into a Status object if ( $errors ) { foreach ( $errors as $error ) { - call_user_func_array( [ $status, 'fatal' ], $error ); + $status->fatal( ...$error ); } } @@ -280,13 +280,7 @@ class MovePage { [ 'cl_from' => $pageid ], __METHOD__ ); - if ( $this->newTitle->getNamespace() == NS_CATEGORY ) { - $type = 'subcat'; - } elseif ( $this->newTitle->getNamespace() == NS_FILE ) { - $type = 'file'; - } else { - $type = 'page'; - } + $type = MWNamespace::getCategoryLinkType( $this->newTitle->getNamespace() ); foreach ( $prefixes as $prefixRow ) { $prefix = $prefixRow->cl_sortkey_prefix; $catTo = $prefixRow->cl_to; @@ -415,7 +409,9 @@ class MovePage { new AtomicSectionUpdate( $dbw, __METHOD__, - function () use ( $params ) { + // Hold onto $user to avoid HHVM bug where it no longer + // becomes a reference (T118683) + function () use ( $params, &$user ) { Hooks::run( 'TitleMoveComplete', $params ); } ) @@ -527,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 */ [ @@ -546,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 );