|
Moodle
2.2.1
http://www.collinsharper.com
|
Go to the source code of this file.
XML Processing Error
Definition at line 68 of file environmentlib.php.
XML Processing Error
Definition at line 70 of file environmentlib.php.
| enum ENV_SELECT_DATAROOT |
To enforce the use of the file under dataroot
Definition at line 78 of file environmentlib.php.
| enum ENV_SELECT_NEWER |
Define algorithm used to select the xml file.
To select the newer file available to perform checks
Definition at line 76 of file environmentlib.php.
| enum ENV_SELECT_RELEASE |
To enforce the use of the file under admin (release)
Definition at line 80 of file environmentlib.php.
XML Processing Error
Definition at line 66 of file environmentlib.php.
XML Processing Error
Definition at line 46 of file environmentlib.php.
XML Processing Error
Definition at line 50 of file environmentlib.php.
XML Processing Error
Definition at line 52 of file environmentlib.php.
XML Processing Error
Definition at line 62 of file environmentlib.php.
XML Processing Error
Definition at line 48 of file environmentlib.php.
| enum NO_ERROR |
Add required files.
Include the necessary Define a bunch of XML processing errors XML Processing Error
Definition at line 42 of file environmentlib.php.
XML Processing Error
Definition at line 60 of file environmentlib.php.
XML Processing Error
Definition at line 58 of file environmentlib.php.
| enum NO_PHP_SECTION_FOUND |
XML Processing Error
Definition at line 54 of file environmentlib.php.
XML Processing Error
Definition at line 72 of file environmentlib.php.
| enum NO_PHP_VERSION_FOUND |
XML Processing Error
Definition at line 56 of file environmentlib.php.
XML Processing Error
Definition at line 64 of file environmentlib.php.
XML Processing Error
Definition at line 44 of file environmentlib.php.
| bypass_mysql416_reqs | ( | $ | result | ) |
Here all the bypass functions are coded to be used by the environment checker. All those functions will receive the result object and will return it modified as needed (status and bypass string) This function will bypass MySQL 4.1.16 reqs if:
| object | result object to handle |
See if we are running MySQL >= 4.1.12
Definition at line 1337 of file environmentlib.php.
| check_moodle_environment | ( | $ | version, |
| $ | env_select = ENV_SELECT_NEWER |
||
| ) |
This function checks all the requirements defined in environment.xml.
bool $result array $env_results bool $cache_exists
| string | $version | version to check. |
| int | $env_select | one of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. Default ENV_SELECT_NEWER (BC) |
This are cached per request
if we have results cached, use them
No cache exists, calculate everything
Get the more recent version before the requested
Perform all the checks
Iterate over all the results looking for some error in required items or some error_code
Going to end, we store environment_results to cache
End of cache block
Definition at line 95 of file environmentlib.php.


| 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.
object
| string | $version | xml version we are going to use to test this server |
| int | $env_select | one of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. |
Normalize the version requested
Only run the moodle versions checker on upgrade, not on install
Definition at line 425 of file environmentlib.php.


| environment_check_database | ( | $ | version, |
| $ | env_select | ||
| ) |
This function will check if database requirements are satisfied
object NO_VERSION_DATA_FOUND NO_DATABASE_SECTION_FOUND NO_DATABASE_VENDORS_FOUND NO_DATABASE_VENDOR_MYSQL_FOUND NO_DATABASE_VENDOR_POSTGRES_FOUND NO_DATABASE_VENDOR_VERSION_FOUND
| string | $version | xml version we are going to use to test this server |
| int | $env_select | one of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. |
Get the enviroment version we need
Error. No version data found
Extract the database part
Error. No DATABASE section found
Extract level
Extract DB vendors. At least 2 are mandatory (mysql & postgres)
Error. No VENDORS found
Extract vendors
Check we have the mysql vendor version
Check we have the postgres vendor version
Now search the version we are using (depending of vendor)
Check we have a needed version
And finally compare them, saving results
Do any actions defined in the XML file.
Definition at line 856 of file environmentlib.php.


| environment_check_moodle | ( | $ | version, |
| $ | env_select | ||
| ) |
This function will check if Moodle requirements are satisfied
NO_VERSION_DATA_FOUND
| string | $version | xml version we are going to use to test this server |
| int | $env_select | one of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. |
Get the enviroment version we need
Error. No version data found
Extract the moodle part
Default to 1.0 if no moodle requires is found
Extract required moodle version
Now search the version we are using
And finally compare them, saving results
Definition at line 697 of file environmentlib.php.


| environment_check_php | ( | $ | version, |
| $ | env_select | ||
| ) |
This function will check if php requirements are satisfied
NO_VERSION_DATA_FOUND NO_PHP_SECTION_FOUND NO_PHP_VERSION_FOUND
| string | $version | xml version we are going to use to test this server |
| int | $env_select | one of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. |
Get the enviroment version we need
Error. No version data found
Extract the php part
Error. No PHP section found
Extract level and version
Now search the version we are using
And finally compare them, saving results
Do any actions defined in the XML file.
Definition at line 743 of file environmentlib.php.


| environment_check_php_extensions | ( | $ | version, |
| $ | env_select | ||
| ) |
This function will check if php extensions requirements are satisfied
NO_VERSION_DATA_FOUND NO_PHP_EXTENSIONS_SECTION_FOUND NO_PHP_EXTENSIONS_NAME_FOUND
| string | $version | xml version we are going to use to test this server |
| int | $env_select | one of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. |
Get the enviroment version we need
Error. No version data found
Extract the php_extension part
Error. No PHP section found
Iterate over extensions checking them and creating the needed environment_results
Check for level
Check for extension name
The name exists. Just check if it's an installed extension
Do any actions defined in the XML file.
Add the result to the array of results
Definition at line 464 of file environmentlib.php.


| environment_check_php_settings | ( | $ | version, |
| $ | env_select | ||
| ) |
This function will check if php extensions requirements are satisfied
NO_VERSION_DATA_FOUND NO_PHP_SETTINGS_NAME_FOUND
| string | $version | xml version we are going to use to test this server |
| int | $env_select | one of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. |
Get the enviroment version we need
Error. No version data found
Extract the php_setting part
No PHP section found - ignore
Iterate over settings checking them and creating the needed environment_results
Check for level
Check for extension name
The name exists. Just check if it's an installed extension
Do any actions defined in the XML file.
Add the result to the array of results
Definition at line 526 of file environmentlib.php.


| environment_check_unicode | ( | $ | version, |
| $ | env_select | ||
| ) |
This function will check if unicode database requirements are satisfied
object NO_VERSION_DATA_FOUND NO_UNICODE_SECTION_FOUND
| string | $version | xml version we are going to use to test this server |
| int | $env_select | one of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. |
Get the enviroment version we need
Error. No version data found
Extract the unicode part
Error. No UNICODE section found
Extract level
Do any actions defined in the XML file.
Definition at line 803 of file environmentlib.php.


| environment_custom_checks | ( | $ | version, |
| $ | env_select | ||
| ) |
This function will do the custom checks.
object CUSTOM_CHECK_FUNCTION_MISSING CUSTOM_CHECK_FILE_MISSING NO_CUSTOM_CHECK_FOUND
| string | $version | xml version we are going to use to test this server. |
| int | $env_select | one of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. |
Get current Moodle version (release) for later compare
In case $CFG fails (at install) use $version
Get the enviroment version we need
Error. No version data found - but this will already have been reported.
Extract the CUSTOM_CHECKS part
No custom checks found - not a problem
Iterate over extensions checking them and creating the needed environment_results
Check for level
Check for extension name
Only show error for current version (where function MUST exist) else, we are performing custom checks against future versiosn and function MAY not exist, so it doesn't cause error, just skip custom check by returning null. MDL-15939
Only show error for current version (where function MUST exist) else, we are performing custom checks against future versiosn and function MAY not exist, so it doesn't cause error, just skip custom check by returning null. MDL-15939
Do any actions defined in the XML file.
Add the result to the array of results
Definition at line 608 of file environmentlib.php.


| environment_get_errors | ( | $ | environment_results | ) |
Returns array of critical errors in plain text format
| array | $environment_results | array of results gathered |
Calculate the status value
Definition at line 148 of file environmentlib.php.


| get_environment_for_version | ( | $ | version, |
| $ | env_select | ||
| ) |
This function will return the xmlized data belonging to one Moodle version
| string | $version | top version from which we start to look backwards |
| int | $env_select | one of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. |
Normalize the version requested
Load xml file
Detect available versions
If the version requested is available
We now we have it. Extract from full contents.
Definition at line 389 of file environmentlib.php.


| 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
| string | $version | top version from which we start to look backwards |
| int | $env_select | one of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. |
Normalize the version requested
Load xml file
Detect available versions
First we look for exact version
Not exact match, so we are going to iterate over the list searching for the latest version before the requested one
Definition at line 350 of file environmentlib.php.


| get_level | ( | $ | element | ) |
| array | $element | the element from the environment.xml file that should have either a level="required" or level="optional" attribute. |
Definition at line 1370 of file environmentlib.php.


| get_list_of_environment_versions | ( | $ | contents | ) |
This function will return the list of Moodle versions available
array $versions
Definition at line 324 of file environmentlib.php.

| load_environment_xml | ( | $ | env_select = ENV_SELECT_NEWER | ) |
This function will load the environment.xml file and xmlize it
object mixed $data ENV_SELECT_NEWER ENV_SELECT_DATAROOT ENV_SELECT_RELEASE
| int | $env_select | one of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. Default ENV_SELECT_NEWER (BC) |
First of all, take a look inside $CFG->dataroot/environment/environment.xml
Fallback to fixed $CFG->admin/environment.xml
XML the whole file
Definition at line 277 of file environmentlib.php.


| normalize_version | ( | $ | version | ) |
This function will normalize any version to just a serie of numbers separated by dots. Everything else will be removed.
| string | $version | the original version |
1.9 Beta 2 should be read 1.9 on enviromental checks, not 1.9.2 we can discard everything after the first space
Replace everything but numbers and dots by dots
Combine multiple dots in one
Trim possible leading and trailing dots
Definition at line 246 of file environmentlib.php.

| 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. Every bypass function must be defined in this file and it'll return true/false to decide if the original test is bypassed or no. Also such bypass functions are able to directly handling the result object although it should be only under exceptional conditions.
| string | xmldata containing the bypass data |
| object | result object to be updated |
Only try to bypass if we were in error and it was required
It there is bypass info (function and message)
Look for the function
Call it, and if bypass = true is returned, apply meesage
We only set the bypass message if the function itself hasn't defined it before
Definition at line 956 of file environmentlib.php.

| 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.
| string | xmldata containing the feedback data |
| object | reult object to be updated |
If there is feedback info
Definition at line 1023 of file environmentlib.php.

| 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. Every restrict function must be defined in this file and it'll return true/false to decide if the original test is restricted or no. Also such restrict functions are able to directly handling the result object although it should be only under exceptional conditions.
| string | xmldata containing the restrict data |
| object | result object to be updated |
Only try to restrict if we were not in error and it was required
It there is restrict info (function and message)
Look for the function
Call it, and if restrict = true is returned, apply meesage
We only set the restrict message if the function itself hasn't defined it before
Definition at line 993 of file environmentlib.php.

| 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.
| array | $element | the element from the environment.xml file which may have children defining what should be done with the outcome. |
| object | $result | the result of the test, which may be modified by this function as specified in the XML. |
Process messages, modifying the $result if needed.
Process bypass, modifying $result if needed.
Process restrict, modifying $result if needed.
Definition at line 1393 of file environmentlib.php.


| restrict_php50_version | ( | $ | result | ) |
Here all the restrict functions are coded to be used by the environment checker. All those functions will receive the result object and will return it modified as needed (status and bypass string) This function will restrict PHP reqs if:
| object | $result | object to handle |
Definition at line 1357 of file environmentlib.php.