Explorar o código

Update CatchUnoptimizedMedia command, make 1hr limit opt-in

Daniel Supernault hai 6 meses
pai
achega
99b15b73f6
Modificáronse 2 ficheiros con 8 adicións e 3 borrados
  1. 4 3
      app/Console/Commands/CatchUnoptimizedMedia.php
  2. 4 0
      config/media.php

+ 4 - 3
app/Console/Commands/CatchUnoptimizedMedia.php

@@ -40,10 +40,11 @@ class CatchUnoptimizedMedia extends Command
      */
      */
     public function handle()
     public function handle()
     {
     {
+        $hasLimit = (bool) config('media.image_optimize.catch_unoptimized_media_hour_limit');
         Media::whereNull('processed_at')
         Media::whereNull('processed_at')
-            // This is commented out because Instagram imported posts would not get uploaded to remote storage
-			// ->where('created_at', '>', now()->subHours(1))
-            ->whereNull('remote_url')
+            ->when($hasLimit, function($q, $hasLimit) {
+                $q->where('created_at', '>', now()->subHours(1));
+            })->whereNull('remote_url')
             ->whereNotNull('status_id')
             ->whereNotNull('status_id')
             ->whereNotNull('media_path')
             ->whereNotNull('media_path')
             ->whereIn('mime', [
             ->whereIn('mime', [

+ 4 - 0
config/media.php

@@ -24,6 +24,10 @@ return [
         ],
         ],
     ],
     ],
 
 
+    'image_optimize' => [
+        'catch_unoptimized_media_hour_limit' => env('PF_CATCHUNOPTIMIZEDMEDIA', false),
+    ],
+
     'hls' => [
     'hls' => [
         /*
         /*
         |--------------------------------------------------------------------------
         |--------------------------------------------------------------------------