X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FMovePage.php;h=b91895508a66d5fc45b7637eabd358cb94c4508d;hb=e53c515578be49fd950c7ced2728b12447c0e8ef;hp=2cd9698c0f5a654a237ce4289fa5205c8ef0fc72;hpb=8a1152b91365fe51f2505c8dc30dc20319dcafd4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MovePage.php b/includes/MovePage.php index 2cd9698c0f..b91895508a 100644 --- a/includes/MovePage.php +++ b/includes/MovePage.php @@ -247,7 +247,7 @@ 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(); @@ -369,12 +369,20 @@ 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 ) ); + + $dbw->endAtomic( __METHOD__ ); + + $params = array( &$this->oldTitle, &$this->newTitle, &$user, $pageid, $redirid, $reason ); + $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(); }