X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FMovePage.php;h=fb0ca8c89a093f96d47263348e3f62c11a000abc;hb=5fe5201f5e3e3dcc1d932c66d732009599c0a030;hp=2cd9698c0f5a654a237ce4289fa5205c8ef0fc72;hpb=3fa15fea69c729ca1fd01fec7bb9663140a1ef70;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MovePage.php b/includes/MovePage.php index 2cd9698c0f..fb0ca8c89a 100644 --- a/includes/MovePage.php +++ b/includes/MovePage.php @@ -247,12 +247,12 @@ class MovePage { RepoGroup::singleton()->clearCache( $this->newTitle ); # clear false negative cache } - $dbw->begin( __METHOD__ ); # If $file was a LocalFile, its transaction would have closed our own. + $dbw->startAtomic( __METHOD__ ); $pageid = $this->oldTitle->getArticleID( Title::GAID_FOR_UPDATE ); $protected = $this->oldTitle->isProtected(); // Do the actual move - $this->moveToInternal( $user, $this->newTitle, $reason, $createRedirect ); + $nullRevision = $this->moveToInternal( $user, $this->newTitle, $reason, $createRedirect ); // Refresh the sortkey for this row. Be careful to avoid resetting // cl_timestamp, which may disturb time-based lists on some sites. @@ -369,12 +369,29 @@ class MovePage { WatchedItem::duplicateEntries( $this->oldTitle, $this->newTitle ); } - $dbw->commit( __METHOD__ ); - Hooks::run( - 'TitleMoveComplete', - array( &$this->oldTitle, &$this->newTitle, &$user, $pageid, $redirid, $reason ) + 'TitleMoveCompleting', + array( $this->oldTitle, $this->newTitle, + $user, $pageid, $redirid, $reason, $nullRevision ) + ); + + $dbw->endAtomic( __METHOD__ ); + + $params = array( + &$this->oldTitle, + &$this->newTitle, + &$user, + $pageid, + $redirid, + $reason, + $nullRevision ); + $dbw->onTransactionIdle( function () use ( $params, $dbw ) { + // Keep each single hook handler atomic + $dbw->setFlag( DBO_TRX ); // flag is automatically reset by DB layer + Hooks::run( 'TitleMoveComplete', $params ); + } ); + return Status::newGood(); } @@ -388,6 +405,7 @@ class MovePage { * @param string $reason The reason for the move * @param bool $createRedirect Whether to leave a redirect at the old title. Does not check * if the user has the suppressredirect right + * @return Revision the revision created by the move * @throws MWException */ private function moveToInternal( User $user, &$nt, $reason = '', $createRedirect = true ) { @@ -544,5 +562,7 @@ class MovePage { # Log the move $logid = $logEntry->insert(); $logEntry->publish( $logid ); + + return $nullRevision; } }