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