[MEDIA][CACHE] Cache avatar queries and delete stale values; small refactoring

This commit is contained in:
Hugo Sales
2020-08-19 15:32:45 +00:00
committed by Hugo Sales
parent e3c5d7e5dc
commit 9649bec01e
4 changed files with 39 additions and 6 deletions

View File

@@ -35,7 +35,6 @@ namespace App\Controller;
// {{{ Imports
use App\Core\Cache;
use App\Core\DB\DB;
use App\Core\Event;
use App\Core\Form;
@@ -160,7 +159,7 @@ class UserPanel extends AbstractController
if ($old_file != null) {
@unlink($old_file);
}
Cache::delete('avatar-' . $actor->getNickname());
Event::handle('delete_cached_avatar', [$actor->getNickname()]);
}
return ['_template' => 'settings/avatar.html.twig', 'avatar' => $form->createView()];