r74950 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74949‎ | r74950 | r74951 >
Date:16:21, 18 October 2010
Author:maxsem
Status:resolved (Comments)
Tags:
Comment:
Fixed ImageMagick detection on Windows
Modified paths:
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/Installer.php
@@ -609,8 +609,8 @@
610610 * Environment check for ImageMagick and GD.
611611 */
612612 public function envCheckGraphics() {
613 - $names = array( 'convert', 'convert.exe' );
614 - $convert = $this->locateExecutableInDefaultPaths( $names );
 613+ $names = array( wfIsWindows() ? 'convert.exe' : 'convert' );
 614+ $convert = $this->locateExecutableInDefaultPaths( $names, array( '$1 -version', 'ImageMagick' ) );
615615
616616 if ( $convert ) {
617617 $this->setVar( 'wgImageMagickConvertCommand', $convert );
@@ -888,7 +888,7 @@
889889 }
890890
891891 foreach ( $names as $name ) {
892 - $command = "$path/$name";
 892+ $command = $path . DIRECTORY_SEPARATOR . $name;
893893
894894 wfSuppressWarnings();
895895 $file_exists = file_exists( $command );
@@ -899,6 +899,9 @@
900900 return $command;
901901 }
902902
 903+ if ( wfIsWindows() ) {
 904+ $command = "\"$command\"";
 905+ }
903906 $file = str_replace( '$1', $command, $versionInfo[0] );
904907 if ( strstr( wfShellExec( $file ), $versionInfo[1]) !== false ) {
905908 return $command;

Follow-up revisions

RevisionCommit summaryAuthorDate
r76588Fix for r74950: use wfEscapeShellArg()maxsem18:47, 12 November 2010

Comments

#Comment by Platonides (talk | contribs)   22:52, 11 November 2010

That if should be an unconditional wfEscapeShellArg()

#Comment by MaxSem (talk | contribs)   18:48, 12 November 2010

Thanks, fixed.

Status & tagging log