fehlerbericht.php 912 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. require_once(dirname(__FILE__).'/models/Logfile.php');
  3. require_once(dirname(__FILE__).'/mail.php');
  4. if (count($argv) < 2) {
  5. die('Aufruf: php fehlerbericht.php Prot-Verzeichnis "Kunde" Gaps.bat.log Startzeit');
  6. }
  7. $protPath = $argv[1];
  8. $customer = $argv[2];
  9. $infoLog = $argv[3];
  10. $startTime = @$argv[4];
  11. $batchFile = @$argv[5];
  12. $attachments = array(
  13. 'info' => $infoLog,
  14. 'error' => $protPath . "\\fehlerbericht.json",
  15. 'gcstarter' => $protPath . "\\gcstarter.json",
  16. 'gcstruct' => $protPath . "\\gcstruct.json"
  17. );
  18. $endTime = date("H:i");
  19. $logs = checkProtocolDirectory($protPath);
  20. $errorCount = count($logs);
  21. if ($startTime) {
  22. if (strlen($startTime) == 4) {
  23. $startTime = "0" . $startTime;
  24. }
  25. $logs = checkProtocolDirectory($protPath, true);
  26. file_put_contents($attachments['error'], json_encode($logs));
  27. sendStatusMail($customer, $startTime, $endTime, $errorCount, $batchFile, $attachments);
  28. }
  29. ?>