* (bug 4162) Add $wgThumbnailEpoch timestamp to force old thumbs to
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 4 Dec 2005 09:04:40 +0000 (09:04 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 4 Dec 2005 09:04:40 +0000 (09:04 +0000)
  be rerendered on demand, sitewide

RELEASE-NOTES
includes/DefaultSettings.php
includes/Image.php

index 32d2109..fb6e492 100644 (file)
@@ -289,6 +289,8 @@ fully support the editing toolbar, but was found to be too confusing.
 * Optional summary parameter to action=rollback, for user javascript
 * (bug 153) Adjust thumbnail size calculations to match consistently;
   patch by David Benbennick
+* (bug 4162) Add $wgThumbnailEpoch timestamp to force old thumbs to
+  be rerendered on demand, sitewide
 
 
 === Caveats ===
index 70b1bc0..f4e6027 100644 (file)
@@ -1179,6 +1179,15 @@ $wgSVGMaxSize = 1024;
  * 12.5 million pixels or 3500x3500
  */
 $wgMaxImageArea = 1.25e7;
+/**
+ * If rendered thumbnail files are older than this timestamp, they
+ * will be rerendered on demand as if the file didn't already exist.
+ * Update if there is some need to force thumbs and SVG rasterizations
+ * to rerender, such as fixes to rendering bugs.
+ */
+$wgThumbnailEpoch = '20030516000000';
+
+
 
 /** Set $wgCommandLineMode if it's not set already, to avoid notices */
 if( !isset( $wgCommandLineMode ) ) {
index 96ff937..372f86e 100644 (file)
@@ -912,7 +912,7 @@ class Image
        function renderThumb( $width, $useScript = true ) {
                global $wgUseSquid, $wgInternalServer;
                global $wgThumbnailScriptPath, $wgSharedThumbnailScriptPath;
-               global $wgSVGMaxSize, $wgMaxImageArea;
+               global $wgSVGMaxSize, $wgMaxImageArea, $wgThumbnailEpoch;
 
                $fname = 'Image::renderThumb';
                wfProfileIn( $fname );
@@ -968,7 +968,8 @@ class Image
                $thumbName = $this->thumbName( $width, $this->fromSharedDirectory );
                $thumbPath = wfImageThumbDir( $this->name, $this->fromSharedDirectory ).'/'.$thumbName;
 
-               if ( !file_exists( $thumbPath ) ) {
+               if ( !file_exists( $thumbPath ) ||
+                       filemtime( $thumbPath ) < wfTimestamp( TS_UNIX, $wgThumbnailEpoch ) ) {
                        $oldThumbPath = wfDeprecatedThumbDir( $thumbName, 'thumb', $this->fromSharedDirectory ).
                                '/'.$thumbName;
                        $done = false;