helly           Sat May 31 16:40:56 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/phar/phar      pharcommand.inc 
  Log:
  - Add version comand
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar/pharcommand.inc?r1=1.49.2.1&r2=1.49.2.2&diff_format=u
Index: php-src/ext/phar/phar/pharcommand.inc
diff -u php-src/ext/phar/phar/pharcommand.inc:1.49.2.1 
php-src/ext/phar/phar/pharcommand.inc:1.49.2.2
--- php-src/ext/phar/phar/pharcommand.inc:1.49.2.1      Sat May 31 15:53:16 2008
+++ php-src/ext/phar/phar/pharcommand.inc       Sat May 31 16:40:55 2008
@@ -1437,6 +1437,63 @@
         }
     }
     // }}}
+    // {{{ public function cli_cmd_inf_version
+    /**
+     * CLi Command Inf Version
+     *
+     * @return string A description about the info commands.
+     */
+    public function cli_cmd_inf_version()
+    {
+        return "Get information about the PHAR environment and the tool 
version.";
+    }
+    // }}}
+    // {{{ public function cli_cmd_arg_version
+    /**
+     * Cli Command Arg Version
+     *
+     * @return array The arguments for version command.
+     */
+    public function cli_cmd_arg_version()
+    {
+        return self::phar_args('', NULL);
+    }
+    // }}}
+    // {{{ public function cli_cmd_run_info
+    /**
+     * Cli Command Run Info
+     *
+     * @param args $args
+     */
+    public function cli_cmd_run_version()
+    {
+       $use_ext = extension_loaded('phar');
+       $version = array(
+               'PHP Version' => phpversion(),
+               'phar.phar version' => '$Revision: 1.49.2.2 $',
+               'Phar EXT version' => $use_ext ? phpversion('phar') : 'Not 
available',
+                       'Phar API version' => Phar::apiVersion(),
+                       'Phar-based phar archives' => true,
+                       'Tar-based phar archives' => $use_ext,
+                       'ZIP-based phar archives' => $use_ext,
+                       'gzip compression' => extension_loaded('zlib'),
+                       'bzip2 compression' => extension_loaded('bz2'),
+                       'supported signatures' => $use_ext ? join(', ', 
Phar::getSupportedSignatures()) : '',
+                       );
+               $klen = 0;
+               foreach($version as $k => $v)
+               {
+                       $klen = max($klen, strlen($k));
+               }
+               ++$klen;
+               foreach($version as $k => $v) {
+                       if (is_bool($v)) {
+                               $v = $v ? 'enabled' : 'disabled';
+                       }
+                       printf("%-${klen}s  %s\n", $k.':', $v);
+               }
+    }
+    // }}}
 }
 // }}}
 ?>



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to