Check whether run from cli or from web request within cli-script.php (#3984)

* ENHANCEMENT - Improved access determination
* ENHANCEMENT - Added an additional check for the existence of the mod_rewrite module
This commit is contained in:
Daniel Hensby 2016-04-19 07:54:11 +01:00 committed by Sam Minnée
parent 2d119f021d
commit 4240785fc7
2 changed files with 4 additions and 2 deletions

View File

@ -13,7 +13,7 @@
/**
* Ensure that people can't access this from a web-server
*/
if(isset($_SERVER['HTTP_HOST'])) {
if(PHP_SAPI != "cli" && PHP_SAPI != "cgi" && PHP_SAPI != "cgi-fcgi") {
echo "cli-script.php can't be run from a web request, you have to run it on the command-line.";
die();
}

View File

@ -980,7 +980,9 @@ class InstallRequirements {
return true;
} elseif(isset($_SERVER['HTTP_MOD_REWRITE']) && $_SERVER['HTTP_MOD_REWRITE'] == 'On') {
return true;
} else {
} elseif(isset($_SERVER['REDIRECT_HTTP_MOD_REWRITE']) && $_SERVER['REDIRECT_HTTP_MOD_REWRITE'] == 'On') {
return true;
} else {
return false;
}
}