From b2c6e8261b558ff60fc098b4bf2fc3ee51a76788 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 17 Jun 2006 04:32:41 +0000 Subject: [PATCH] Commit the transaction after an upload is recorded and logged, to avoid losing images due to a rollback later on. --- includes/Image.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/includes/Image.php b/includes/Image.php index 0b1d8d6a23..dd40c0f2d2 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -1594,6 +1594,14 @@ class Image $article->insertNewArticle( $textdesc, $desc, $minor, $watch, $suppressRC ); } + # Add the log entry + $log = new LogPage( 'upload' ); + $log->addEntry( 'upload', $descTitle, $desc ); + + # Commit the transaction now, in case something goes wrong later + # The most important thing is that images don't get lost, especially archives + $dbw->immediateCommit(); + # Invalidate cache for all pages using this image $linksTo = $this->getLinksTo(); @@ -1603,9 +1611,6 @@ class Image } Title::touchArray( $linksTo ); - $log = new LogPage( 'upload' ); - $log->addEntry( 'upload', $descTitle, $desc ); - return true; } -- 2.20.1