mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 20:50:21 +01:00
MDL-19071 test PCRE compatibility with unicode characters
This commit is contained in:
parent
aa753ac24f
commit
6c0e5cd193
@ -577,6 +577,11 @@
|
|||||||
</DATABASE>
|
</DATABASE>
|
||||||
<PHP version="5.3.2" level="required">
|
<PHP version="5.3.2" level="required">
|
||||||
</PHP>
|
</PHP>
|
||||||
|
<PCREUNICODE level="optional">
|
||||||
|
<FEEDBACK>
|
||||||
|
<ON_CHECK message="pcreunicodewarning" />
|
||||||
|
</FEEDBACK>
|
||||||
|
</PCREUNICODE>
|
||||||
<PHP_EXTENSIONS>
|
<PHP_EXTENSIONS>
|
||||||
<PHP_EXTENSION name="iconv" level="required">
|
<PHP_EXTENSION name="iconv" level="required">
|
||||||
<FEEDBACK>
|
<FEEDBACK>
|
||||||
@ -670,5 +675,5 @@
|
|||||||
</FEEDBACK>
|
</FEEDBACK>
|
||||||
</PHP_SETTING>
|
</PHP_SETTING>
|
||||||
</PHP_SETTINGS>
|
</PHP_SETTINGS>
|
||||||
</MOODLE>
|
</MOODLE>
|
||||||
</COMPATIBILITY_MATRIX>
|
</COMPATIBILITY_MATRIX>
|
||||||
|
@ -741,6 +741,7 @@ $string['pathtopsqldesc'] = 'This is only necessary to enter if you have more th
|
|||||||
$string['pathtopsqlinvalid'] = 'Invalid path to psql - either wrong path or not executable';
|
$string['pathtopsqlinvalid'] = 'Invalid path to psql - either wrong path or not executable';
|
||||||
$string['pathtounzip'] = 'Path to unzip';
|
$string['pathtounzip'] = 'Path to unzip';
|
||||||
$string['pathtozip'] = 'Path to zip';
|
$string['pathtozip'] = 'Path to zip';
|
||||||
|
$string['pcreunicodewarning'] = 'It is strongly recommended to use PCRE PHP extension that is compatible with Unicode characters.';
|
||||||
$string['perfdebug'] = 'Performance info';
|
$string['perfdebug'] = 'Performance info';
|
||||||
$string['performance'] = 'Performance';
|
$string['performance'] = 'Performance';
|
||||||
$string['pgcluster'] = 'PostgreSQL Cluster';
|
$string['pgcluster'] = 'PostgreSQL Cluster';
|
||||||
|
@ -438,6 +438,10 @@ function environment_check($version, $env_select) {
|
|||||||
$results[] = environment_check_database($version, $env_select);
|
$results[] = environment_check_database($version, $env_select);
|
||||||
$results[] = environment_check_php($version, $env_select);
|
$results[] = environment_check_php($version, $env_select);
|
||||||
|
|
||||||
|
if ($result = environment_check_pcre_unicode($version, $env_select)) {
|
||||||
|
$results[] = $result;
|
||||||
|
}
|
||||||
|
|
||||||
$phpext_results = environment_check_php_extensions($version, $env_select);
|
$phpext_results = environment_check_php_extensions($version, $env_select);
|
||||||
$results = array_merge($results, $phpext_results);
|
$results = array_merge($results, $phpext_results);
|
||||||
|
|
||||||
@ -794,6 +798,46 @@ function environment_check_php($version, $env_select) {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Looks for buggy PCRE implementation, we need unicode support in Moodle...
|
||||||
|
* @param string $version xml version we are going to use to test this server
|
||||||
|
* @param int $env_select one of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use.
|
||||||
|
* @return stdClass results encapsulated in one environment_result object, null if irrelevant
|
||||||
|
*/
|
||||||
|
function environment_check_pcre_unicode($version, $env_select) {
|
||||||
|
$result = new environment_results('pcreunicode');
|
||||||
|
|
||||||
|
// Get the environment version we need
|
||||||
|
if (!$data = get_environment_for_version($version, $env_select)) {
|
||||||
|
// Error. No version data found!
|
||||||
|
$result->setStatus(false);
|
||||||
|
$result->setErrorCode(NO_VERSION_DATA_FOUND);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($data['#']['PCREUNICODE'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$level = get_level($data['#']['PCREUNICODE']['0']);
|
||||||
|
$result->setLevel($level);
|
||||||
|
|
||||||
|
if (!function_exists('preg_match')) {
|
||||||
|
// The extension test fails instead.
|
||||||
|
return null;
|
||||||
|
|
||||||
|
} else if (@preg_match('/\pL/u', 'a') and @preg_match('/á/iu', 'Á')) {
|
||||||
|
$result->setStatus(true);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$result->setStatus(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do any actions defined in the XML file.
|
||||||
|
process_environment_result($data['#']['PCREUNICODE'][0], $result);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function will check if unicode database requirements are satisfied
|
* This function will check if unicode database requirements are satisfied
|
||||||
|
Loading…
x
Reference in New Issue
Block a user