mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-82399 admin: allow selective purging of courses cache from UI.
Equivalent to the same functionality in the CLI tool in 5e05ad570f.
This commit is contained in:
parent
bcf06a0484
commit
c78793beb3
@ -48,6 +48,7 @@ class purge_caches extends \moodleform {
|
||||
$mform->addElement('header', 'purgecacheheader', get_string('purgeselectedcaches', 'admin'));
|
||||
$checkboxes = [
|
||||
$mform->createElement('advcheckbox', 'theme', '', get_string('purgethemecache', 'admin')),
|
||||
$mform->createElement('advcheckbox', 'courses', '', get_string('purgecoursecache', 'admin')),
|
||||
$mform->createElement('advcheckbox', 'lang', '', get_string('purgelangcache', 'admin')),
|
||||
$mform->createElement('advcheckbox', 'js', '', get_string('purgejscache', 'admin')),
|
||||
$mform->createElement('advcheckbox', 'template', '', get_string('purgetemplates', 'admin')),
|
||||
|
@ -42,7 +42,11 @@ if ($data = $form->get_data()) {
|
||||
purge_caches();
|
||||
$message = get_string('purgecachesfinished', 'admin');
|
||||
} else {
|
||||
purge_caches($data->purgeselectedoptions);
|
||||
// When passing selected options, ensure each is cast to boolean for strict comparison.
|
||||
purge_caches(array_map(
|
||||
fn($option) => (bool) $option,
|
||||
$data->purgeselectedoptions,
|
||||
));
|
||||
$message = get_string('purgeselectedcachesfinished', 'admin');
|
||||
}
|
||||
|
||||
|
@ -1160,6 +1160,7 @@ $string['purgecachesconfirm'] = 'Moodle can cache themes, javascript, language s
|
||||
$string['purgecachesfinished'] = 'All caches were purged.';
|
||||
$string['purgecachesnoneselected'] = 'Select one or more caches to purge';
|
||||
$string['purgecachespage'] = 'Purge caches';
|
||||
$string['purgecoursecache'] = 'Courses';
|
||||
$string['purgefiltercache'] = 'Text filters';
|
||||
$string['purgejscache'] = 'JavaScript';
|
||||
$string['purgelangcache'] = 'Language strings';
|
||||
|
@ -1194,10 +1194,11 @@ function purge_all_caches() {
|
||||
*
|
||||
* @param bool[] $options Specific parts of the cache to purge. Valid options are:
|
||||
* 'muc' Purge MUC caches?
|
||||
* 'courses' Purge all course caches, or specific course caches (CLI only)
|
||||
* 'courses' Purge all course caches, or specific course caches
|
||||
* 'theme' Purge theme cache?
|
||||
* 'lang' Purge language string cache?
|
||||
* 'js' Purge javascript cache?
|
||||
* 'template' Purge template cache
|
||||
* 'filter' Purge text filter cache?
|
||||
* 'other' Purge all other caches?
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user