Merge "(bug 36819) Make language names lowercase first letter where usual"
[lhc/web/wiklou.git] / includes / filerepo / file / LocalFile.php
index cd8e0c6..cc66649 100644 (file)
@@ -440,6 +440,7 @@ class LocalFile extends File {
 
                $dbw->update( 'image',
                        array(
+                               'img_size'       => $this->size, // sanity
                                'img_width'      => $this->width,
                                'img_height'     => $this->height,
                                'img_bits'       => $this->bits,
@@ -1055,14 +1056,6 @@ class LocalFile extends File {
                $props['timestamp'] = wfTimestamp( TS_MW, $timestamp ); // DB -> TS_MW
                $this->setProps( $props );
 
-               # Delete thumbnails
-               wfProfileIn( __METHOD__ . '-purge' );
-               $this->purgeThumbnails();
-               wfProfileOut( __METHOD__ . '-purge' );
-
-               # The file is already on its final location, remove it from the squid cache
-               SquidUpdate::purge( array( $this->getURL() ) );
-
                # Fail now if the file isn't there
                if ( !$this->fileExists ) {
                        wfDebug( __METHOD__ . ": File " . $this->getRel() . " went missing!\n" );
@@ -1197,6 +1190,16 @@ class LocalFile extends File {
                # which in fact doesn't really exist (bug 24978)
                $this->saveToCache();
 
+               if ( $reupload ) {
+                       # Delete old thumbnails
+                       wfProfileIn( __METHOD__ . '-purge' );
+                       $this->purgeThumbnails();
+                       wfProfileOut( __METHOD__ . '-purge' );
+
+                       # Remove the old file from the squid cache
+                       SquidUpdate::purge( array( $this->getURL() ) );
+               }
+
                # Hooks, hooks, the magic of hooks...
                wfProfileIn( __METHOD__ . '-hooks' );
                wfRunHooks( 'FileUpload', array( $this, $reupload, $descTitle->exists() ) );
@@ -1803,7 +1806,6 @@ class LocalFileDeleteBatch {
         * @return FileRepoStatus
         */
        function execute() {
-               global $wgUseSquid;
                wfProfileIn( __METHOD__ );
 
                $this->file->lock();