Skip to content
This repository has been archived by the owner on Aug 6, 2023. It is now read-only.

Commit

Permalink
fix(docker): Check for cli execution with php_sapi_name since
Browse files Browse the repository at this point in the history
we won't have all the environment variables loaded

Signed-off-by: Francisco Miguel Biete <[email protected]>
  • Loading branch information
Francisco Miguel Biete committed Apr 2, 2015
1 parent 676f83f commit 6a0881f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions backend/zarafa/listfolders.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ function main() {

function listfolders_configure() {

if (!isset($_SERVER["TERM"]) || !isset($_SERVER["LOGNAME"])) {
echo "This script should not be called in a browser.\n";
if (php_sapi_name() != "cli") {
printf("This script should not be called in a browser. Called from: %s\n", php_sapi_name());
exit(1);
}

Expand Down Expand Up @@ -181,4 +181,4 @@ function listfolders_getlist ($adminStore, $session, $user) {
}
}

?>
?>
6 changes: 3 additions & 3 deletions tools/migrate-2.0.x-2.1.0.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
* MAIN
*/
try {
if (!isset($_SERVER["TERM"]) || !isset($_SERVER["LOGNAME"]))
die("This script should not be called in a browser.");
if (php_sapi_name() != "cli")
die(sprintf("This script should not be called in a browser. Called from: %s", php_sapi_name()));

if (!defined('ZPUSH_BASE_PATH') || !file_exists(ZPUSH_BASE_PATH . "/config.php"))
die("ZPUSH_BASE_PATH not set correctly or no config.php file found\n");
Expand Down Expand Up @@ -214,4 +214,4 @@ public function DoMigration() {
}
}

?>
?>
6 changes: 3 additions & 3 deletions z-push-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ static public function UsageInstructions() {
* @access public
*/
static public function CheckEnv() {
if (!isset($_SERVER["TERM"]) || !isset($_SERVER["LOGNAME"]))
self::$errormessage = "This script should not be called in a browser.";
if (php_sapi_name() != "cli")
self::$errormessage = sprintf("This script should not be called in a browser. Called from: %s", php_sapi_name());

if (!function_exists("getopt"))
self::$errormessage = "PHP Function getopt not found. Please check your PHP version and settings.";
Expand Down Expand Up @@ -903,4 +903,4 @@ static private function printDeviceData($deviceId, $user) {
}


?>
?>

0 comments on commit 6a0881f

Please sign in to comment.