From 2eee36cfbd28858efed2e440920e5c944438631e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 8 Apr 2023 04:25:52 -0600 Subject: [PATCH] Update MediaS3GarbageCollector, fix handle --- app/Console/Commands/MediaS3GarbageCollector.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/MediaS3GarbageCollector.php b/app/Console/Commands/MediaS3GarbageCollector.php index 431b5d1f5..7cbadc5f3 100644 --- a/app/Console/Commands/MediaS3GarbageCollector.php +++ b/app/Console/Commands/MediaS3GarbageCollector.php @@ -66,7 +66,13 @@ class MediaS3GarbageCollector extends Command return; } - $minId = Media::orderByDesc('id')->where('created_at', '<', now()->subHours(12))->first()->id; + $minId = Media::orderByDesc('id')->where('created_at', '<', now()->subHours(12))->first(); + + if(!$minId) { + return; + } else { + $minId = $minId->id; + } return $hugeMode ? $this->hugeMode($minId, $limit, $log) :