From 99b15b73f68e9e8b0637dc03527c7cf3aada9757 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 3 Jan 2025 21:38:07 -0700 Subject: [PATCH] Update CatchUnoptimizedMedia command, make 1hr limit opt-in --- app/Console/Commands/CatchUnoptimizedMedia.php | 7 ++++--- config/media.php | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/CatchUnoptimizedMedia.php b/app/Console/Commands/CatchUnoptimizedMedia.php index 4887cb8e3..a5bb22f98 100644 --- a/app/Console/Commands/CatchUnoptimizedMedia.php +++ b/app/Console/Commands/CatchUnoptimizedMedia.php @@ -40,10 +40,11 @@ class CatchUnoptimizedMedia extends Command */ public function handle() { + $hasLimit = (bool) config('media.image_optimize.catch_unoptimized_media_hour_limit'); 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('media_path') ->whereIn('mime', [ diff --git a/config/media.php b/config/media.php index 46c1719db..5e3b32ae6 100644 --- a/config/media.php +++ b/config/media.php @@ -24,6 +24,10 @@ return [ ], ], + 'image_optimize' => [ + 'catch_unoptimized_media_hour_limit' => env('PF_CATCHUNOPTIMIZEDMEDIA', false), + ], + 'hls' => [ /* |--------------------------------------------------------------------------