mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-20 07:42:17 +02:00
phpstan fix + add log
This commit is contained in:
@@ -23,7 +23,7 @@ try {
|
|||||||
$sMsg = "";
|
$sMsg = "";
|
||||||
$sLogFile = APPROOT."log/$sLogFilename";
|
$sLogFile = APPROOT."log/$sLogFilename";
|
||||||
|
|
||||||
$aLines = Utils::ReadTail($sLogFile, 2);
|
$aLines = utils::ReadTail($sLogFile, 2);
|
||||||
$sLastLine = $aLines[1] ?? '';
|
$sLastLine = $aLines[1] ?? '';
|
||||||
if (0 === strpos($sLastLine, 'Exiting: ')) {
|
if (0 === strpos($sLastLine, 'Exiting: ')) {
|
||||||
$sContent = $aLines[0];
|
$sContent = $aLines[0];
|
||||||
|
|||||||
@@ -66,17 +66,16 @@ try {
|
|||||||
|
|
||||||
$sPHPExec = trim(\MetaModel::GetConfig()->Get('php_path'));
|
$sPHPExec = trim(\MetaModel::GetConfig()->Get('php_path'));
|
||||||
$sCliForLogs = GetCliCommand($sPHPExec, $sLogFile, $aCronValues).PHP_EOL;
|
$sCliForLogs = GetCliCommand($sPHPExec, $sLogFile, $aCronValues).PHP_EOL;
|
||||||
file_put_contents("$sLogFile", $sCliForLogs);
|
IssueLog::Info("launch cron asynchronously/remotely", null, ['cli' => $sCliForLogs]);
|
||||||
if (! is_file($sLogFile)) {
|
|
||||||
throw new \Exception("Cannot write in $sLogFile");
|
|
||||||
}
|
|
||||||
|
|
||||||
$aCronValues[] = "--auth_info=".escapeshellarg($sTokenInfo);
|
$aCronValues[] = "--auth_info=".escapeshellarg($sTokenInfo);
|
||||||
$sCli = GetCliCommand($sPHPExec, $sLogFile, $aCronValues);
|
$sCli = GetCliCommand($sPHPExec, $sLogFile, $aCronValues);
|
||||||
$process = popen($sCli, 'r');
|
$process = popen($sCli, 'r');
|
||||||
|
if (false === $process){
|
||||||
|
throw new \Exception("CLI execution issue");
|
||||||
|
}
|
||||||
|
|
||||||
$i = 0;
|
while ($aLines = utils::ReadTail($sLogFile)) {
|
||||||
while ($aLines = Utils::ReadTail($sLogFile)) {
|
|
||||||
$sLastLine = array_shift($aLines);
|
$sLastLine = array_shift($aLines);
|
||||||
if (IsErrorLine($sLastLine) || IsCronStartingLine($sLastLine)) {
|
if (IsErrorLine($sLastLine) || IsCronStartingLine($sLastLine)) {
|
||||||
//return answer once we are sure cron is starting or did not pass authentication
|
//return answer once we are sure cron is starting or did not pass authentication
|
||||||
|
|||||||
Reference in New Issue
Block a user