From: Tim Starling Date: Sat, 7 Aug 2004 05:42:37 +0000 (+0000) Subject: moved squid purge down, untested X-Git-Tag: 1.5.0alpha1~2485 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=a89e4ec114a6df09aa0a9ffeb8cac55be61817d8;p=lhc%2Fweb%2Fwiklou.git moved squid purge down, untested --- diff --git a/includes/Image.php b/includes/Image.php index b35f0db9e3..e5b306e01d 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -129,6 +129,7 @@ class Image // image's width. Let the browser do the scaling in this case. // The thumbnail is stored on disk and is only computed if the thumbnail // file does not exist OR if it is older than the image. + // Returns the URL. function createThumb( $width ) { global $wgUploadDirectory; global $wgImageMagickConvertCommand; @@ -158,16 +159,7 @@ class Image return $this->getURL(); } - if ( (! file_exists( $thumbPath ) ) - || ( filemtime($thumbPath) < filemtime($this->imagePath) ) ) { - # Squid purging - if ( $wgUseSquid ) { - $urlArr = Array( - $wgInternalServer.$thumbUrl - ); - wfPurgeSquidServers($urlArr); - } - + if ( (! file_exists( $thumbPath ) ) || ( filemtime($thumbPath) < filemtime($this->imagePath) ) ) { if ( $wgUseImageMagick ) { # use ImageMagick $cmd = $wgImageMagickConvertCommand . @@ -247,6 +239,15 @@ class Image unlink( $thumbPath ); } + # Purge squid + # This has to be done after the image is updated and present for all machines on NFS, + # or else the old version might be stored into the squid again + if ( $wgUseSquid ) { + $urlArr = Array( + $wgInternalServer.$thumbUrl + ); + wfPurgeSquidServers($urlArr); + } } return $thumbUrl; } // END OF function createThumb