From: Aaron Schulz Date: Tue, 6 Oct 2015 20:24:22 +0000 (-0700) Subject: Convert MovePage to startAtomic()/endAtomic() X-Git-Tag: 1.31.0-rc.0~9233^2 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=9e51328790c0a2273bee539ba147b85d5cc4a0bb;p=lhc%2Fweb%2Fwiklou.git Convert MovePage to startAtomic()/endAtomic() * This makes moves of a page and its subpages atomic as one operation. Note that $wgMaximumMovedPages already bounds the number of page rows changed. * The TitleMoveComplete hook will fire for all titles after the operation rather than after each title move. * Remove LocalFile comment about it commiting the transaction because LocalFile::lock()/unlock() check trxLevel() and reference count. Change-Id: Ic7f6964f94f0b0f0bedc27012e5b5b012a4afdb2 --- diff --git a/includes/MovePage.php b/includes/MovePage.php index 2cd9698c0f..0f9374a7e3 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,13 @@ class MovePage { WatchedItem::duplicateEntries( $this->oldTitle, $this->newTitle ); } - $dbw->commit( __METHOD__ ); + $dbw->endAtomic( __METHOD__ ); + + $params = array( $this->oldTitle, $this->newTitle, $user, $pageid, $redirid, $reason ); + $dbw->onTransactionIdle( function () use ( $params ) { + Hooks::run( 'TitleMoveComplete', $params ); + } ); - Hooks::run( - 'TitleMoveComplete', - array( &$this->oldTitle, &$this->newTitle, &$user, $pageid, $redirid, $reason ) - ); return Status::newGood(); }