Skip to content

Commit

Permalink
Dusting
Browse files Browse the repository at this point in the history
  • Loading branch information
lewislarsen authored and actions-user committed Jul 1, 2024
1 parent 5e27030 commit 0d85a72
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions app/Services/Backup/Backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use Exception;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
use InvalidArgumentException;
use phpseclib3\Crypt\Common\PrivateKey;
use phpseclib3\Crypt\PublicKeyLoader;
use RuntimeException;
Expand Down Expand Up @@ -544,14 +543,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 @@ -570,15 +561,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 0d85a72

Please sign in to comment.