Merge pull request #3877 from pixelfed/staging

Update AvatarStorage pipeline
This commit is contained in:
daniel 2022-12-02 01:37:38 -07:00 committed by GitHub
commit 38c84e1c3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View file

@ -87,12 +87,12 @@ class AvatarStorage extends Command
$this->line(' '); $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->info('✅ - Store avatars on cloud filesystem');
$this->line(' '); $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')); $disk = Storage::disk(config_cache('filesystems.cloud'));
$exists = $disk->exists('cache/avatars/default.jpg'); $exists = $disk->exists('cache/avatars/default.jpg');
$state = $exists ? '✅' : '❌'; $state = $exists ? '✅' : '❌';
@ -100,7 +100,7 @@ class AvatarStorage extends Command
$this->info($msg); $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', 'Cancel',
'Upload default avatar to cloud', 'Upload default avatar to cloud',
@ -164,7 +164,7 @@ class AvatarStorage extends Command
protected function uploadAvatarsToCloud() 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'); $this->error('Enable cloud storage and avatar cloud storage to perform this action');
return; return;
} }

View file

@ -65,7 +65,7 @@ class AvatarOptimize implements ShouldQueue
Cache::forget('avatar:' . $avatar->profile_id); Cache::forget('avatar:' . $avatar->profile_id);
$this->deleteOldAvatar($avatar->media_path, $this->current); $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); $this->uploadToCloud($avatar);
} else { } else {
$avatar->cdn_url = null; $avatar->cdn_url = null;

View file

@ -55,6 +55,7 @@ class ConfigCacheService
'config.discover.features', 'config.discover.features',
'instance.has_legal_notice', 'instance.has_legal_notice',
'instance.avatar.local_to_cloud',
'pixelfed.directory', 'pixelfed.directory',
'app.banner_image', 'app.banner_image',