svn: /pear2/Pyrus/trunk/src/Pyrus/ Config.php

From: Date: Sun, 21 Feb 2010 17:34:25 +0000
Subject: svn: /pear2/Pyrus/trunk/src/Pyrus/ Config.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-9183@lists.php.net to get a copy of this message
dufuz Sun, 21 Feb 2010 17:34:25 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=295307 Log: Consolidate the Win / Nix code as it was a complete duplicate except the binary part. # Keeping 2 copies of the same code is redundant and will cause fixing of one part but # not the other as can be seen by the PHP Notice only happening in the Win section but # was already fixed in *nix Changed paths: U pear2/Pyrus/trunk/src/Pyrus/Config.php Modified: pear2/Pyrus/trunk/src/Pyrus/Config.php =================================================================== --- pear2/Pyrus/trunk/src/Pyrus/Config.php 2010-02-21 17:32:43 UTC (rev 295306) +++ pear2/Pyrus/trunk/src/Pyrus/Config.php 2010-02-21 17:34:25 UTC (rev 295307) @@ -337,26 +337,15 @@ } // construct php_bin - if (substr(PHP_OS, 0, 3) == 'WIN') { - if (file_exists(self::$defaults['bin_dir'] . DIRECTORY_SEPARATOR . 'php.exe')) { - self::$defaults['php_bin'] = self::$defaults['bin_dir'] . DIRECTORY_SEPARATOR . 'php.exe'; - } elseif (isset($_ENV['PATH'])) { - foreach (explode(PATH_SEPARATOR, $_ENV['PATH']) as $path) { - if (file_exists($path . DIRECTORY_SEPARATOR . 'php.exe')) { - self::$defaults['php_bin'] = $path . DIRECTORY_SEPARATOR . 'php.exe'; - } + $bin = substr(PHP_OS, 0, 3) == 'WIN' ? 'php.exe' : 'php'; + if (file_exists(self::$defaults['bin_dir'] . DIRECTORY_SEPARATOR . $bin)) { + self::$defaults['php_bin'] = self::$defaults['bin_dir'] . DIRECTORY_SEPARATOR . $bin; + } elseif (isset($_ENV['PATH'])) { + foreach (explode(PATH_SEPARATOR, $_ENV['PATH']) as $path) { + if (file_exists($path . DIRECTORY_SEPARATOR . $bin)) { + self::$defaults['php_bin'] = $path . DIRECTORY_SEPARATOR . $bin; } } - } else { - if (file_exists(self::$defaults['bin_dir'] . DIRECTORY_SEPARATOR . 'php')) { - self::$defaults['php_bin'] = self::$defaults['bin_dir'] . DIRECTORY_SEPARATOR . 'php'; - } elseif (isset($_ENV['PATH'])) { - foreach (explode(PATH_SEPARATOR, $_ENV['PATH']) as $path) { - if (file_exists($path . DIRECTORY_SEPARATOR . 'php')) { - self::$defaults['php_bin'] = $path . DIRECTORY_SEPARATOR . 'php'; - } - } - } } foreach (array_merge(self::$pearConfigNames,

« previous php.pear.core (#9183) next »