update.php: better error reporting if invoked with PHP SAPI other than CLI
This commit is contained in:
parent
f7e2f62022
commit
9a5c21630b
14
update.php
14
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"]) ) {
|
||||
|
|
Loading…
Reference in New Issue