Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
lewislarsen committed Jul 2, 2024
2 parents f906df3 + cd75c59 commit 1da8d4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ e9a4dfa07fa462e92828a0a1cdfa72d20f4fa7b9
3afb045fbc17e8938d82753bee0fb9c3c0bddcac
c26f5c08fa85972b95297b748c394971c3bc893e
71c87c056fa275d369a25be7f2d42b0416f60fc9
0d85a72d6fe58f2235e9d78aba62881a1c0a21cc
14 changes: 4 additions & 10 deletions app/Services/Backup/Backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,14 +545,6 @@ protected function logWithTimestamp(string $message, string $timezone): string
return '[' . $timestamp . '] ' . $message . "\n";
}

/**
* @param BackupDestinationInterface $backupDestination
* @param int $backupTaskId
* @param int $backupLimit
* @param string $fileExtension
* @param string $pattern
* @return void
*/
protected function rotateOldBackups(
BackupDestinationInterface $backupDestination,
int $backupTaskId,
Expand All @@ -571,15 +563,17 @@ protected function rotateOldBackups(
while (count($files) > $backupLimit) {
$oldestFile = array_pop($files);

if (!is_array($oldestFile)) {
if (! is_array($oldestFile)) {
$this->logError('Invalid file structure encountered.', ['file' => $oldestFile]);

continue;
}

$file = $oldestFile['Key'] ?? $oldestFile['name'] ?? null;

if (!is_string($file)) {
if (! is_string($file)) {
$this->logError('Invalid file name or key.', ['file' => $oldestFile]);

continue;
}

Expand Down

0 comments on commit 1da8d4d

Please sign in to comment.