From: Aaron Schulz Date: Wed, 8 Apr 2015 17:33:58 +0000 (-0700) Subject: Made WikiPage::doPurge() avoid calling commit() X-Git-Tag: 1.31.0-rc.0~11780^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/?a=commitdiff_plain;h=8065f529967783a3fb0b22c99e5b9016c0b619bc;p=lhc%2Fweb%2Fwiklou.git Made WikiPage::doPurge() avoid calling commit() * Calling commit() can cause imbalanced begin/commit problems Change-Id: I55fec065de20653b216c8dfac7c361124c8fe10a --- diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 5caffaba14..6242a548a8 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -1150,28 +1150,24 @@ class WikiPage implements Page, IDBAccessObject { * @return bool */ public function doPurge() { - global $wgUseSquid; - if ( !Hooks::run( 'ArticlePurge', array( &$this ) ) ) { return false; } - // Invalidate the cache - $this->mTitle->invalidateCache(); - - if ( $wgUseSquid ) { - // Commit the transaction before the purge is sent - $dbw = wfGetDB( DB_MASTER ); - $dbw->commit( __METHOD__ ); - - // Send purge - $update = SquidUpdate::newSimplePurge( $this->mTitle ); - $update->doUpdate(); - } + $title = $this->mTitle; + wfGetDB( DB_MASTER )->onTransactionIdle( function() use ( $title ) { + global $wgUseSquid; + // Invalidate the cache in auto-commit mode + $title->invalidateCache(); + if ( $wgUseSquid ) { + // Send purge now that page_touched update was committed above + $update = SquidUpdate::newSimplePurge( $title ); + $update->doUpdate(); + } + } ); if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { // @todo move this logic to MessageCache - if ( $this->exists() ) { // NOTE: use transclusion text for messages. // This is consistent with MessageCache::getMsgFromNamespace() @@ -1188,6 +1184,7 @@ class WikiPage implements Page, IDBAccessObject { MessageCache::singleton()->replace( $this->mTitle->getDBkey(), $text ); } + return true; }