Skip to content

Commit

Permalink
MDL-60741 purgecaches: did not correctly setup the admin page
Browse files Browse the repository at this point in the history
Note that, admin_externalpage_setup does the right capability check.
  • Loading branch information
timhunt committed Nov 8, 2017
1 parent ccf7578 commit d00007b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions admin/purgecaches.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$returnurl = optional_param('returnurl', null, PARAM_LOCALURL);

admin_externalpage_setup('purgecaches');

// If we have got here as a confirmed aciton, do it.
if ($confirm && isloggedin() && confirm_sesskey()) {
require_capability('moodle/site:config', context_system::instance());
if ($confirm && confirm_sesskey()) {

// Valid request. Purge, and redirect the user back to where they came from.
purge_all_caches();
Expand All @@ -45,8 +46,6 @@
}

// Otherwise, show a button to actually purge the caches.
admin_externalpage_setup('purgecaches');

$actionurl = new moodle_url('/admin/purgecaches.php', array('sesskey'=>sesskey(), 'confirm'=>1));
if ($returnurl) {
$actionurl->param('returnurl', $returnurl);
Expand Down

0 comments on commit d00007b

Please sign in to comment.