Index: trunk/phase3/includes/installer/Installer.php |
— | — | @@ -383,21 +383,6 @@ |
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
387 | | - * Get an array of likely places we can find executables. Check a bunch |
388 | | - * of known Unix-like defaults, as well as the PATH environment variable |
389 | | - * (which should maybe make it work for Windows?) |
390 | | - * |
391 | | - * @return Array |
392 | | - */ |
393 | | - protected function getPossibleBinPaths() { |
394 | | - return array_merge( |
395 | | - array( '/usr/bin', '/usr/local/bin', '/opt/csw/bin', |
396 | | - '/usr/gnu/bin', '/usr/sfw/bin', '/sw/bin', '/opt/local/bin' ), |
397 | | - explode( PATH_SEPARATOR, getenv( 'PATH' ) ) |
398 | | - ); |
399 | | - } |
400 | | - |
401 | | - /** |
402 | 387 | * Check if we're installing the latest version. |
403 | 388 | */ |
404 | 389 | public function envLatestVersion() { |
— | — | @@ -608,20 +593,11 @@ |
609 | 594 | $names = array( "gdiff3", "diff3", "diff3.exe" ); |
610 | 595 | $versionInfo = array( '$1 --version 2>&1', 'diff3 (GNU diffutils)' ); |
611 | 596 | |
612 | | - $haveDiff3 = false; |
| 597 | + $diff3 = $this->locateExecutableInDefaultPaths( $names, $versionInfo ); |
613 | 598 | |
614 | | - foreach ( $this->getPossibleBinPaths() as $path ) { |
615 | | - $exe = $this->locateExecutable( $path, $names, $versionInfo ); |
616 | | - |
617 | | - if ($exe !== false) { |
618 | | - $this->setVar( 'wgDiff3', $exe ); |
619 | | - $haveDiff3 = true; |
620 | | - break; |
621 | | - } |
622 | | - } |
623 | | - |
624 | | - if ( $haveDiff3 ) { |
625 | | - $this->showMessage( 'config-diff3-good', $exe ); |
| 599 | + if ( $diff3 ) { |
| 600 | + $this->showMessage( 'config-diff3-good', $diff3 ); |
| 601 | + $this->setVar( 'wgDiff3', $diff3 ); |
626 | 602 | } else { |
627 | 603 | $this->setVar( 'wgDiff3', false ); |
628 | 604 | $this->showMessage( 'config-diff3-bad' ); |
— | — | @@ -633,20 +609,11 @@ |
634 | 610 | */ |
635 | 611 | public function envCheckGraphics() { |
636 | 612 | $names = array( 'convert', 'convert.exe' ); |
637 | | - $haveConvert = false; |
| 613 | + $convert = $this->locateExecutableInDefaultPaths( $names ); |
638 | 614 | |
639 | | - foreach ( $this->getPossibleBinPaths() as $path ) { |
640 | | - $exe = $this->locateExecutable( $path, $names ); |
641 | | - |
642 | | - if ($exe !== false) { |
643 | | - $this->setVar( 'wgImageMagickConvertCommand', $exe ); |
644 | | - $haveConvert = true; |
645 | | - break; |
646 | | - } |
647 | | - } |
648 | | - |
649 | | - if ( $haveConvert ) { |
650 | | - $this->showMessage( 'config-imagemagick', $exe ); |
| 615 | + if ( $convert ) { |
| 616 | + $this->setVar( 'wgImageMagickConvertCommand', $convert ); |
| 617 | + $this->showMessage( 'config-imagemagick', $convert ); |
651 | 618 | return true; |
652 | 619 | } elseif ( function_exists( 'imagejpeg' ) ) { |
653 | 620 | $this->showMessage( 'config-gd' ); |
— | — | @@ -889,6 +856,20 @@ |
890 | 857 | } |
891 | 858 | } |
892 | 859 | |
| 860 | + /** |
| 861 | + * Get an array of likely places we can find executables. Check a bunch |
| 862 | + * of known Unix-like defaults, as well as the PATH environment variable |
| 863 | + * (which should maybe make it work for Windows?) |
| 864 | + * |
| 865 | + * @return Array |
| 866 | + */ |
| 867 | + protected function getPossibleBinPaths() { |
| 868 | + return array_merge( |
| 869 | + array( '/usr/bin', '/usr/local/bin', '/opt/csw/bin', |
| 870 | + '/usr/gnu/bin', '/usr/sfw/bin', '/sw/bin', '/opt/local/bin' ), |
| 871 | + explode( PATH_SEPARATOR, getenv( 'PATH' ) ) |
| 872 | + ); |
| 873 | + } |
893 | 874 | |
894 | 875 | /** |
895 | 876 | * Search a path for any of the given executable names. Returns the |
— | — | @@ -932,7 +913,20 @@ |
933 | 914 | } |
934 | 915 | } |
935 | 916 | } |
| 917 | + return false; |
| 918 | + } |
936 | 919 | |
| 920 | + /** |
| 921 | + * Same as locateExecutable(), but checks in getPossibleBinPaths() by default |
| 922 | + * @see locateExecutable() |
| 923 | + */ |
| 924 | + protected function locateExecutableInDefaultPaths( $names, $versionInfo = false ) { |
| 925 | + foreach( $this->getPossibleBinPaths() as $path ) { |
| 926 | + $exe = $this->locateExecutable( $path, $names, $versionInfo ); |
| 927 | + if( $exe !== false ) { |
| 928 | + return $exe; |
| 929 | + } |
| 930 | + } |
937 | 931 | return false; |
938 | 932 | } |
939 | 933 | |