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 * Verifies fatal misconfiguration of dataroot 19 * 20 * @package core 21 * @category check 22 * @copyright 2020 Brendan Heywood <brendan@catalyst-au.net> 23 * @copyright 2008 petr Skoda 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 */ 26 27 namespace core\check\environment; 28 29 defined('MOODLE_INTERNAL') || die(); 30 31 use core\check\result; 32 33 /** 34 * Verifies fatal misconfiguration of dataroot 35 * 36 * @copyright 2020 Brendan Heywood <brendan@catalyst-au.net> 37 * @copyright 2008 petr Skoda 38 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 39 */ 40 class unsecuredataroot extends \core\check\check { 41 42 /** 43 * Get the short check name 44 * 45 * @return string 46 */ 47 public function get_name(): string { 48 return get_string('check_unsecuredataroot_name', 'report_security'); 49 } 50 51 /** 52 * Return result 53 * @return result 54 */ 55 public function get_result(): result { 56 57 global $CFG; 58 require_once($CFG->libdir.'/adminlib.php'); 59 60 $details = get_string('check_unsecuredataroot_details', 'report_security'); 61 62 $insecuredataroot = is_dataroot_insecure(true); 63 64 if ($insecuredataroot == INSECURE_DATAROOT_WARNING) { 65 $status = result::ERROR; 66 $summary = get_string('check_unsecuredataroot_warning', 'report_security', $CFG->dataroot); 67 68 } else if ($insecuredataroot == INSECURE_DATAROOT_ERROR) { 69 $status = result::CRITICAL; 70 $summary = get_string('check_unsecuredataroot_error', 'report_security', $CFG->dataroot); 71 72 } else { 73 $status = result::OK; 74 $summary = get_string('check_unsecuredataroot_ok', 'report_security'); 75 } 76 return new result($status, $summary, $details); 77 } 78 } 79 80
title
Description
Body
title
Description
Body
title
Description
Body
title
Body