Skip to content

Commit a0e05a8

Browse files
committed
Adds a check for phar.readonly and a note on fixing it.
1 parent e84f059 commit a0e05a8

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

tools/build.php

100644100755
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
#!/usr/bin/env php
22
<?php
33

4-
ini_set("phar.readonly", "Off");
5-
$phar = new Phar('git-deploy.phar', 0, 'git-deploy');
6-
$phar->buildFromDirectory(dirname(__FILE__));
7-
$phar->setStub(file_get_contents(dirname(__FILE__)."/index.php"));
8-
unset($phar);
9-
@unlink('../git-deploy');
10-
rename('git-deploy.phar', '../git-deploy');
4+
if (ini_get("phar.readonly")) {
5+
echo "You need to set the 'phar.readonly' option to 'Off' in your php.ini file (" . php_ini_loaded_file() . ")".PHP_EOL;
6+
} else {
7+
$phar = new Phar('git-deploy.phar', 0, 'git-deploy');
8+
$phar->buildFromDirectory(dirname(__FILE__));
9+
$phar->setStub(file_get_contents(dirname(__FILE__) . "/index.php"));
10+
unset($phar);
11+
@unlink('../git-deploy');
12+
rename('git-deploy.phar', '../git-deploy');
13+
echo "Built git-deploy successfully!".PHP_EOL;
14+
}

0 commit comments

Comments
 (0)