瀏覽代碼

Update MediaS3GarbageCollector, fix handle

Daniel Supernault 2 年之前
父節點
當前提交
2eee36cfbd
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      app/Console/Commands/MediaS3GarbageCollector.php

+ 7 - 1
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) :