Commit the transaction after an upload is recorded and logged, to avoid losing images...
authorTim Starling <tstarling@users.mediawiki.org>
Sat, 17 Jun 2006 04:32:41 +0000 (04:32 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sat, 17 Jun 2006 04:32:41 +0000 (04:32 +0000)
includes/Image.php

index 0b1d8d6..dd40c0f 100644 (file)
@@ -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;
        }