feat(housekeeping): add clear_cache option to flush redis or files cache

This commit is contained in:
Yassine Doghri 2022-01-29 16:42:34 +00:00
parent 42d92d0c8d
commit 99bfac0b42
4 changed files with 9 additions and 0 deletions

View File

@ -283,6 +283,10 @@ class SettingsController extends BaseController
}
}
if ($this->request->getPost('clear_cache') === 'yes') {
cache()->clean();
}
return redirect('settings-general')->with('message', lang('Settings.housekeeping.runSuccess'));
}

View File

@ -35,6 +35,8 @@ return [
'reset_counts_helper' => 'This option will recalculate and reset all data counts (number of followers, posts, comments, …).',
'rewrite_media' => 'Rewrite media metadata',
'rewrite_media_helper' => 'This option will delete all superfluous media files and recreate them (images, audio files, transcripts, chapters, …)',
'clear_cache' => 'Clear all cache',
'clear_cache_helper' => 'This option will flush redis cache or writable/cache files.',
'run' => 'Run housekeeping',
'runSuccess' => 'Housekeeping has been run successfully!',
],

View File

@ -35,6 +35,8 @@ return [
'reset_counts_helper' => 'Cette option recalcul et réinitialise les compteurs de données (nombre dabonné·e·s, de publications, de commentaires, …).',
'rewrite_media' => 'Réécrire les métadonnées des fichiers média',
'rewrite_media_helper' => 'Cette option supprimera tous les fichiers média superflus et les recréera (images, fichiers audio, transcripts, chapitrages, …)',
'clear_cache' => 'Supprimer tout le cache',
'clear_cache_helper' => 'Cette option supprimera lintégralité du cache redis ou des fichiers cache du dossier writable/cache.',
'run' => 'Faire le ménage',
'runSuccess' => 'Le ménage a été effectué avec succès!',
],

View File

@ -79,6 +79,7 @@
<Forms.Toggler name="reset_counts" value="yes" size="small" checked="true" hint="<?= lang('Settings.housekeeping.reset_counts_helper') ?>"><?= lang('Settings.housekeeping.reset_counts') ?></Forms.Toggler>
<Forms.Toggler name="rewrite_media" value="yes" size="small" checked="true" hint="<?= lang('Settings.housekeeping.rewrite_media_helper') ?>"><?= lang('Settings.housekeeping.rewrite_media') ?></Forms.Toggler>
<Forms.Toggler name="clear_cache" value="yes" size="small" checked="true" hint="<?= lang('Settings.housekeeping.clear_cache_helper') ?>"><?= lang('Settings.housekeeping.clear_cache') ?></Forms.Toggler>
<Button variant="primary" type="submit" iconLeft="home-gear"><?= lang('Settings.housekeeping.run') ?></Button>