Index: trunk/phase3/includes/specials/SpecialVersion.php |
— | — | @@ -44,6 +44,24 @@ |
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
| 48 | + * check executive path existence |
| 49 | + * @param string command |
| 50 | + * @return mixed existsIn |
| 51 | + */ |
| 52 | + static function checkExecPath( $cmd ) { |
| 53 | + $existsIn = false; |
| 54 | + $pathDirArray = explode( ';' , $_SERVER['PATH'] ); |
| 55 | + foreach ( $pathDirArray as $pathDir ) { |
| 56 | + $pathDir = str_replace('\\', '/', $pathDir); |
| 57 | + $pathDir .= '/'; |
| 58 | + if ( ( file_exists ( $pathDir . '/' . $cmd ) ) || ( file_exists( trim( $pathDir . '/' . $cmd, '"' ) . '.exe' ) ) ) { |
| 59 | + $existsIn = $pathDir; |
| 60 | + } |
| 61 | + } |
| 62 | + return $existsIn; |
| 63 | + } |
| 64 | + |
| 65 | + /** |
48 | 66 | * execuate command for output |
49 | 67 | * @param string command |
50 | 68 | * @return string output |
— | — | @@ -196,6 +214,7 @@ |
197 | 215 | // Look for SVG converter and print the version info |
198 | 216 | if ( in_array( 'svg', $wgFileExtensions ) ) { |
199 | 217 | $swSVGConvName = $wgSVGConverter; |
| 218 | + $swSVGConvInfo = ''; |
200 | 219 | $haveSVGConvVer = false; |
201 | 220 | $pathVar = '$path/'; |
202 | 221 | $binPath = '/usr/bin/'; |
— | — | @@ -203,6 +222,7 @@ |
204 | 223 | $execPath = substr_replace($execPath, '', 0, strlen($pathVar)); |
205 | 224 | $execFullPath = trim($wgSVGConverterPath,'"') . $execPath; |
206 | 225 | $execBinPath = $binPath . $execPath; |
| 226 | + $execPathVal = checkExecPath( $execPath ); |
207 | 227 | if (strstr($execFullPath, ' ') != false) { |
208 | 228 | $execFullPath = '"' . $execFullPath . '"'; |
209 | 229 | } |
— | — | @@ -212,6 +232,8 @@ |
213 | 233 | $swSVGConvInfo = self::execOutput( $execBinPath . ' -version' ); |
214 | 234 | else if ( file_exists( trim( $execFullPath, '"' ) ) || ( file_exists( trim( $execFullPath, '"' ) . '.exe' ) ) ) |
215 | 235 | $swSVGConvInfo = self::execOutput( $execFullPath . ' -version' ); |
| 236 | + else if ( $execPathVal != false ) |
| 237 | + $swSVGConvInfo = self::execOutput( $execPathVal . $execPath . ' -version' ); |
216 | 238 | list( $head, $tail ) = explode( 'ImageMagick', $swSVGConvInfo ); |
217 | 239 | list( $swSVGConvVer ) = explode('http://www.imagemagick.org', $tail ); |
218 | 240 | $swSVGConvURL = 'http://www.imagemagick.org/'; |
— | — | @@ -222,6 +244,8 @@ |
223 | 245 | $swSVGConvInfo = self::execOutput( $execBinPath . ' -v' ); |
224 | 246 | else if ( file_exists( trim( $execFullPath, '"' ) ) || ( file_exists( trim( $execFullPath, '"' ) . '.exe' ) ) ) |
225 | 247 | $swSVGConvInfo = self::execOutput( $execFullPath . ' -v' ); |
| 248 | + else if ( $execPathVal != false ) |
| 249 | + $swSVGConvInfo = self::execOutput( $execPathVal . $execPath . ' -v' ); |
226 | 250 | $swSVGConvLine = explode("\n",$swSVGConvInfo ,2); |
227 | 251 | $swSVGConvVer = $swSVGConvLine[0]; |
228 | 252 | $swSVGConvURL = 'http://librsvg.sourceforge.net/'; |
— | — | @@ -232,6 +256,8 @@ |
233 | 257 | $swSVGConvInfo = self::execOutput( $execBinPath . ' -z -V' ); |
234 | 258 | else if ( file_exists( trim( $execFullPath, '"' ) ) || ( file_exists( trim( $execFullPath, '"' ) . '.exe' ) ) ) |
235 | 259 | $swSVGConvInfo = self::execOutput( $execFullPath . ' -z -V' ); |
| 260 | + else if ( $execPathVal != false ) |
| 261 | + $swSVGConvInfo = self::execOutput( $execPathVal . $execPath . ' -z -V' ); |
236 | 262 | $swSVGConvLine = explode("\n",$swSVGConvInfo ,2); |
237 | 263 | $swSVGConvVer = ltrim( $swSVGConvLine[0], 'Inkscape ' ); |
238 | 264 | $swSVGConvURL = 'http://www.inkscape.org/'; |