Skip to content

Commit

Permalink
Update ErrorLogger.php
Browse files Browse the repository at this point in the history
  • Loading branch information
thorewi authored Aug 9, 2023
1 parent 06c5e9b commit d28cd22
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/ErrorLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,9 @@ protected function sendEmail($message): void
$maxEmailsPerDayLog = $this->directory . '/max-emails-per-day.log';

// delete file from yesterday
if (date('Y-m-d', @filemtime($maxEmailsPerDayLog)) < (new DateTime('midnight'))->format('Y-m-d')) {
if (($filemtime = @filemtime($maxEmailsPerDayLog)) && date('Y-m-d', $filemtime) < (new DateTime('midnight'))->format('Y-m-d')) {
@unlink($maxEmailsPerDayLog);
}

$logContent = @file_get_contents($maxEmailsPerDayLog);

file_put_contents('adasd', count(file($maxEmailsPerDayLog)));

if (count(file($maxEmailsPerDayLog)) >= $this->maxEmailsPerDay) {
} elseif (($lines = @file($maxEmailsPerDayLog)) && count($lines) >= $this->maxEmailsPerDay) {
// Limit per day exceeded
return;
}
Expand Down

0 comments on commit d28cd22

Please sign in to comment.