]> granicus.if.org Git - php/commitdiff
- Improve header of pharcommand
authorMarcus Boerger <helly@php.net>
Tue, 29 May 2007 09:08:41 +0000 (09:08 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 29 May 2007 09:08:41 +0000 (09:08 +0000)
ext/phar/phar/phar.php

index f19c9b7fee90aa26cd96c50b39e8987c2892cc27..93a938842cbd8e8d4819aece5108e4488017d039 100755 (executable)
  * Phar Command
  */
 
-if (!extension_loaded("phar")) {
-    if (!class_exists("PHP_Archive")) {
-        echo "PHP_Archive not available.\n";
-        exit(1);
+if (!extension_loaded('phar'))
+{
+       if (!class_exists('PHP_Archive', 0))
+       {
+           echo "Neither Extension Phar nor class PHP_Archive are available.\n";
+       exit(1);
     }
-
-    if (!class_exists("Phar")) {
-        class Phar extends PHP_Archive {}
+    if (!in_array('phar', stream_get_wrappers()))
+    {
+           stream_wrapper_register('phar', 'PHP_Archive');
+    }
+    if (!class_exists('Phar',0)) {
+           require 'phar://'.__FILE__.'/phar.inc';
     }
 }
 
-foreach(array("SPL", "Reflection") as $ext) {
-    if (!extension_loaded($ext)) {
+foreach(array("SPL", "Reflection") as $ext)
+{
+    if (!extension_loaded($ext))
+    {
         echo "$argv[0] requires PHP extension $ext.\n";
         exit(1);
     }