diff --git a/ajax/system/sys_read_logfile.php b/ajax/system/sys_read_logfile.php new file mode 100644 index 00000000..7715fab2 --- /dev/null +++ b/ajax/system/sys_read_logfile.php @@ -0,0 +1,43 @@ + 1, + 'Updating sources' => 2, + 'Installing required packages' => 3, + 'Cloning latest files' => 4, + 'Installing application' => 5, + 'Installation completed' => 6, + 'error' => 7 +]; +sleep(1); + +if (file_exists($logFile)) { + $handle = fopen($logFile, 'r'); + + if ($handle) { + while (($line = fgets($handle)) !== false) { + foreach ($searchStrings as $searchString => $value) { + if (strpos($line, $searchString) !== false) { + echo $value .PHP_EOL; + flush(); + ob_flush(); + if ($value === 6) { + fclose($handle); + exit(); + } elseif ($value === 7) { + echo $line .PHP_EOL; + fclose($handle); + exit(); + } + } + } + } + fclose($handle); + } else { + echo json_encode("Unable to open file: $logFile"); + } +} else { + echo json_encode("File does not exist: $logFile"); +} + +