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
|
||||
|
||||
@@ -830,6 +830,7 @@ $string['requiredtemplate'] = 'Required. You may use template syntax here (%l =
|
||||
$string['requiremodintro'] = 'Require activity description';
|
||||
$string['requires'] = 'Requires';
|
||||
$string['purgecaches']= 'Purge all caches';
|
||||
$string['purgecachesconfirm']= 'Moodle can cache themes, javascript, language strings, filtered text, rss feeds and many other pieces of calculated data. Purging these caches will delete that data from the server and force browsers to refetch data, so that you can be sure you are seeing the most up-to-date values produced by the current code. There is no danger in purging caches, but your site may appear slower for a while until the server and clients calculate new information and cache it.';
|
||||
$string['purgecachesfinished']= 'All caches were purged.';
|
||||
$string['restrictbydefault'] = 'Restrict modules by default';
|
||||
$string['restrictmodulesfor'] = 'Restrict modules for';
|
||||
|
||||
@@ -354,6 +354,9 @@ class core_renderer extends renderer_base {
|
||||
if (!empty($CFG->debugpageinfo)) {
|
||||
$output .= '<div class="performanceinfo">This page is: ' . $this->page->debug_summary() . '</div>';
|
||||
}
|
||||
if (debugging(null, DEBUG_DEVELOPER)) { // Only in developer mode
|
||||
$output .= '<div class="purgecaches"><a href="'.$CFG->wwwroot.'/admin/purgecaches.php?confirm=1&sesskey='.sesskey().'">'.get_string('purgecaches', 'admin').'</a></div>';
|
||||
}
|
||||
if (!empty($CFG->debugvalidators)) {
|
||||
$output .= '<div class="validators"><ul>
|
||||
<li><a href="http://validator.w3.org/check?verbose=1&ss=1&uri=' . urlencode(qualified_me()) . '">Validate HTML</a></li>
|
||||
|
||||
Reference in New Issue
Block a user