From 9d5a848bacbed2e2fe3aded58b53663cc39ae381 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 4 Dec 2005 09:04:40 +0000 Subject: [PATCH] * (bug 4162) Add $wgThumbnailEpoch timestamp to force old thumbs to be rerendered on demand, sitewide --- RELEASE-NOTES | 2 ++ includes/DefaultSettings.php | 9 +++++++++ includes/Image.php | 5 +++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 32d210917d..fb6e492e7c 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 70b1bc05cc..f4e602770c 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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 ) ) { diff --git a/includes/Image.php b/includes/Image.php index 96ff9379c6..372f86e122 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -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; -- 2.20.1