Update config() to config_cache()

This commit is contained in:
Daniel Supernault 2021-05-11 20:14:51 -06:00
parent 3a9203e039
commit 7895097fc1
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
6 changed files with 149 additions and 149 deletions

View File

@ -1059,7 +1059,7 @@ class ApiV1Controller extends Controller
$profile = $user->profile;
if(config('pixelfed.enforce_account_limit') == true) {
if(config_cache('pixelfed.enforce_account_limit') == true) {
$size = Cache::remember($user->storageUsedKey(), now()->addDays(3), function() use($user) {
return Media::whereUserId($user->id)->sum('size') / 1000;
});

View File

@ -92,7 +92,7 @@ class ComposeController extends Controller
abort_if($limitReached == true, 429);
if(config('pixelfed.enforce_account_limit') == true) {
if(config_cache('pixelfed.enforce_account_limit') == true) {
$size = Cache::remember($user->storageUsedKey(), now()->addDays(3), function() use($user) {
return Media::whereUserId($user->id)->sum('size') / 1000;
});

View File

@ -522,7 +522,7 @@ class DirectMessageController extends Controller
$hidden = false;
}
if(config('pixelfed.enforce_account_limit') == true) {
if(config_cache('pixelfed.enforce_account_limit') == true) {
$size = Cache::remember($user->storageUsedKey(), now()->addDays(3), function() use($user) {
return Media::whereUserId($user->id)->sum('size') / 1000;
});

View File

@ -25,7 +25,7 @@ trait HomeSettings
$id = Auth::user()->profile->id;
$storage = [];
$used = Media::whereProfileId($id)->sum('size');
$storage['limit'] = config('pixelfed.max_account_size') * 1024;
$storage['limit'] = config_cache('pixelfed.max_account_size') * 1024;
$storage['used'] = $used;
$storage['percentUsed'] = ceil($storage['used'] / $storage['limit'] * 100);
$storage['limitPretty'] = PrettyNumber::size($storage['limit']);

View File

@ -23,7 +23,7 @@ class Config {
'optimize_video' => config('pixelfed.optimize_video'),
'media_types' => config_cache('pixelfed.media_types'),
'enforce_account_limit' => config('pixelfed.enforce_account_limit')
'enforce_account_limit' => config_cache('pixelfed.enforce_account_limit')
],
'activitypub' => [

View File

@ -67,7 +67,7 @@
</select>
</div>
</div>
@if(config('pixelfed.enforce_account_limit'))
@if(config_cache('pixelfed.enforce_account_limit'))
<div class="pt-3">
<p class="font-weight-bold text-muted text-center">Storage Usage</p>
</div>