Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402]

   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  namespace core\check\performance;
  18  
  19  use core\check\check;
  20  use core\check\result;
  21  
  22  /**
  23   * Stats check
  24   *
  25   * @package    core
  26   * @category   check
  27   * @copyright  2020 Brendan Heywood <brendan@catalyst-au.net>
  28   * @copyright  2008 petr Skoda
  29   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  30   */
  31  class stats extends check {
  32  
  33      /**
  34       * Get the short check name
  35       *
  36       * @return string
  37       */
  38      public function get_name(): string {
  39          return get_string('stats');
  40      }
  41  
  42      /**
  43       * A link to a place to action this
  44       *
  45       * @return \action_link|null
  46       */
  47      public function get_action_link(): ?\action_link {
  48          return new \action_link(
  49              new \moodle_url('/admin/search.php', ['query' => 'enablestats']),
  50              get_string('enablestats', 'admin'));
  51      }
  52  
  53      /**
  54       * Return result
  55       * @return result
  56       */
  57      public function get_result(): result {
  58          global $CFG;
  59  
  60          if (!empty($CFG->enablestats)) {
  61              $status = result::WARNING;
  62              $summary = get_string('check_enablestats_comment_enable', 'report_performance');
  63          } else {
  64              $status = result::OK;
  65              $summary = get_string('check_enablestats_comment_disable', 'report_performance');
  66          }
  67  
  68          $details = get_string('check_enablestats_details', 'report_performance');
  69          return new result($status, $summary, $details);
  70      }
  71  }
  72