Add a message to avoid using wrong script file
This commit is contained in:
parent
f356d534cd
commit
585e604ac4
@ -34,6 +34,13 @@ if (! defined('NOLOGIN')) define('NOLOGIN', '1');
|
||||
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
||||
if (is_numeric($entity)) define("DOLENTITY", $entity);
|
||||
|
||||
// Error if CLI mode
|
||||
if (php_sapi_name() == "cli")
|
||||
{
|
||||
echo "Error: This page can't be used as a CLI script. For the CLI version of script, launch cron_run_job.php available into scripts/cron/ directory.\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// librarie core
|
||||
// Dolibarr environment
|
||||
require '../../main.inc.php';
|
||||
@ -46,6 +53,8 @@ global $langs, $conf;
|
||||
// Language Management
|
||||
$langs->loadLangs(array("admin", "cron"));
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
@ -35,7 +35,7 @@ $sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
// Error if Web mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit(-1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user