Back to index

php5  5.3.10
phar.php
Go to the documentation of this file.
00001 #!/usr/local/bin/php
00002 <?php
00003 
00013 if (!extension_loaded('phar'))
00014 {
00015        if (!class_exists('PHP_Archive', 0)) {
00016               echo "Neither Extension Phar nor class PHP_Archive are available.\n";
00017               exit(1);
00018        }
00019        if (!in_array('phar', stream_get_wrappers())) {
00020               stream_wrapper_register('phar', 'PHP_Archive');
00021        }
00022        if (!class_exists('Phar',0)) {
00023               require 'phar://'.__FILE__.'/phar.inc';
00024        }
00025 }
00026 
00027 foreach(array("SPL", "Reflection") as $ext)
00028 {
00029        if (!extension_loaded($ext)) {
00030               echo "$argv[0] requires PHP extension $ext.\n";
00031               exit(1);
00032        }
00033 }
00034 
00035 function command_include($file)
00036 {
00037        $file = 'phar://' . __FILE__ . '/' . $file;
00038        if (file_exists($file)) {
00039               include($file);
00040        }
00041 }
00042 
00043 function command_autoload($classname)
00044 {
00045        command_include(strtolower($classname) . '.inc');
00046 }
00047 
00048 Phar::mapPhar();
00049 
00050 spl_autoload_register('command_autoload');
00051 
00052 new PharCommand($argc, $argv);
00053 
00054 __HALT_COMPILER();
00055 
00056 ?>