Merge branch 'MDL-35147_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE
[moodle.git] / lib / customcheckslib.php
blob7c63c502f79d48b7879d9c1cde1cf3e87d67db0b
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.
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/>.
17 /**
18 * This is a one-line short description of the file
20 * This library contains a collection of functions able to perform
21 * some custom checks executed by environmental tests (automatically
22 * executed on install & upgrade and under petition in the admin block).
24 * Any function in this library must return:
25 * - null: if the test isn't relevant and must not be showed (ignored)
26 * - environment_results object with the status set to:
27 * - true: if passed
28 * - false: if failed
30 * @package core
31 * @subpackage admin
32 * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com}
33 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36 defined('MOODLE_INTERNAL') || die();
38 /**
39 * This function will look for the risky PHP setting register_globals
40 * in order to inform about. MDL-12914
42 * @param object $result the environment_results object to be modified
43 * @return mixed null if the test is irrelevant or environment_results object with
44 * status set to true (test passed) or false (test failed)
46 function php_check_register_globals($result) {
48 /// Check for register_globals. If enabled, security warning
49 if (ini_get_bool('register_globals')) {
50 $result->status = false;
51 } else {
52 $result = null;
55 return $result;
58 function php_check_php533($result) {
59 if (version_compare(phpversion(), '5.3.3') < 0) {
60 $result->status = false;
61 } else {
62 $result = null;
64 return $result;