mirror of
https://github.com/php/php-src.git
synced 2026-04-29 19:23:22 +02:00
98f2dc2aca
at startup. This caches the manifest, so that on first access to a phar archive, no file manifest parsing occurs. This could use further tweaking. For instance, the full copy of the manifest into the current process may be unnecessary if refcounting could be external to the manifest. This would be another significant gain. With APC, I measure a slight perf increase to 19 req/sec up from 16 req/sec, without it approaches regular PHP at 3.8 req/sec (regular is 4 req/sec). This is benching phpMyAdmin
112 lines
15 KiB
Plaintext
Executable File
112 lines
15 KiB
Plaintext
Executable File
#!/home/cellog/testapache/bin/php
|
||
<?php if (!class_exists('PHP_Archive')) {
|
||
?><?php
|
||
}
|
||
if (!in_array('phar', stream_get_wrappers())) {
|
||
stream_wrapper_register('phar', 'PHP_Archive');
|
||
}
|
||
if (!class_exists('Phar',0)) {
|
||
include 'phar://'.__FILE__.'/phar.inc';
|
||
}
|
||
?><?php
|
||
|
||
/** @file phar.php
|
||
* @ingroup Phar
|
||
* @brief class CLICommand
|
||
* @author Marcus Boerger
|
||
* @date 2007 - 2007
|
||
*
|
||
* Phar Command
|
||
*/
|
||
|
||
if (!extension_loaded('phar'))
|
||
{
|
||
if (!class_exists('PHP_Archive', 0))
|
||
{
|
||
echo "Neither Extension Phar nor class PHP_Archive are available.\n";
|
||
exit(1);
|
||
}
|
||
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))
|
||
{
|
||
echo "$argv[0] requires PHP extension $ext.\n";
|
||
exit(1);
|
||
}
|
||
}
|
||
|
||
function command_include($file)
|
||
{
|
||
$file = 'phar://' . __FILE__ . '/' . $file;
|
||
if (file_exists($file)) {
|
||
include($file);
|
||
}
|
||
}
|
||
|
||
function command_autoload($classname)
|
||
{
|
||
command_include(strtolower($classname) . '.inc');
|
||
}
|
||
|
||
Phar::mapPhar();
|
||
|
||
spl_autoload_register('command_autoload');
|
||
|
||
new PharCommand($argc, $argv);
|
||
|
||
__HALT_COMPILER(); ?>
|
||
6 |