MDL-23167 Upgraded "Purge caches" to a full admin page with a confirm button, and added a link to it in the footer for developers.
This commit is contained in:
@@ -378,8 +378,6 @@ if (!empty($CFG->maintenance_enabled)) {
|
||||
echo $OUTPUT->box(get_string('sitemaintenancewarning2', 'admin', "$CFG->wwwroot/$CFG->admin/settings.php?section=maintenancemode"), 'generalbox adminwarning');
|
||||
}
|
||||
|
||||
echo $OUTPUT->single_button(new moodle_url('/admin/purgecaches.php'), get_string('purgecaches', 'admin'), 'post');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO HIDE, REMOVE OR MODIFY THIS COPYRIGHT NOTICE ///
|
||||
$copyrighttext = '<a href="http://moodle.org/">Moodle</a> '.
|
||||
|
||||
+15
-4
@@ -24,15 +24,26 @@
|
||||
*/
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
$PAGE->set_url('/admin/purgecaches.php');
|
||||
admin_externalpage_setup('purgecaches');
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_sesskey();
|
||||
|
||||
purge_all_caches();
|
||||
if ($confirm) {
|
||||
require_sesskey();
|
||||
purge_all_caches();
|
||||
redirect($_SERVER['HTTP_REFERER'], get_string('purgecachesfinished', 'admin'));
|
||||
} else {
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('purgecaches', 'admin'));
|
||||
|
||||
redirect(new moodle_url('/admin/index.php'), get_string('purgecachesfinished', 'admin'));
|
||||
$url = new moodle_url('/admin/purgecaches.php', array('sesskey'=>sesskey(), 'confirm'=>1));
|
||||
$return = $_SERVER['HTTP_REFERER'];
|
||||
echo $OUTPUT->confirm(get_string('purgecachesconfirm', 'admin'), $url, $return);
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
}
|
||||
|
||||
@@ -44,4 +44,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
if ($CFG->mnet_dispatcher_mode !== 'off') {
|
||||
$ADMIN->add('development', new admin_externalpage('mnettestclient', get_string('testclient', 'mnet'), "$CFG->wwwroot/$CFG->admin/mnet/testclient.php"));
|
||||
}
|
||||
|
||||
$ADMIN->add('development', new admin_externalpage('purgecaches', get_string('purgecaches','admin'), "$CFG->wwwroot/$CFG->admin/purgecaches.php"));
|
||||
} // end of speedup
|
||||
|
||||
Reference in New Issue
Block a user