r11945 - Code Review

From MediaWiki.org

Jump to: navigation, search
Repository:MediaWiki
Revision:r11944 | r11945 (on ViewVC) | r11946 >
Date:09:04, 4 December 2005
Author:vibber
Status:new
Tags:
Comment:* (bug 4162) Add $wgThumbnailEpoch timestamp to force old thumbs to
be rerendered on demand, sitewide
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/Image.php
===================================================================
--- trunk/phase3/includes/Image.php	(revision 11944)
+++ trunk/phase3/includes/Image.php	(revision 11945)
@@ -912,7 +912,7 @@
 	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 @@
 		$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;
Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 11944)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 11945)
@@ -1179,7 +1179,16 @@
  * 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 ) ) {
 	$wgCommandLineMode = false;
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 11944)
+++ trunk/phase3/RELEASE-NOTES	(revision 11945)
@@ -289,6 +289,8 @@
 * 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 ===
Views
Toolbox