From: Tim Starling Date: Sat, 17 Jun 2006 04:32:41 +0000 (+0000) Subject: Commit the transaction after an upload is recorded and logged, to avoid losing images... X-Git-Tag: 1.31.0-rc.0~56759 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=b2c6e8261b558ff60fc098b4bf2fc3ee51a76788;p=lhc%2Fweb%2Fwiklou.git Commit the transaction after an upload is recorded and logged, to avoid losing images due to a rollback later on. --- 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; }