Browse Source

Update MediaS3GarbageCollector, fix handle

Daniel Supernault 2 years ago
parent
commit
2eee36cfbd
1 changed files with 7 additions and 1 deletions
  1. 7 1
      app/Console/Commands/MediaS3GarbageCollector.php

+ 7 - 1
app/Console/Commands/MediaS3GarbageCollector.php

@@ -66,7 +66,13 @@ class MediaS3GarbageCollector extends Command
             return;
             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 ?
         return $hugeMode ?
             $this->hugeMode($minId, $limit, $log) :
             $this->hugeMode($minId, $limit, $log) :