mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Auto commit for release 'develop' on 2024-04-07
This commit is contained in:
parent
a1be6ff62b
commit
dc808fa807
@ -73,10 +73,10 @@ class MailError extends Job implements ShouldQueue
|
|||||||
// limit number of error mails that can be sent.
|
// limit number of error mails that can be sent.
|
||||||
if ($this->reachedLimit()) {
|
if ($this->reachedLimit()) {
|
||||||
Log::info('MailError: reached limit, not sending email.');
|
Log::info('MailError: reached limit, not sending email.');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($this->attempts() < 3 && '' !== $email) {
|
if ($this->attempts() < 3 && '' !== $email) {
|
||||||
try {
|
try {
|
||||||
\Mail::send(
|
\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();
|
$message = $e->getMessage();
|
||||||
if (str_contains($message, 'Bcc')) {
|
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.');
|
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
|
private function reachedLimit(): bool
|
||||||
{
|
{
|
||||||
Log::debug('reachedLimit()');
|
Log::debug('reachedLimit()');
|
||||||
@ -119,8 +116,9 @@ class MailError extends Job implements ShouldQueue
|
|||||||
];
|
];
|
||||||
$file = storage_path('framework/cache/error-count.json');
|
$file = storage_path('framework/cache/error-count.json');
|
||||||
$limits = [];
|
$limits = [];
|
||||||
if(!is_writable($file)) {
|
if (!is_writable($file)) {
|
||||||
Log::error(sprintf('MailError: cannot write to "%s", cannot rate limit errors!', $file));
|
Log::error(sprintf('MailError: cannot write to "%s", cannot rate limit errors!', $file));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!file_exists($file)) {
|
if (!file_exists($file)) {
|
||||||
@ -143,7 +141,7 @@ class MailError extends Job implements ShouldQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (time() - $limits[$type]['time'] > $info['reset']) {
|
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] = [
|
$limits[$type] = [
|
||||||
'time' => time(),
|
'time' => time(),
|
||||||
'sent' => 0,
|
'sent' => 0,
|
||||||
@ -152,13 +150,14 @@ class MailError extends Job implements ShouldQueue
|
|||||||
|
|
||||||
if ($limits[$type]['sent'] > $info['limit']) {
|
if ($limits[$type]['sent'] > $info['limit']) {
|
||||||
Log::warning(sprintf('Sent %d emails in %s, return true.', $limits[$type]['sent'], $type));
|
Log::warning(sprintf('Sent %d emails in %s, return true.', $limits[$type]['sent'], $type));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$limits[$type]['sent']++;
|
++$limits[$type]['sent'];
|
||||||
}
|
}
|
||||||
file_put_contents($file, json_encode($limits, JSON_PRETTY_PRINT));
|
file_put_contents($file, json_encode($limits, JSON_PRETTY_PRINT));
|
||||||
Log::debug('No limits reached, return FALSE.');
|
Log::debug('No limits reached, return FALSE.');
|
||||||
return false;
|
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ return [
|
|||||||
'invalid_selection' => 'Vaša izbira je neveljavna.',
|
'invalid_selection' => 'Vaša izbira je neveljavna.',
|
||||||
'belongs_user' => 'Ta vrednost je povezana z objektom, za katerega se zdi, da ne obstaja.',
|
'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.',
|
'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.',
|
'no_accepted_roles_defined' => 'No access roles have been defined for this endpoint, access denied.',
|
||||||
'at_least_one_transaction' => 'Potrebujete vsaj eno transakcijo.',
|
'at_least_one_transaction' => 'Potrebujete vsaj eno transakcijo.',
|
||||||
'recurring_transaction_id' => 'Potrebujete vsaj eno transakcijo.',
|
'recurring_transaction_id' => 'Potrebujete vsaj eno transakcijo.',
|
||||||
|
Loading…
Reference in New Issue
Block a user