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)

(cherry picked from commit c768e18e2b : no risk taken for 2.7.1, so cherry picked for 2.8.0)
This commit is contained in:
Pierre Goiffon
2020-06-12 16:31:50 +02:00
parent ea94986247
commit b7136c0b7a
10 changed files with 123 additions and 22 deletions

View File

@@ -255,6 +255,7 @@ class CLILikeWebPage extends WebPage
if (utils::IsModeCLI())
{
$oP = new CLIPage(Dict::S('TitleSynchroExecution'));
SetupUtils::CheckPhpAndExtensionsForCli($oP, -2);
}
else
{