* Wrap revision insert & page update in a transaction, rollback on late
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 24 Jul 2005 10:32:37 +0000 (10:32 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 24 Jul 2005 10:32:37 +0000 (10:32 +0000)
  edit conflict.

RELEASE-NOTES
includes/Article.php

index 0a9f083..103911d 100644 (file)
@@ -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 ===
index 41b6b60..9f0e3b0 100644 (file)
@@ -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();
                        }
                }