58ee78e58868ec25e3e5890d5d5b4d1ad6c7033d
[bdrem.git] / src / phar-stub.php
1 <?php
2 if (!in_array('phar', stream_get_wrappers()) || !class_exists('Phar', false)) {
3     echo "Phar extension not avaiable\n";
4     exit(255);
5 }
6
7 $web = 'www/index.php';
8 $cli = 'bin/phar-bdrem.php';
9
10 function rewritePath($path)
11 {
12     if ($path == '' || $path == '/') {
13         return 'www/index.php';
14     }
15     return $path;
16 }
17
18 //Phar::interceptFileFuncs();
19 set_include_path(
20     'phar://' . __FILE__
21     . PATH_SEPARATOR . 'phar://' . __FILE__ . '/lib/'
22 );
23 Phar::webPhar(null, $web, null, array(), 'rewritePath');
24 include 'phar://' . __FILE__ . '/' . $cli;
25 __HALT_COMPILER();
26 ?>