phpstan fix + add log

This commit is contained in:
odain
2026-02-26 08:46:06 +01:00
parent 393643b6f9
commit e4b8f31af0
2 changed files with 6 additions and 7 deletions

View File

@@ -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];

View File

@@ -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