3 if (ini_get('phar.readonly') == 1) {
4 //re-run this script with phar writing activated
5 passthru(PHP_BINARY . ' -dphar.readonly=0 ' . escapeshellarg($argv[0]));
9 $pharfile = __DIR__ . '/../dist/bdrem-0.1.0.phar';
10 if (file_exists($pharfile)) {
13 $phar = new Phar($pharfile, 0, 'bdrem.phar');
14 $phar->startBuffering();
16 // add all files in the project
17 $phar->buildFromDirectory(
18 realpath(__DIR__ . '/../'),
20 . '^' . preg_quote(realpath(__DIR__ . '/../'), '#')
21 . '/(data/bdrem.config.php.dist|lib/|src/bdrem/|www/|README\.rst)'
25 //remove shebang from bin/bdrem.php
26 $bin = file_get_contents(__DIR__ . '/../bin/bdrem.php');
27 $phar->addFromString('bin/bdrem.php', substr($bin, strpos($bin, "\n") + 1));
29 $phar->setStub(file_get_contents(__DIR__ . '/../src/phar-stub.php'));
30 $phar->stopBuffering();