Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Classes | Functions | Variables
environmentlib.php File Reference

This library includes all the necessary stuff to execute some standard tests of required versions and libraries to run Moodle. More...

Classes

class  environment_results
 Helper Class to return results to caller. More...
 

Functions

 check_moodle_environment ($version, $env_select=ENV_SELECT_NEWER)
 This function checks all the requirements defined in environment.xml. More...
 
object environment_check ($version, $env_select)
 This function will check for everything (DB, PHP and PHP extensions for now) returning an array of environment_result objects. More...
 
 environment_check_database ($version, $env_select)
 This function will check if database requirements are satisfied. More...
 
 environment_check_moodle ($version, $env_select)
 This function will check if Moodle requirements are satisfied. More...
 
 environment_check_pcre_unicode ($version, $env_select)
 Looks for buggy PCRE implementation, we need unicode support in Moodle... More...
 
 environment_check_php ($version, $env_select)
 This function will check if php requirements are satisfied. More...
 
 environment_check_php_extensions ($version, $env_select)
 This function will check if php extensions requirements are satisfied. More...
 
 environment_check_php_settings ($version, $env_select)
 This function will check if php extensions requirements are satisfied. More...
 
 environment_check_unicode ($version, $env_select)
 This function will check if unicode database requirements are satisfied. More...
 
 environment_custom_checks ($version, $env_select)
 This function will do the custom checks. More...
 
 environment_get_errors ($environment_results)
 Returns array of critical errors in plain text format. More...
 
 environment_verify_plugin ($plugin, $pluginxml)
 Checks if a plugin tag has a name attribute and it matches the plugin being tested. More...
 
 get_environment_for_version ($version, $env_select)
 This function will return the xmlized data belonging to one Moodle version. More...
 
 get_latest_version_available ($version, $env_select)
 This function will return the most recent version in the environment.xml file previous or equal to the version requested. More...
 
 get_level ($element)
 Here all the restrict functions are coded to be used by the environment checker. More...
 
 get_list_of_environment_versions ($contents)
 This function will return the list of Moodle versions available. More...
 
 load_environment_xml ($env_select=ENV_SELECT_NEWER)
 This function will load the environment.xml file and xmlize it. More...
 
 normalize_version ($version)
 This function will normalize any version to just a serie of numbers separated by dots. More...
 
 process_environment_bypass ($xml, &$result)
 This function will post-process the result record by executing the specified function, modifying it as necessary, also a custom message will be added to the result object to be printed by the display layer. More...
 
 process_environment_messages ($xml, &$result)
 This function will detect if there is some message available to be added to the result in order to clarify enviromental details. More...
 
 process_environment_restrict ($xml, &$result)
 This function will post-process the result record by executing the specified function, modifying it as necessary, also a custom message will be added to the result object to be printed by the display layer. More...
 
 process_environment_result ($element, &$result)
 Once the result has been determined, look in the XML for any messages, or other things that should be done depending on the outcome. More...
 
 restrict_php_version (&$result, $version)
 Check if the current PHP version is greater than or equal to an unsupported version. More...
 
 restrict_php_version_7 (&$result)
 Check if the current PHP version is greater than or equal to PHP version 7. More...
 
 restrict_php_version_71 (&$result)
 Check if the current PHP version is greater than or equal to PHP version 7.1. More...
 
 restrict_php_version_72 (&$result)
 Check if the current PHP version is greater than or equal to PHP version 7.2. More...
 
 restrict_php_version_73 (&$result)
 Check if the current PHP version is greater than or equal to PHP version 7.3. More...
 
 restrict_php_version_74 (&$result)
 Check if the current PHP version is greater than or equal to PHP version 7.4. More...
 

Variables

const CUSTOM_CHECK_FILE_MISSING 13
 XML Processing Error.
 
const CUSTOM_CHECK_FUNCTION_MISSING 14
 XML Processing Error.
 
const ENV_SELECT_DATAROOT 1
 To enforce the use of the file under dataroot.
 
const ENV_SELECT_NEWER 0
 Define algorithm used to select the xml file. More...
 
const ENV_SELECT_RELEASE 2
 To enforce the use of the file under admin (release)
 
const INCORRECT_FEEDBACK_FOR_OPTIONAL 17
 XML Processing Error.
 
const INCORRECT_FEEDBACK_FOR_REQUIRED 16
 XML Processing Error.
 
const NO_CUSTOM_CHECK_FOUND 12
 XML Processing Error.
 
const NO_DATABASE_SECTION_FOUND 2
 XML Processing Error.
 
const NO_DATABASE_VENDOR_MYSQL_FOUND 4
 XML Processing Error.
 
const NO_DATABASE_VENDOR_POSTGRES_FOUND 5
 XML Processing Error.
 
const NO_DATABASE_VENDOR_VERSION_FOUND 10
 XML Processing Error.
 
const NO_DATABASE_VENDORS_FOUND 3
 XML Processing Error.
 
const NO_ERROR 0
 Add required files. More...
 
const NO_PHP_EXTENSIONS_NAME_FOUND 9
 XML Processing Error.
 
const NO_PHP_EXTENSIONS_SECTION_FOUND 8
 XML Processing Error.
 
const NO_PHP_SECTION_FOUND 6
 XML Processing Error.
 
const NO_PHP_SETTINGS_NAME_FOUND 15
 XML Processing Error.
 
const NO_PHP_VERSION_FOUND 7
 XML Processing Error.
 
const NO_UNICODE_SECTION_FOUND 11
 XML Processing Error.
 
const NO_VERSION_DATA_FOUND 1
 XML Processing Error.
 

Detailed Description

This library includes all the necessary stuff to execute some standard tests of required versions and libraries to run Moodle.

It can be used from the admin interface, and both at install and upgrade.

All the info is stored in the admin/environment.xml file, supporting to have an updated version in dataroot/environment

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

@subpackage admin