MediaWiki r43080 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r43079‎ | r43080 (on ViewVC)‎ | r43081 >
Date:16:45, 2 November 2008
Author:tstarling
Status:old
Tags:
Comment:
* Set a special temporary directory for ImageMagick with $wgImageMagickTempDir
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/media/Bitmap.php
===================================================================
--- trunk/phase3/includes/media/Bitmap.php	(revision 43079)
+++ trunk/phase3/includes/media/Bitmap.php	(revision 43080)
@@ -41,7 +41,7 @@
 	}
 
 	function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
-		global $wgUseImageMagick, $wgImageMagickConvertCommand;
+		global $wgUseImageMagick, $wgImageMagickConvertCommand, $wgImageMagickTempDir;
 		global $wgCustomConvertCommand;
 		global $wgSharpenParameter, $wgSharpenReductionThreshold;
 		global $wgMaxAnimatedGifArea;
@@ -122,6 +122,12 @@
 				}
 			}
 
+			if ( strval( $wgImageMagickTempDir ) !== '' ) {
+				$tempEnv = 'MAGICK_TMPDIR=' . wfEscapeShellArg( $wgImageMagickTempDir ) . ' ';
+			} else {
+				$tempEnv = '';
+			}
+
 			# Specify white background color, will be used for transparent images
 			# in Internet Explorer/Windows instead of default black.
 
@@ -129,7 +135,9 @@
 			# It seems that ImageMagick has a bug wherein it produces thumbnails of
 			# the wrong size in the second case.
 
-			$cmd  =  wfEscapeShellArg($wgImageMagickConvertCommand) .
+			$cmd  = 
+				$tempEnv .
+				wfEscapeShellArg($wgImageMagickConvertCommand) .
 				" {$quality} -background white -size {$physicalWidth} ".
 				wfEscapeShellArg($srcPath . $frame) .
 				$animation .
Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 43079)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 43080)
@@ -1969,6 +1969,12 @@
 /** Reduction in linear dimensions below which sharpening will be enabled */
 $wgSharpenReductionThreshold = 0.85;
 
+/** 
+ * Temporary directory used for ImageMagick. The directory must exist. Leave 
+ * this set to false to let ImageMagick decide for itself.
+ */
+$wgImageMagickTempDir = false;
+
 /**
  * Use another resizing converter, e.g. GraphicMagick
  * %s will be replaced with the source path, %d with the destination
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 43079)
+++ trunk/phase3/RELEASE-NOTES	(revision 43080)
@@ -187,6 +187,8 @@
   directly blocked
 * (bug 13710) Allow to force "watch this" checkbox via URL using para "watchthis"
 * (bug 15125) Add Public Domain to default options when installing. Patch by Nathan Larson.
+* Set a special temporary directory for ImageMagick with $wgImageMagickTempDir
+
 === Bug fixes in 1.14 ===
 
 * (bug 14907) DatabasePostgres::fieldType now defined.

Status & tagging log

  • 15:36, 12 September 2011 Meno25 (Talk | contribs) changed the status of r43080 [removed: ok added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox