Update config() to config_cache()

pull/2753/head
Daniel Supernault 5 years ago
parent f4fc8347c9
commit 3a9203e039
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7

@ -1063,7 +1063,7 @@ class ApiV1Controller extends Controller
$size = Cache::remember($user->storageUsedKey(), now()->addDays(3), function() use($user) { $size = Cache::remember($user->storageUsedKey(), now()->addDays(3), function() use($user) {
return Media::whereUserId($user->id)->sum('size') / 1000; return Media::whereUserId($user->id)->sum('size') / 1000;
}); });
$limit = (int) config('pixelfed.max_account_size'); $limit = (int) config_cache('pixelfed.max_account_size');
if ($size >= $limit) { if ($size >= $limit) {
abort(403, 'Account size limit reached.'); abort(403, 'Account size limit reached.');
} }

@ -96,7 +96,7 @@ class ComposeController extends Controller
$size = Cache::remember($user->storageUsedKey(), now()->addDays(3), function() use($user) { $size = Cache::remember($user->storageUsedKey(), now()->addDays(3), function() use($user) {
return Media::whereUserId($user->id)->sum('size') / 1000; return Media::whereUserId($user->id)->sum('size') / 1000;
}); });
$limit = (int) config('pixelfed.max_account_size'); $limit = (int) config_cache('pixelfed.max_account_size');
if ($size >= $limit) { if ($size >= $limit) {
abort(403, 'Account size limit reached.'); abort(403, 'Account size limit reached.');
} }

@ -526,7 +526,7 @@ class DirectMessageController extends Controller
$size = Cache::remember($user->storageUsedKey(), now()->addDays(3), function() use($user) { $size = Cache::remember($user->storageUsedKey(), now()->addDays(3), function() use($user) {
return Media::whereUserId($user->id)->sum('size') / 1000; return Media::whereUserId($user->id)->sum('size') / 1000;
}); });
$limit = (int) config('pixelfed.max_account_size'); $limit = (int) config_cache('pixelfed.max_account_size');
if ($size >= $limit) { if ($size >= $limit) {
abort(403, 'Account size limit reached.'); abort(403, 'Account size limit reached.');
} }

@ -90,7 +90,7 @@
</tr> </tr>
<tr> <tr>
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">storage used</th> <th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">storage used</th>
<td class="text-right font-weight-bold">{{PrettyNumber::size($profile->media()->sum('size'))}}<span class="text-muted"> / {{PrettyNumber::size(config('pixelfed.max_account_size') * 1000)}}</span></td> <td class="text-right font-weight-bold">{{PrettyNumber::size($profile->media()->sum('size'))}}<span class="text-muted"> / {{PrettyNumber::size(config_cache('pixelfed.max_account_size') * 1000)}}</span></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -118,4 +118,4 @@
</div> </div>
</div> </div>
</div> </div>
@endsection @endsection

Loading…
Cancel
Save