From d52ee26dd764d64ee04b6fafa43cb56f73804be2 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 2 Dec 2022 01:36:23 -0700 Subject: [PATCH] Update AvatarStorage pipeline --- app/Console/Commands/AvatarStorage.php | 8 ++++---- app/Jobs/AvatarPipeline/AvatarOptimize.php | 2 +- app/Services/ConfigCacheService.php | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Console/Commands/AvatarStorage.php b/app/Console/Commands/AvatarStorage.php index 1568d335c..b8a124467 100644 --- a/app/Console/Commands/AvatarStorage.php +++ b/app/Console/Commands/AvatarStorage.php @@ -87,12 +87,12 @@ class AvatarStorage extends Command $this->line(' '); } - if(config_cache('instance.avatar.local_to_cloud')) { + if(config('instance.avatar.local_to_cloud')) { $this->info('✅ - Store avatars on cloud filesystem'); $this->line(' '); } - if(config_cache('pixelfed.cloud_storage') && config_cache('instance.avatar.local_to_cloud')) { + if(config_cache('pixelfed.cloud_storage') && config('instance.avatar.local_to_cloud')) { $disk = Storage::disk(config_cache('filesystems.cloud')); $exists = $disk->exists('cache/avatars/default.jpg'); $state = $exists ? '✅' : '❌'; @@ -100,7 +100,7 @@ class AvatarStorage extends Command $this->info($msg); } - $options = config_cache('pixelfed.cloud_storage') && config_cache('instance.avatar.local_to_cloud') ? + $options = config_cache('pixelfed.cloud_storage') && config('instance.avatar.local_to_cloud') ? [ 'Cancel', 'Upload default avatar to cloud', @@ -164,7 +164,7 @@ class AvatarStorage extends Command protected function uploadAvatarsToCloud() { - if(!config_cache('pixelfed.cloud_storage') || !config_cache('instance.avatar.local_to_cloud')) { + if(!config_cache('pixelfed.cloud_storage') || !config('instance.avatar.local_to_cloud')) { $this->error('Enable cloud storage and avatar cloud storage to perform this action'); return; } diff --git a/app/Jobs/AvatarPipeline/AvatarOptimize.php b/app/Jobs/AvatarPipeline/AvatarOptimize.php index f462ddde0..cae4456e8 100644 --- a/app/Jobs/AvatarPipeline/AvatarOptimize.php +++ b/app/Jobs/AvatarPipeline/AvatarOptimize.php @@ -65,7 +65,7 @@ class AvatarOptimize implements ShouldQueue Cache::forget('avatar:' . $avatar->profile_id); $this->deleteOldAvatar($avatar->media_path, $this->current); - if(config_cache('pixelfed.cloud_storage') && config_cache('instance.avatar.local_to_cloud')) { + if(config_cache('pixelfed.cloud_storage') && config('instance.avatar.local_to_cloud')) { $this->uploadToCloud($avatar); } else { $avatar->cdn_url = null; diff --git a/app/Services/ConfigCacheService.php b/app/Services/ConfigCacheService.php index 0a9055287..4ffa8da6c 100644 --- a/app/Services/ConfigCacheService.php +++ b/app/Services/ConfigCacheService.php @@ -55,6 +55,7 @@ class ConfigCacheService 'config.discover.features', 'instance.has_legal_notice', + 'instance.avatar.local_to_cloud', 'pixelfed.directory', 'app.banner_image',