diff --git a/vtigercron.php b/vtigercron.php index 0a974602217b872e6a78415a25046c681e9bc687..886ae0bd131a1d10df00322f86d3705de06fb0d5 100644 --- a/vtigercron.php +++ b/vtigercron.php @@ -37,7 +37,11 @@ if($php < 50300){ $mailbody ="Instance dir : $root_directory <br/> Site Url : $site_URL <br/> Host Name : $hostName<br/>"; $mailSubject = "[Alert] "; -if(PHP_SAPI === "cli" || (isset($_SESSION["authenticated_user_id"]) && isset($_SESSION["app_unique_key"]) && $_SESSION["app_unique_key"] == $application_unique_key)){ +function vtigercron_detect_run_in_cli(){ + return (!isset($_SERVER['SERVER_SOFTWARE']) && (php_sapi_name() == 'cli' || is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0)); +} + +if(vtigercron_detect_run_in_cli() || (isset($_SESSION["authenticated_user_id"]) && isset($_SESSION["app_unique_key"]) && $_SESSION["app_unique_key"] == $application_unique_key)){ $cronTasks = false; if (isset($_REQUEST['service'])) {