]> granicus.if.org Git - php/commitdiff
- Improve pear usage and PHP_Archive detection
authorMarcus Boerger <helly@php.net>
Wed, 4 Jun 2008 09:46:34 +0000 (09:46 +0000)
committerMarcus Boerger <helly@php.net>
Wed, 4 Jun 2008 09:46:34 +0000 (09:46 +0000)
ext/phar/phar/pharcommand.inc

index 7c7043c1ef43e0281e1462d430665c86ae5a8812..2738e2a658d3496ff8a48991c8f7cf8864c927fb 100755 (executable)
@@ -209,13 +209,18 @@ class PharCommand extends CLICommand
     {
         if (($arg == '0' || $arg == '1') && !file_exists($arg)) {
             $found = NULL;
-            foreach(split("\n", `pear list-files PHP_Archive`) as $ent) {
-                $matches = NULL;
-                if (preg_match(",^php[ \t]+([^ \t].*pear[\\\\/]PHP[\\\\/]Archive.php)$,", $ent, $matches)) {
-                    $found = $matches[1];
-                    break;
-                }
-            }
+               $apiver = `pear -q info PHP_Archive 2>/dev/null|grep 'API Version'`;
+               $apiver = trim(substr($apiver, strlen('API Version')));
+               if ($apiver) {
+                       self::notice("Pear package PHP_Archive found: API Version: $apiver.\n");
+                   foreach(split("\n", `pear list-files PHP_Archive`) as $ent) {
+                       $matches = NULL;
+                       if (preg_match(",^php[ \t]+([^ \t].*pear[\\\\/]PHP[\\\\/]Archive.php)$,", $ent, $matches)) {
+                           $found = $matches[1];
+                           break;
+                       }
+                   }
+               }
             if (!isset($found)) {
                 $msg = "Pear package PHP_Archive or Archive.php class file not found.\n";
                 if ($arg == '0') {