summaryrefslogtreecommitdiff
path: root/update.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2022-02-20 16:35:32 +0300
committerAndrew Dolgov <[email protected]>2022-02-20 16:35:32 +0300
commit9a5c21630b5b7e2e3adb2e0334defbd9515aa833 (patch)
treebfea4407f1db49fe2ebde0868207a2e61767f79f /update.php
parentf7e2f62022592a6f89280ac50f0868c681c1303b (diff)
update.php: better error reporting if invoked with PHP SAPI other than CLI
Diffstat (limited to 'update.php')
-rwxr-xr-xupdate.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/update.php b/update.php
index 90251c2f3..f33458c2e 100755
--- a/update.php
+++ b/update.php
@@ -10,6 +10,14 @@
require_once "autoload.php";
require_once "functions.php";
+
+ if (php_sapi_name() != "cli") {
+ header("Content-type: text/plain");
+ printf("Please run this script using PHP CLI executable (you're using PHP SAPI: %s, PHP_EXECUTABLE is set to '%s')\n",
+ php_sapi_name(), Config::get(Config::PHP_EXECUTABLE));
+ exit(1);
+ }
+
Config::sanity_check();
function make_stampfile(string $filename): bool {
@@ -100,12 +108,6 @@
$options_map[$command . $data["suffix"]] = [ $data["arghelp"], $data["description"] ];
}
- if (php_sapi_name() != "cli") {
- header("Content-type: text/plain");
- print "Please run this script from the command line.\n";
- exit;
- }
-
$options = getopt("", array_keys($options_map));
if ($options === false || count($options) == 0 || isset($options["help"]) ) {