Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.
   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\event;
  18  
  19  defined('MOODLE_INTERNAL') || die();
  20  
  21  /**
  22   * Antivirus scan file error event
  23   *
  24   * @package    core
  25   * @author     Kevin Pham <kevinpham@catalyst-au.net>
  26   * @copyright  Catalyst IT, 2021
  27   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  28   */
  29  class antivirus_scan_file_error extends \core\event\base {
  30      /**
  31       * Event data
  32       */
  33      protected function init() {
  34          $this->data['crud'] = 'c';
  35          $this->data['edulevel'] = self::LEVEL_OTHER;
  36      }
  37  
  38      /**
  39       * Return event description
  40       *
  41       * @return string description
  42       * @throws \coding_exception
  43       */
  44      public function get_description() {
  45          if (isset($this->other['incidentdetails'])) {
  46              return format_text($this->other['incidentdetails'], FORMAT_MOODLE);
  47          } else {
  48              return get_string('fileerrordesc', 'antivirus');
  49          }
  50      }
  51  
  52      /**
  53       * Return event name
  54       *
  55       * @return string name
  56       * @throws \coding_exception
  57       */
  58      public static function get_name() {
  59          return get_string('fileerrorname', 'antivirus');
  60      }
  61  
  62      /**
  63       * Return event report link
  64       * @return \moodle_url
  65       * @throws \moodle_exception
  66       */
  67      public function get_url() {
  68          return new \moodle_url('/report/infectedfiles/index.php');
  69      }
  70  }