From: MatmaRex Date: Fri, 18 Jan 2013 21:36:32 +0000 (+0100) Subject: (bug 43801) add a getter for ICU version to ICUCollation X-Git-Tag: 1.31.0-rc.0~20784^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/categories/modifier.php?a=commitdiff_plain;h=1bcba60f80c1c2d11ae66cf41977d61d2d417cdc;p=lhc%2Fweb%2Fwiklou.git (bug 43801) add a getter for ICU version to ICUCollation It will be necessary to be able to use correct version of Unicode data files. The constant INTL_ICU_VERSION this getter returns isn't really documented. It is available since PHP 5.3.7 (see PHP bug 54561), the getter will fail gracefully on older PHPs. It should be possible to determine the ICU version on these by grepping the output of phpinfo(), but I don't think such a minor improvement is worth such a huge hack. Change-Id: Iee4b8380406ae71c980dfdd7b9fdd0b58ecb9cd0 --- diff --git a/includes/Collation.php b/includes/Collation.php index 3cc7902855..63cfbe18fb 100644 --- a/includes/Collation.php +++ b/includes/Collation.php @@ -374,5 +374,21 @@ class IcuCollation extends Collation { } return false; } + + /** + * Return the version of ICU library used by PHP's intl extension, + * or false when the extension is not installed of the version + * can't be determined. + * + * The constant INTL_ICU_VERSION this function refers to isn't really + * documented. It is available since PHP 5.3.7 (see PHP bug 54561). + * This function will return false on older PHPs. + * + * @since 1.21 + * @return string|false + */ + static function getICUVersion() { + return defined( 'INTL_ICU_VERSION' ) ? INTL_ICU_VERSION : false; + } }