N°2214 Add PHP check in CLI scripts

It is quite common that the PHP interpreter that is launched in CLI is different that the one used by the webserver. So iTop code launched by CLI could run in a context that doesn't meet iTop requirements !

This adds in the following scripts the same control that is done on the setup wizard first step :
* cron.php
* backup, check-backup
* export, exportv2
* bulk import
* synchro-exec, synchro-import

If the check throws at least one error then the script is stopped with an appropriate message, and a log is made (IssueLog, Error level, CLI channel)
This commit is contained in:
Pierre Goiffon
2020-06-12 16:31:50 +02:00
parent d4b93f3bf0
commit c768e18e2b
10 changed files with 123 additions and 22 deletions

View File

@@ -72,6 +72,7 @@ function ReadMandatoryParam($oP, $sParam, $sSanitizationFilter = 'parameter')
if (utils::IsModeCLI())
{
$oP = new CLIPage(Dict::S("TitleSynchroExecution"));
SetupUtils::CheckPhpAndExtensionsForCli($oP, -2);
}
else
{