From: Aaron Date: Tue, 22 May 2012 18:36:43 +0000 (-0700) Subject: [FileRepo] Avoiding useless purging for new uploads (not re-uploads). X-Git-Tag: 1.31.0-rc.0~23543 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=826f82eaccdf2a017a8ddb27829156f7c474db84;p=lhc%2Fweb%2Fwiklou.git [FileRepo] Avoiding useless purging for new uploads (not re-uploads). Change-Id: If554c14c786cd5f743c4d8302660a8b1e5295393 --- diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index cd8e0c69a2..3e95b057ac 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -1055,14 +1055,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 +1189,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() ) );