mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2025-04-10 22:53:11 +02:00
Ticket system improvement on error handling and logging
This commit is contained in:
parent
9daaf58281
commit
9a45653eaf
@ -161,7 +161,7 @@ class MailAttachmentData implements MailAttachmentInterface
|
|||||||
$content = $part->getContent();
|
$content = $part->getContent();
|
||||||
if ($content === null) { // This should not be
|
if ($content === null) { // This should not be
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf('content is null "%s"', substr(print_r($part,true),1000))
|
sprintf('content is null "%s"', substr(print_r($part,true),0,1000))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ class TicketImportHelper
|
|||||||
return($candidate);
|
return($candidate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($loopCounter > 99) {
|
if ($loopCounter > 9999) {
|
||||||
throw new NumberGeneratorException('ticket number generation failed');
|
throw new NumberGeneratorException('ticket number generation failed');
|
||||||
}
|
}
|
||||||
$loopCounter++;
|
$loopCounter++;
|
||||||
@ -483,6 +483,9 @@ class TicketImportHelper
|
|||||||
{
|
{
|
||||||
$insertedMailsCount = 0;
|
$insertedMailsCount = 0;
|
||||||
foreach ($inboxMessageIds as $messageNumber) {
|
foreach ($inboxMessageIds as $messageNumber) {
|
||||||
|
|
||||||
|
$this->logger->debug("Fetch $messageNumber", ['']);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$message = $this->mailClient->fetchMessage((int)$messageNumber);
|
$message = $this->mailClient->fetchMessage((int)$messageNumber);
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
@ -491,7 +494,8 @@ class TicketImportHelper
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$this->logger->debug('Start import', ['message' => $message]);
|
// $this->logger->debug('Start import', ['message' => substr(print_r($message,true),1000)]);
|
||||||
|
$this->logger->debug('Start import', []);
|
||||||
|
|
||||||
$result = $this->importMessage($message);
|
$result = $this->importMessage($message);
|
||||||
|
|
||||||
@ -503,10 +507,11 @@ class TicketImportHelper
|
|||||||
$this->mailClient->setFlags((int)$messageNumber, ['\\Seen']);
|
$this->mailClient->setFlags((int)$messageNumber, ['\\Seen']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->logger->error('Error during email import', ['']);
|
$this->logger->error('Error during email import', ['message' => substr(print_r($message,true),0,1000)]);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$this->logger->error('Error during email import', ['exception' => $e]);
|
$this->logger->error('Error during email import', ['message' => substr(print_r($message,true),0,1000)]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -550,7 +555,7 @@ class TicketImportHelper
|
|||||||
if ($plainTextBody == '' && $htmlBody == '') {
|
if ($plainTextBody == '' && $htmlBody == '') {
|
||||||
$simple_content = $message->getContent();
|
$simple_content = $message->getContent();
|
||||||
if (empty($simple_content)) {
|
if (empty($simple_content)) {
|
||||||
$this->logger->debug('Empty mail',['message' => $message]);
|
$this->logger->debug('Empty mail',[]);
|
||||||
} else {
|
} else {
|
||||||
$plainTextBody = $simple_content;
|
$plainTextBody = $simple_content;
|
||||||
$htmlBody = nl2br(htmlentities($simple_content));
|
$htmlBody = nl2br(htmlentities($simple_content));
|
||||||
@ -591,7 +596,8 @@ class TicketImportHelper
|
|||||||
|
|
||||||
if ($result == 0) {
|
if ($result == 0) {
|
||||||
|
|
||||||
$this->logger->debug('Importing message',['message' => $message]);
|
// $this->logger->debug('Importing message',['message' => substr(print_r($message,true),1000)]);
|
||||||
|
$this->logger->debug('Importing message attachments',[]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$attachments = $message->getAttachments();
|
$attachments = $message->getAttachments();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user