diff --git a/app/Jobs/MailError.php b/app/Jobs/MailError.php index 4e170923a7..89517db69f 100644 --- a/app/Jobs/MailError.php +++ b/app/Jobs/MailError.php @@ -73,10 +73,10 @@ class MailError extends Job implements ShouldQueue // limit number of error mails that can be sent. if ($this->reachedLimit()) { Log::info('MailError: reached limit, not sending email.'); + return; } - if ($this->attempts() < 3 && '' !== $email) { try { \Mail::send( @@ -88,7 +88,7 @@ class MailError extends Job implements ShouldQueue } } ); - } catch (\Exception | TransportException $e) { // @phpstan-ignore-line + } catch (\Exception|TransportException $e) { // @phpstan-ignore-line $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.'); @@ -106,9 +106,6 @@ class MailError extends Job implements ShouldQueue } } - /** - * @return bool - */ private function reachedLimit(): bool { Log::debug('reachedLimit()'); @@ -119,8 +116,9 @@ class MailError extends Job implements ShouldQueue ]; $file = storage_path('framework/cache/error-count.json'); $limits = []; - if(!is_writable($file)) { + if (!is_writable($file)) { Log::error(sprintf('MailError: cannot write to "%s", cannot rate limit errors!', $file)); + return false; } if (!file_exists($file)) { @@ -143,7 +141,7 @@ class MailError extends Job implements ShouldQueue } if (time() - $limits[$type]['time'] > $info['reset']) { - Log::debug(sprintf('Time past for this limit is %d seconds, exceeding %d seconds. Reset to zero.', (time() - $limits[$type]['time']), $info['reset'])); + Log::debug(sprintf('Time past for this limit is %d seconds, exceeding %d seconds. Reset to zero.', time() - $limits[$type]['time'], $info['reset'])); $limits[$type] = [ 'time' => time(), 'sent' => 0, @@ -152,13 +150,14 @@ class MailError extends Job implements ShouldQueue if ($limits[$type]['sent'] > $info['limit']) { Log::warning(sprintf('Sent %d emails in %s, return true.', $limits[$type]['sent'], $type)); + return true; } - $limits[$type]['sent']++; + ++$limits[$type]['sent']; } file_put_contents($file, json_encode($limits, JSON_PRETTY_PRINT)); Log::debug('No limits reached, return FALSE.'); - return false; + return false; } } diff --git a/resources/lang/sl_SI/validation.php b/resources/lang/sl_SI/validation.php index 2f9404ba41..25ba6a89f1 100644 --- a/resources/lang/sl_SI/validation.php +++ b/resources/lang/sl_SI/validation.php @@ -68,7 +68,7 @@ return [ 'invalid_selection' => 'Vaša izbira je neveljavna.', 'belongs_user' => 'Ta vrednost je povezana z objektom, za katerega se zdi, da ne obstaja.', 'belongs_user_or_user_group' => 'Ta vrednost je povezana z objektom, za katerega se zdi, da ne obstaja v vaši trenutni finančni upravi.', - 'no_access_group' => 'The user has no access to this user group.', + 'no_access_group' => 'Uporabnik nima dostopa do te uporabniške skupine.', 'no_accepted_roles_defined' => 'No access roles have been defined for this endpoint, access denied.', 'at_least_one_transaction' => 'Potrebujete vsaj eno transakcijo.', 'recurring_transaction_id' => 'Potrebujete vsaj eno transakcijo.',