From: Brion Vibber Date: Sun, 24 Jul 2005 10:32:37 +0000 (+0000) Subject: * Wrap revision insert & page update in a transaction, rollback on late X-Git-Tag: 1.5.0beta4~40 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=5be8fa5e3dc630ce127e97e72915af5978e9ec13;p=lhc%2Fweb%2Fwiklou.git * Wrap revision insert & page update in a transaction, rollback on late edit conflict. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0a9f083275..103911d264 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -603,6 +603,8 @@ of MediaWiki:Newpagetext) to &action=edit, if page is new. * Skins can now be previewed in preferences * (bug 2943) AuthPlugin::getCanonicalName() name canonicalization hook, patch from robla +* Wrap revision insert & page update in a transaction, rollback on late + edit conflict. === Caveats === diff --git a/includes/Article.php b/includes/Article.php index 41b6b60479..9f0e3b08c3 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1238,6 +1238,8 @@ class Article { 'minor_edit' => $isminor, 'text' => $text ) ); + + $dbw->begin(); $revisionId = $revision->insertOn( $dbw ); # Update page @@ -1246,6 +1248,7 @@ class Article { if( !$ok ) { /* Belated edit conflict! Run away!! */ $good = false; + $dbw->rollback(); } else { # Update recentchanges and purge cache and whatnot $bot = (int)($wgUser->isBot() || $forceBot); @@ -1253,6 +1256,7 @@ class Article { $lastRevision, $this->getTimestamp(), $bot, '', $oldsize, $newsize, $revisionId ); Article::onArticleEdit( $this->mTitle ); + $dbw->commit(); } }