From 2eee36cfbd28858efed2e440920e5c944438631e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 8 Apr 2023 04:25:52 -0600 Subject: [PATCH 1/2] 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) : From 1b53174d3ac4103b29f25f91fc4dcaf56d566010 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 8 Apr 2023 18:31:29 -0600 Subject: [PATCH 2/2] Update StatusController --- app/Http/Controllers/StatusController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/StatusController.php b/app/Http/Controllers/StatusController.php index c0e2e4ece..087f679e0 100644 --- a/app/Http/Controllers/StatusController.php +++ b/app/Http/Controllers/StatusController.php @@ -219,11 +219,11 @@ class StatusController extends Controller $u->save(); } - Cache::forget('_api:statuses:recent_9:' . $status->profile_id); - Cache::forget('profile:status_count:' . $status->profile_id); - Cache::forget('profile:embed:' . $status->profile_id); - StatusService::del($status->id, true); if ($status->profile_id == $user->profile->id || $user->is_admin == true) { + Cache::forget('_api:statuses:recent_9:' . $status->profile_id); + Cache::forget('profile:status_count:' . $status->profile_id); + Cache::forget('profile:embed:' . $status->profile_id); + StatusService::del($status->id, true); Cache::forget('profile:status_count:'.$status->profile_id); StatusDelete::dispatch($status); }