From 5be8fa5e3dc630ce127e97e72915af5978e9ec13 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 24 Jul 2005 10:32:37 +0000 Subject: [PATCH] * Wrap revision insert & page update in a transaction, rollback on late edit conflict. --- RELEASE-NOTES | 2 ++ includes/Article.php | 4 ++++ 2 files changed, 6 insertions(+) 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(); } } -- 2.20.1