Index: trunk/phase3/includes/installer/Installer.php |
— | — | @@ -88,6 +88,7 @@ |
89 | 89 | 'envCheckExtension', |
90 | 90 | 'envCheckShellLocale', |
91 | 91 | 'envCheckUploadsDirectory', |
| 92 | + 'envCheckLibicu' |
92 | 93 | ); |
93 | 94 | |
94 | 95 | /** |
— | — | @@ -812,6 +813,69 @@ |
813 | 814 | } |
814 | 815 | |
815 | 816 | /** |
| 817 | + * Convert a hex string representing a Unicode code point to that code point. |
| 818 | + * @param string $c |
| 819 | + * @return string |
| 820 | + */ |
| 821 | + protected function unicodeChar( $c ) { |
| 822 | + $c = hexdec($c); |
| 823 | + if ($c <= 0x7F) { |
| 824 | + return chr($c); |
| 825 | + } else if ($c <= 0x7FF) { |
| 826 | + return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F); |
| 827 | + } else if ($c <= 0xFFFF) { |
| 828 | + return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F) |
| 829 | + . chr(0x80 | $c & 0x3F); |
| 830 | + } else if ($c <= 0x10FFFF) { |
| 831 | + return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F) |
| 832 | + . chr(0x80 | $c >> 6 & 0x3F) |
| 833 | + . chr(0x80 | $c & 0x3F); |
| 834 | + } else { |
| 835 | + return false; |
| 836 | + } |
| 837 | + } |
| 838 | + |
| 839 | + |
| 840 | + /** |
| 841 | + * Check the libicu version |
| 842 | + */ |
| 843 | + public function envCheckLibicu() { |
| 844 | + $utf8 = function_exists( 'utf8_normalize' ); |
| 845 | + $intl = function_exists( 'normalizer_normalize' ); |
| 846 | + |
| 847 | + /** |
| 848 | + * This needs to be updated something that the latest libicu |
| 849 | + * will properly normalize. This normalization was found at |
| 850 | + * http://www.unicode.org/versions/Unicode5.2.0/#Character_Additions |
| 851 | + * Note that we use the hex representation to create the code |
| 852 | + * points in order to avoid any Unicode-destroying during transite. |
| 853 | + */ |
| 854 | + $not_normal_c = $this->unicodeChar("FA6C"); |
| 855 | + $normal_c = $this->unicodeChar("242EE"); |
| 856 | + |
| 857 | + $useNormalizer = 'config-unicode-php'; |
| 858 | + |
| 859 | + /** |
| 860 | + * We're going to prefer the pecl extension here unless |
| 861 | + * utf8_normalize is more up to date. |
| 862 | + */ |
| 863 | + if( $utf8 ) { |
| 864 | + $utf8 = utf8_normalize( $not_normal_c, UNORM_NFC ); |
| 865 | + $useNormalizer = 'config-unicode-utf8'; |
| 866 | + } |
| 867 | + if( $intl ) { |
| 868 | + $intl = normalizer_normalize( $not_normal_c, Normalizer::FORM_C ); |
| 869 | + $useNormalizer = 'config-unicode-intl'; |
| 870 | + } |
| 871 | + |
| 872 | + $this->showMessage( $useNormalizer ); |
| 873 | + if( $useNormalizer === 'config-unicode-php' ) { |
| 874 | + $this->showMessage( 'config-unicode-pure-php-warning' ); |
| 875 | + } |
| 876 | + } |
| 877 | + |
| 878 | + |
| 879 | + /** |
816 | 880 | * Search a path for any of the given executable names. Returns the |
817 | 881 | * executable name if found. Also checks the version string returned |
818 | 882 | * by each executable. |
Index: trunk/phase3/includes/installer/Installer.i18n.php |
— | — | @@ -79,6 +79,10 @@ |
80 | 80 | 'config-env-latest-old' => "'''Warning:''' You are installing an outdated version of Mediawiki.", |
81 | 81 | 'config-env-latest-help' => 'You are installing version $1, but the latest version is $2. |
82 | 82 | You are advised to use the latest release, which can be downloaded from [http://www.mediawiki.org/wiki/Download mediawiki.org]', |
| 83 | + 'config-unicode-php' => "Using pure PHP to normalize Unicode characters.", |
| 84 | + 'config-unicode-pure-php-warning' => "'''Warning''': Either the PECL Intl extension is not available, or it uses an older version of [http://site.icu-project.org/ the ICU project's] library for handling Unicode normalization. If you run a high-traffic site, you should read a little on [http://www.mediawiki.org/wiki/Unicode_normalization_considerations Unicode normalization].", |
| 85 | + 'config-unicode-utf8' => "Using Brion Vibber's utf8_normalize.so for UTF", |
| 86 | + 'config-unicode-intl' => "Using the [http://pecl.php.net/intl intl PECL extension] for UTF-8 normalization.", |
83 | 87 | 'config-no-db' => 'Could not find a suitable database driver!', |
84 | 88 | 'config-no-db-help' => 'You need to install a database driver for PHP. |
85 | 89 | The following database types are supported: $1. |