Search moodle.org's
Developer Documentation


  • Bug fixes for general core bugs in 3.4.x ended 12 November 2018 (12 months).
  • Bug fixes for security issues in 3.4.x ended 13 May 2019 (18 months).
  • minimum PHP 7.0.0 Note: minimum PHP version has increased since Moodle 3.3. PHP 7.1.x and 7.2.x are supported too. PHP 7.x could have some engine limitations.
  • Differences Between: [Versions 28 and 34] [Versions 29 and 34] [Versions 30 and 34] [Versions 31 and 34] [Versions 32 and 34] [Versions 34 and 36] [Versions 34 and 37]

       1  <?php
       2  // This file is part of Moodle - http://moodle.org/
       3  //
       4  // Moodle is free software: you can redistribute it and/or modify
       5  // it under the terms of the GNU General Public License as published by
       6  // the Free Software Foundation, either version 3 of the License, or
       7  // (at your option) any later version.
       8  //
       9  // Moodle is distributed in the hope that it will be useful,
      10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
      11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12  // GNU General Public License for more details.
      13  //
      14  // You should have received a copy of the GNU General Public License
      15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
      16  
      17  /**
      18   * This script triggers a full purging of system caches,
      19   * this is useful mostly for developers who did not disable the caching.
      20   *
      21   * @package    core
      22   * @copyright  2010 Petr Skoda {@link http://skodak.org}
      23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
      24   */
      25  
      26  require_once('../config.php');
      27  require_once($CFG->libdir.'/adminlib.php');
      28  
      29  $confirm = optional_param('confirm', 0, PARAM_BOOL);
      30  $returnurl = optional_param('returnurl', null, PARAM_LOCALURL);
      31  
      32  admin_externalpage_setup('purgecaches');
      33  
      34  // If we have got here as a confirmed aciton, do it.
      35  if ($confirm && confirm_sesskey()) {
      36  
      37      // Valid request. Purge, and redirect the user back to where they came from.
      38      purge_all_caches();
      39  
      40      if ($returnurl) {
      41          $returnurl = $CFG->wwwroot . $returnurl;
      42      } else {
      43          $returnurl = new moodle_url('/admin/purgecaches.php');
      44      }
      45      redirect($returnurl, get_string('purgecachesfinished', 'admin'));
      46  }
      47  
      48  // Otherwise, show a button to actually purge the caches.
      49  $actionurl = new moodle_url('/admin/purgecaches.php', array('sesskey'=>sesskey(), 'confirm'=>1));
      50  if ($returnurl) {
      51      $actionurl->param('returnurl', $returnurl);
      52  }
      53  
      54  echo $OUTPUT->header();
      55  echo $OUTPUT->heading(get_string('purgecaches', 'admin'));
      56  
      57  echo $OUTPUT->box_start('generalbox', 'notice');
      58  echo html_writer::tag('p', get_string('purgecachesconfirm', 'admin'));
      59  echo $OUTPUT->single_button($actionurl, get_string('purgecaches', 'admin'), 'post');
      60  echo $OUTPUT->box_end();
      61  
      62  echo $OUTPUT->footer();
    

    Search This Site: