]> granicus.if.org Git - php/commitdiff
MFB fixes to phar.phar
authorGreg Beaver <cellog@php.net>
Fri, 23 Nov 2007 05:51:59 +0000 (05:51 +0000)
committerGreg Beaver <cellog@php.net>
Fri, 23 Nov 2007 05:51:59 +0000 (05:51 +0000)
ext/phar/package.php
ext/phar/phar.phar
ext/phar/phar/clicommand.inc
ext/phar/phar/phar.php
ext/phar/phar/pharcommand.inc

index 9701c4358e9aada0c74c54dd961e36d990081e0a..25bf354a167aaa23794fc3ed898c16a64752c4b2 100644 (file)
@@ -34,6 +34,7 @@ $options = array(
          'Makefile.frag'      => 'src',
          'phar_path_check.re' => 'src',
          'TODO'               => 'doc',
+         'phar.phar'          => 'script',
     ),
 );
 
index 793e7189e81cdbcf75c6ecfbf78b56595db585de..9686edc73939b499168c693c7040fe3f9a035945 100755 (executable)
Binary files a/ext/phar/phar.phar and b/ext/phar/phar.phar differ
index 455dfa4446a203cbe34a4015cf3ff2650b511122..067456d691b5a64967a23e150dbd957ffdf43f7b 100755 (executable)
@@ -219,7 +219,7 @@ abstract class CLICommand
         if ($f === false) {
             self::error("Path for file '$arg' does not exist.\n");
         }
-        return $f . substr($arg, strlen($d));;
+        return $f . '/' . basename($arg);
     }
 
     static function cli_arg_typ_filecont($arg, $cfg, $key)
index 93a938842cbd8e8d4819aece5108e4488017d039..68a437b20649cdf024aae6e218392a83339f381f 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/php
+#!/usr/local/bin/php
 <?php
 
 /** @file phar.php
index 57878453208af0b96faf9296aa48be5cb5d47bbc..7c9bcf5e17a73bc8904db7a06e86166aea106d91 100755 (executable)
@@ -612,9 +612,12 @@ class PharCommand extends CLICommand
             $dir = new InvertedRegexIterator($dir, $invregex);
         }
 
+        $any = false;
         foreach($dir as $pn => $f) {
+            $any = true;
             call_user_func($func, $pn, $f, $args);
         }
+        return $any;
     }
     // {{{ static function cli_cmd_inf_list
     /**
@@ -687,11 +690,14 @@ class PharCommand extends CLICommand
      */
     public function cli_cmd_run_tree()
     {
-        $this->phar_dir_operation(
+        $a = $this->phar_dir_operation(
             new DirectoryGraphIterator(
                 $this->args['f']['val']), 
                 array($this, 'phar_dir_echo')
             );
+        if (!$a) {
+            echo "|-<root directory>\n";
+        }
     }
     // }}}
     // {{{ cli_cmd_inf_extract
@@ -746,7 +752,7 @@ class PharCommand extends CLICommand
             }
         }
         
-        $phar = $args['f']['val'];
+        $phar = $this->args['f']['val'];
         $base = $phar->getPathname();
         $bend = strpos($base, '.phar');
         $bend = strpos($base, '/', $bend);
@@ -1192,11 +1198,13 @@ class PharCommand extends CLICommand
 
         if (isset($entry)) {
             if (!$phar[$entry]->hasMetadata()) {
+                echo "No Metadata\n";
                 exit(1);
             }
             echo serialize($phar[$entry]->getMetadata());
         } else {
             if (!$phar->hasMetadata()) {
+                echo "No Metadata\n";
                 exit(1);
             }
             $meta = $phar->getMetadata();
@@ -1208,6 +1216,7 @@ class PharCommand extends CLICommand
                     echo $meta[$index];
                     exit(0);
                 } else {
+                    echo "No Metadata\n";
                     exit(1);
                 }
             } else {