Skip to content

Commit

Permalink
fix lock failures
Browse files Browse the repository at this point in the history
  • Loading branch information
antedebaas committed Oct 13, 2024
1 parent 2b808b3 commit 1a3fc8d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Command/GetReportsFromMailboxCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,16 @@ private function open_mailbox(ConnectionInterface $ci_mailbox): MailboxResponse
{
$response = new MailboxResponse();

$repository = $this->em->getRepository(Config::class);
$lock = $repository->findOneBy(array('name' => 'check_mailbox_lock'));

$mailbox = $ci_mailbox->getMailbox();
$mail_ids = $mailbox->searchMailbox('UNSEEN');
$details = array('count' => 0, 'reports' => array());

$success = false;
foreach($mail_ids as $mailid) {

$result = $this->process_email($mailbox, $mailid);

if($result['success'] == true) {
Expand Down Expand Up @@ -236,6 +240,9 @@ private function open_mailbox(ConnectionInterface $ci_mailbox): MailboxResponse

private function process_email(\PhpImap\Mailbox $mailbox, int $mailid): array
{
$repository = $this->em->getRepository(Config::class);
$lock = $repository->findOneBy(array('name' => 'check_mailbox_lock'));

$mail = $mailbox->getMail($mailid);
$reports = array();
$response = array('success' => false, 'reports' => array());
Expand Down Expand Up @@ -355,6 +362,9 @@ private function process_email(\PhpImap\Mailbox $mailbox, int $mailid): array

private function open_archive($file): array
{
$repository = $this->em->getRepository(Config::class);
$lock = $repository->findOneBy(array('name' => 'check_mailbox_lock'));

$report = null;
$reporttype = ReportType::Other;
$success = false;
Expand Down Expand Up @@ -452,6 +462,9 @@ private function isJson($string)

private function process_dmarc_report(MailReportResponse $report): bool
{
$repository = $this->em->getRepository(Config::class);
$lock = $repository->findOneBy(array('name' => 'check_mailbox_lock'));

$dmarcreport = $report->getReport();
try {
$domain_repository = $this->em->getRepository(Domains::class);
Expand Down Expand Up @@ -555,6 +568,9 @@ private function process_dmarc_report(MailReportResponse $report): bool

private function process_sts_report(MailReportResponse $report): bool
{
$repository = $this->em->getRepository(Config::class);
$lock = $repository->findOneBy(array('name' => 'check_mailbox_lock'));

$smtptlsreport = $report->getReport();
try {
$dbreport = new SMTPTLS_Reports();
Expand Down

0 comments on commit 1a3fc8d

Please sign in to comment.