Create a subdirectory for compatibility stubs
authorOri Livneh <ori@wikimedia.org>
Sat, 27 Jun 2015 19:54:40 +0000 (12:54 -0700)
committerBryanDavis <bdavis@wikimedia.org>
Mon, 29 Jun 2015 19:27:13 +0000 (19:27 +0000)
Instead of littering includes/ with stub back-compat aliases, house such
classes in includes/compat/.

Change-Id: I4c1b83e35c8d6c18777a4a3e17d81023915cfb7f

15 files changed:
autoload.php
includes/CdbCompat.php [deleted file]
includes/Defines.php
includes/Setup.php
includes/compat/CdbCompat.php [new file with mode: 0644]
includes/compat/normal/.gitignore [new file with mode: 0644]
includes/compat/normal/UtfNormal.php [new file with mode: 0644]
includes/compat/normal/UtfNormalDefines.php [new file with mode: 0644]
includes/compat/normal/UtfNormalUtil.php [new file with mode: 0644]
includes/libs/normal/.gitignore [deleted file]
includes/libs/normal/UtfNormal.php [deleted file]
includes/libs/normal/UtfNormalDefines.php [deleted file]
includes/libs/normal/UtfNormalUtil.php [deleted file]
maintenance/language/generateNormalizerDataAr.php
maintenance/language/generateNormalizerDataMl.php

index 917b022..dcd8727 100644 (file)
@@ -202,9 +202,9 @@ $wgAutoloadLocalClasses = array(
        'CategoryPage' => __DIR__ . '/includes/page/CategoryPage.php',
        'CategoryPager' => __DIR__ . '/includes/specials/SpecialCategories.php',
        'CategoryViewer' => __DIR__ . '/includes/CategoryViewer.php',
-       'CdbException' => __DIR__ . '/includes/CdbCompat.php',
-       'CdbReader' => __DIR__ . '/includes/CdbCompat.php',
-       'CdbWriter' => __DIR__ . '/includes/CdbCompat.php',
+       'CdbException' => __DIR__ . '/includes/compat/CdbCompat.php',
+       'CdbReader' => __DIR__ . '/includes/compat/CdbCompat.php',
+       'CdbWriter' => __DIR__ . '/includes/compat/CdbCompat.php',
        'CgzCopyTransaction' => __DIR__ . '/maintenance/storage/recompressTracked.php',
        'ChangePassword' => __DIR__ . '/maintenance/changePassword.php',
        'ChangeTags' => __DIR__ . '/includes/changetags/ChangeTags.php',
@@ -1307,7 +1307,7 @@ $wgAutoloadLocalClasses = array(
        'UserloginTemplate' => __DIR__ . '/includes/templates/Userlogin.php',
        'UserrightsPage' => __DIR__ . '/includes/specials/SpecialUserrights.php',
        'UsersPager' => __DIR__ . '/includes/specials/SpecialListusers.php',
-       'UtfNormal' => __DIR__ . '/includes/libs/normal/UtfNormal.php',
+       'UtfNormal' => __DIR__ . '/includes/compat/normal/UtfNormal.php',
        'UzConverter' => __DIR__ . '/languages/classes/LanguageUz.php',
        'VFormHTMLForm' => __DIR__ . '/includes/htmlform/VFormHTMLForm.php',
        'ValidateRegistrationFile' => __DIR__ . '/maintenance/validateRegistrationFile.php',
diff --git a/includes/CdbCompat.php b/includes/CdbCompat.php
deleted file mode 100644 (file)
index 0074cc9..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- */
-
-/***
- * This file contains a set of backwards-compatability class names
- * after the cdb functions were moved out into a separate library
- * and put under a proper namespace
- *
- * @since 1.25
- */
-
-/**
- * @deprecated since 1.25
- */
-abstract class CdbReader extends \Cdb\Reader {
-}
-
-/**
- * @deprecated since 1.25
- */
-abstract class CdbWriter extends \Cdb\Writer {
-}
-
-/**
- * @deprecated since 1.25
- */
-class CdbException extends \Cdb\Exception {
-}
index 262471e..d55bbcf 100644 (file)
@@ -198,7 +198,7 @@ define( 'LIST_OR', 4 );
 /**
  * Unicode and normalisation related
  */
-require_once __DIR__ . '/libs/normal/UtfNormalDefines.php';
+require_once __DIR__ . '/compat/normal/UtfNormalDefines.php';
 
 /**@{
  * Hook support constants
index 90fbf61..0c1e99d 100644 (file)
@@ -492,7 +492,7 @@ if ( !class_exists( 'AutoLoader' ) ) {
 
 MWExceptionHandler::installHandler();
 
-require_once "$IP/includes/libs/normal/UtfNormalUtil.php";
+require_once "$IP/includes/compat/normal/UtfNormalUtil.php";
 
 $ps_default2 = Profiler::instance()->scopedProfileIn( $fname . '-defaults2' );
 
diff --git a/includes/compat/CdbCompat.php b/includes/compat/CdbCompat.php
new file mode 100644 (file)
index 0000000..0074cc9
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/***
+ * This file contains a set of backwards-compatability class names
+ * after the cdb functions were moved out into a separate library
+ * and put under a proper namespace
+ *
+ * @since 1.25
+ */
+
+/**
+ * @deprecated since 1.25
+ */
+abstract class CdbReader extends \Cdb\Reader {
+}
+
+/**
+ * @deprecated since 1.25
+ */
+abstract class CdbWriter extends \Cdb\Writer {
+}
+
+/**
+ * @deprecated since 1.25
+ */
+class CdbException extends \Cdb\Exception {
+}
diff --git a/includes/compat/normal/.gitignore b/includes/compat/normal/.gitignore
new file mode 100644 (file)
index 0000000..5af0afa
--- /dev/null
@@ -0,0 +1,6 @@
+/CompositionExclusions.txt
+/DerivedNormalizationProps.txt
+/NormalizationCorrections.txt
+/NormalizationTest.txt
+/UnicodeData.txt
+/testdata
diff --git a/includes/compat/normal/UtfNormal.php b/includes/compat/normal/UtfNormal.php
new file mode 100644 (file)
index 0000000..c9c05a0
--- /dev/null
@@ -0,0 +1,129 @@
+<?php
+/**
+ * Unicode normalization routines
+ *
+ * Copyright © 2004 Brion Vibber <brion@pobox.com>
+ * https://www.mediawiki.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup UtfNormal
+ */
+
+/**
+ * @defgroup UtfNormal UtfNormal
+ */
+
+use UtfNormal\Validator;
+
+/**
+ * Unicode normalization routines for working with UTF-8 strings.
+ * Currently assumes that input strings are valid UTF-8!
+ *
+ * Not as fast as I'd like, but should be usable for most purposes.
+ * UtfNormal::toNFC() will bail early if given ASCII text or text
+ * it can quickly determine is already normalized.
+ *
+ * All functions can be called static.
+ *
+ * See description of forms at http://www.unicode.org/reports/tr15/
+ *
+ * @deprecated since 1.25, use UtfNormal\Validator directly
+ * @ingroup UtfNormal
+ */
+class UtfNormal {
+       /**
+        * The ultimate convenience function! Clean up invalid UTF-8 sequences,
+        * and convert to normal form C, canonical composition.
+        *
+        * Fast return for pure ASCII strings; some lesser optimizations for
+        * strings containing only known-good characters. Not as fast as toNFC().
+        *
+        * @param string $string a UTF-8 string
+        * @return string a clean, shiny, normalized UTF-8 string
+        */
+       static function cleanUp( $string ) {
+               return Validator::cleanUp( $string );
+       }
+
+       /**
+        * Convert a UTF-8 string to normal form C, canonical composition.
+        * Fast return for pure ASCII strings; some lesser optimizations for
+        * strings containing only known-good characters.
+        *
+        * @param string $string a valid UTF-8 string. Input is not validated.
+        * @return string a UTF-8 string in normal form C
+        */
+       static function toNFC( $string ) {
+               return Validator::toNFC( $string );
+       }
+
+       /**
+        * Convert a UTF-8 string to normal form D, canonical decomposition.
+        * Fast return for pure ASCII strings.
+        *
+        * @param string $string a valid UTF-8 string. Input is not validated.
+        * @return string a UTF-8 string in normal form D
+        */
+       static function toNFD( $string ) {
+               return Validator::toNFD( $string );
+       }
+
+       /**
+        * Convert a UTF-8 string to normal form KC, compatibility composition.
+        * This may cause irreversible information loss, use judiciously.
+        * Fast return for pure ASCII strings.
+        *
+        * @param string $string a valid UTF-8 string. Input is not validated.
+        * @return string a UTF-8 string in normal form KC
+        */
+       static function toNFKC( $string ) {
+               return Validator::toNFKC( $string );
+       }
+
+       /**
+        * Convert a UTF-8 string to normal form KD, compatibility decomposition.
+        * This may cause irreversible information loss, use judiciously.
+        * Fast return for pure ASCII strings.
+        *
+        * @param string $string a valid UTF-8 string. Input is not validated.
+        * @return string a UTF-8 string in normal form KD
+        */
+       static function toNFKD( $string ) {
+               return Validator::toNFKD( $string );
+       }
+
+       /**
+        * Returns true if the string is _definitely_ in NFC.
+        * Returns false if not or uncertain.
+        * @param string $string a valid UTF-8 string. Input is not validated.
+        * @return bool
+        */
+       static function quickIsNFC( $string ) {
+               return Validator::quickIsNFC( $string );
+       }
+
+       /**
+        * Returns true if the string is _definitely_ in NFC.
+        * Returns false if not or uncertain.
+        * @param string $string a UTF-8 string, altered on output to be valid UTF-8 safe for XML.
+        * @return bool
+        */
+       static function quickIsNFCVerify( &$string ) {
+               return Validator::quickIsNFCVerify( $string );
+       }
+}
diff --git a/includes/compat/normal/UtfNormalDefines.php b/includes/compat/normal/UtfNormalDefines.php
new file mode 100644 (file)
index 0000000..b8e44c7
--- /dev/null
@@ -0,0 +1,186 @@
+<?php
+/**
+ * Backwards-compatability constants which are now provided by the
+ * UtfNormal library. They are hardcoded here since they are needed
+ * before the composer autoloader is initialized.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup UtfNormal
+ */
+
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UNICODE_HANGUL_FIRST', 0xac00 );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UNICODE_HANGUL_LAST', 0xd7a3 );
+
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UNICODE_HANGUL_LBASE', 0x1100 );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UNICODE_HANGUL_VBASE', 0x1161 );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UNICODE_HANGUL_TBASE', 0x11a7 );
+
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UNICODE_HANGUL_LCOUNT', 19 );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UNICODE_HANGUL_VCOUNT', 21 );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UNICODE_HANGUL_TCOUNT', 28 );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UNICODE_HANGUL_NCOUNT', UNICODE_HANGUL_VCOUNT * UNICODE_HANGUL_TCOUNT );
+
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UNICODE_HANGUL_LEND', UNICODE_HANGUL_LBASE + UNICODE_HANGUL_LCOUNT - 1 );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UNICODE_HANGUL_VEND', UNICODE_HANGUL_VBASE + UNICODE_HANGUL_VCOUNT - 1 );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UNICODE_HANGUL_TEND', UNICODE_HANGUL_TBASE + UNICODE_HANGUL_TCOUNT - 1 );
+
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UNICODE_SURROGATE_FIRST', 0xd800 );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UNICODE_SURROGATE_LAST', 0xdfff );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UNICODE_MAX', 0x10ffff );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UNICODE_REPLACEMENT', 0xfffd );
+
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_HANGUL_FIRST', "\xea\xb0\x80" /*codepointToUtf8( UNICODE_HANGUL_FIRST )*/ );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_HANGUL_LAST', "\xed\x9e\xa3" /*codepointToUtf8( UNICODE_HANGUL_LAST )*/ );
+
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_HANGUL_LBASE', "\xe1\x84\x80" /*codepointToUtf8( UNICODE_HANGUL_LBASE )*/ );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_HANGUL_VBASE', "\xe1\x85\xa1" /*codepointToUtf8( UNICODE_HANGUL_VBASE )*/ );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_HANGUL_TBASE', "\xe1\x86\xa7" /*codepointToUtf8( UNICODE_HANGUL_TBASE )*/ );
+
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_HANGUL_LEND', "\xe1\x84\x92" /*codepointToUtf8( UNICODE_HANGUL_LEND )*/ );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_HANGUL_VEND', "\xe1\x85\xb5" /*codepointToUtf8( UNICODE_HANGUL_VEND )*/ );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_HANGUL_TEND', "\xe1\x87\x82" /*codepointToUtf8( UNICODE_HANGUL_TEND )*/ );
+
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_SURROGATE_FIRST', "\xed\xa0\x80" /*codepointToUtf8( UNICODE_SURROGATE_FIRST )*/ );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_SURROGATE_LAST', "\xed\xbf\xbf" /*codepointToUtf8( UNICODE_SURROGATE_LAST )*/ );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_MAX', "\xf4\x8f\xbf\xbf" /*codepointToUtf8( UNICODE_MAX )*/ );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_REPLACEMENT', "\xef\xbf\xbd" /*codepointToUtf8( UNICODE_REPLACEMENT )*/ );
+#define( 'UTF8_REPLACEMENT', '!' );
+
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_OVERLONG_A', "\xc1\xbf" );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_OVERLONG_B', "\xe0\x9f\xbf" );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_OVERLONG_C', "\xf0\x8f\xbf\xbf" );
+
+# These two ranges are illegal
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_FDD0', "\xef\xb7\x90" /*codepointToUtf8( 0xfdd0 )*/ );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_FDEF', "\xef\xb7\xaf" /*codepointToUtf8( 0xfdef )*/ );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_FFFE', "\xef\xbf\xbe" /*codepointToUtf8( 0xfffe )*/ );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_FFFF', "\xef\xbf\xbf" /*codepointToUtf8( 0xffff )*/ );
+
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_HEAD', false );
+/**
+ * @deprecated since 1.25, use UtfNormal\Constants instead
+ */
+define( 'UTF8_TAIL', true );
diff --git a/includes/compat/normal/UtfNormalUtil.php b/includes/compat/normal/UtfNormalUtil.php
new file mode 100644 (file)
index 0000000..9ed9bc2
--- /dev/null
@@ -0,0 +1,100 @@
+<?php
+/**
+ * Some of these functions are adapted from places in MediaWiki.
+ * Should probably merge them for consistency.
+ *
+ * Copyright © 2004 Brion Vibber <brion@pobox.com>
+ * https://www.mediawiki.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup UtfNormal
+ */
+
+
+use UtfNormal\Utils;
+
+/**
+ * Return UTF-8 sequence for a given Unicode code point.
+ *
+ * @param $codepoint Integer:
+ * @return String
+ * @throws InvalidArgumentException if fed out of range data.
+ * @public
+ * @deprecated since 1.25, use UtfNormal\Utils directly
+ */
+function codepointToUtf8( $codepoint ) {
+       return Utils::codepointToUtf8( $codepoint );
+}
+
+/**
+ * Take a series of space-separated hexadecimal numbers representing
+ * Unicode code points and return a UTF-8 string composed of those
+ * characters. Used by UTF-8 data generation and testing routines.
+ *
+ * @param $sequence String
+ * @return String
+ * @throws InvalidArgumentException if fed out of range data.
+ * @private
+ * @deprecated since 1.25, use UtfNormal\Utils directly
+ */
+function hexSequenceToUtf8( $sequence ) {
+       return Utils::hexSequenceToUtf8( $sequence );
+}
+
+/**
+ * Take a UTF-8 string and return a space-separated series of hex
+ * numbers representing Unicode code points. For debugging.
+ *
+ * @fixme this is private but extensions + maint scripts are using it
+ * @param string $str UTF-8 string.
+ * @return string
+ * @private
+ */
+function utf8ToHexSequence( $str ) {
+       $buf = '';
+       foreach ( preg_split( '//u', $str, -1, PREG_SPLIT_NO_EMPTY ) as $cp ) {
+               $buf .= sprintf( '%04x ', UtfNormal\Utils::utf8ToCodepoint( $cp ) );
+       }
+
+       return rtrim( $buf );
+}
+
+/**
+ * Determine the Unicode codepoint of a single-character UTF-8 sequence.
+ * Does not check for invalid input data.
+ *
+ * @param $char String
+ * @return Integer
+ * @public
+ * @deprecated since 1.25, use UtfNormal\Utils directly
+ */
+function utf8ToCodepoint( $char ) {
+       return Utils::utf8ToCodepoint( $char );
+}
+
+/**
+ * Escape a string for inclusion in a PHP single-quoted string literal.
+ *
+ * @param string $string string to be escaped.
+ * @return String: escaped string.
+ * @public
+ * @deprecated since 1.25, use UtfNormal\Utils directly
+ */
+function escapeSingleString( $string ) {
+       return Utils::escapeSingleString( $string );
+}
diff --git a/includes/libs/normal/.gitignore b/includes/libs/normal/.gitignore
deleted file mode 100644 (file)
index 5af0afa..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/CompositionExclusions.txt
-/DerivedNormalizationProps.txt
-/NormalizationCorrections.txt
-/NormalizationTest.txt
-/UnicodeData.txt
-/testdata
diff --git a/includes/libs/normal/UtfNormal.php b/includes/libs/normal/UtfNormal.php
deleted file mode 100644 (file)
index c9c05a0..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-<?php
-/**
- * Unicode normalization routines
- *
- * Copyright © 2004 Brion Vibber <brion@pobox.com>
- * https://www.mediawiki.org/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup UtfNormal
- */
-
-/**
- * @defgroup UtfNormal UtfNormal
- */
-
-use UtfNormal\Validator;
-
-/**
- * Unicode normalization routines for working with UTF-8 strings.
- * Currently assumes that input strings are valid UTF-8!
- *
- * Not as fast as I'd like, but should be usable for most purposes.
- * UtfNormal::toNFC() will bail early if given ASCII text or text
- * it can quickly determine is already normalized.
- *
- * All functions can be called static.
- *
- * See description of forms at http://www.unicode.org/reports/tr15/
- *
- * @deprecated since 1.25, use UtfNormal\Validator directly
- * @ingroup UtfNormal
- */
-class UtfNormal {
-       /**
-        * The ultimate convenience function! Clean up invalid UTF-8 sequences,
-        * and convert to normal form C, canonical composition.
-        *
-        * Fast return for pure ASCII strings; some lesser optimizations for
-        * strings containing only known-good characters. Not as fast as toNFC().
-        *
-        * @param string $string a UTF-8 string
-        * @return string a clean, shiny, normalized UTF-8 string
-        */
-       static function cleanUp( $string ) {
-               return Validator::cleanUp( $string );
-       }
-
-       /**
-        * Convert a UTF-8 string to normal form C, canonical composition.
-        * Fast return for pure ASCII strings; some lesser optimizations for
-        * strings containing only known-good characters.
-        *
-        * @param string $string a valid UTF-8 string. Input is not validated.
-        * @return string a UTF-8 string in normal form C
-        */
-       static function toNFC( $string ) {
-               return Validator::toNFC( $string );
-       }
-
-       /**
-        * Convert a UTF-8 string to normal form D, canonical decomposition.
-        * Fast return for pure ASCII strings.
-        *
-        * @param string $string a valid UTF-8 string. Input is not validated.
-        * @return string a UTF-8 string in normal form D
-        */
-       static function toNFD( $string ) {
-               return Validator::toNFD( $string );
-       }
-
-       /**
-        * Convert a UTF-8 string to normal form KC, compatibility composition.
-        * This may cause irreversible information loss, use judiciously.
-        * Fast return for pure ASCII strings.
-        *
-        * @param string $string a valid UTF-8 string. Input is not validated.
-        * @return string a UTF-8 string in normal form KC
-        */
-       static function toNFKC( $string ) {
-               return Validator::toNFKC( $string );
-       }
-
-       /**
-        * Convert a UTF-8 string to normal form KD, compatibility decomposition.
-        * This may cause irreversible information loss, use judiciously.
-        * Fast return for pure ASCII strings.
-        *
-        * @param string $string a valid UTF-8 string. Input is not validated.
-        * @return string a UTF-8 string in normal form KD
-        */
-       static function toNFKD( $string ) {
-               return Validator::toNFKD( $string );
-       }
-
-       /**
-        * Returns true if the string is _definitely_ in NFC.
-        * Returns false if not or uncertain.
-        * @param string $string a valid UTF-8 string. Input is not validated.
-        * @return bool
-        */
-       static function quickIsNFC( $string ) {
-               return Validator::quickIsNFC( $string );
-       }
-
-       /**
-        * Returns true if the string is _definitely_ in NFC.
-        * Returns false if not or uncertain.
-        * @param string $string a UTF-8 string, altered on output to be valid UTF-8 safe for XML.
-        * @return bool
-        */
-       static function quickIsNFCVerify( &$string ) {
-               return Validator::quickIsNFCVerify( $string );
-       }
-}
diff --git a/includes/libs/normal/UtfNormalDefines.php b/includes/libs/normal/UtfNormalDefines.php
deleted file mode 100644 (file)
index b8e44c7..0000000
+++ /dev/null
@@ -1,186 +0,0 @@
-<?php
-/**
- * Backwards-compatability constants which are now provided by the
- * UtfNormal library. They are hardcoded here since they are needed
- * before the composer autoloader is initialized.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup UtfNormal
- */
-
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UNICODE_HANGUL_FIRST', 0xac00 );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UNICODE_HANGUL_LAST', 0xd7a3 );
-
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UNICODE_HANGUL_LBASE', 0x1100 );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UNICODE_HANGUL_VBASE', 0x1161 );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UNICODE_HANGUL_TBASE', 0x11a7 );
-
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UNICODE_HANGUL_LCOUNT', 19 );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UNICODE_HANGUL_VCOUNT', 21 );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UNICODE_HANGUL_TCOUNT', 28 );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UNICODE_HANGUL_NCOUNT', UNICODE_HANGUL_VCOUNT * UNICODE_HANGUL_TCOUNT );
-
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UNICODE_HANGUL_LEND', UNICODE_HANGUL_LBASE + UNICODE_HANGUL_LCOUNT - 1 );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UNICODE_HANGUL_VEND', UNICODE_HANGUL_VBASE + UNICODE_HANGUL_VCOUNT - 1 );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UNICODE_HANGUL_TEND', UNICODE_HANGUL_TBASE + UNICODE_HANGUL_TCOUNT - 1 );
-
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UNICODE_SURROGATE_FIRST', 0xd800 );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UNICODE_SURROGATE_LAST', 0xdfff );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UNICODE_MAX', 0x10ffff );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UNICODE_REPLACEMENT', 0xfffd );
-
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_HANGUL_FIRST', "\xea\xb0\x80" /*codepointToUtf8( UNICODE_HANGUL_FIRST )*/ );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_HANGUL_LAST', "\xed\x9e\xa3" /*codepointToUtf8( UNICODE_HANGUL_LAST )*/ );
-
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_HANGUL_LBASE', "\xe1\x84\x80" /*codepointToUtf8( UNICODE_HANGUL_LBASE )*/ );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_HANGUL_VBASE', "\xe1\x85\xa1" /*codepointToUtf8( UNICODE_HANGUL_VBASE )*/ );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_HANGUL_TBASE', "\xe1\x86\xa7" /*codepointToUtf8( UNICODE_HANGUL_TBASE )*/ );
-
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_HANGUL_LEND', "\xe1\x84\x92" /*codepointToUtf8( UNICODE_HANGUL_LEND )*/ );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_HANGUL_VEND', "\xe1\x85\xb5" /*codepointToUtf8( UNICODE_HANGUL_VEND )*/ );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_HANGUL_TEND', "\xe1\x87\x82" /*codepointToUtf8( UNICODE_HANGUL_TEND )*/ );
-
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_SURROGATE_FIRST', "\xed\xa0\x80" /*codepointToUtf8( UNICODE_SURROGATE_FIRST )*/ );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_SURROGATE_LAST', "\xed\xbf\xbf" /*codepointToUtf8( UNICODE_SURROGATE_LAST )*/ );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_MAX', "\xf4\x8f\xbf\xbf" /*codepointToUtf8( UNICODE_MAX )*/ );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_REPLACEMENT', "\xef\xbf\xbd" /*codepointToUtf8( UNICODE_REPLACEMENT )*/ );
-#define( 'UTF8_REPLACEMENT', '!' );
-
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_OVERLONG_A', "\xc1\xbf" );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_OVERLONG_B', "\xe0\x9f\xbf" );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_OVERLONG_C', "\xf0\x8f\xbf\xbf" );
-
-# These two ranges are illegal
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_FDD0', "\xef\xb7\x90" /*codepointToUtf8( 0xfdd0 )*/ );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_FDEF', "\xef\xb7\xaf" /*codepointToUtf8( 0xfdef )*/ );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_FFFE', "\xef\xbf\xbe" /*codepointToUtf8( 0xfffe )*/ );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_FFFF', "\xef\xbf\xbf" /*codepointToUtf8( 0xffff )*/ );
-
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_HEAD', false );
-/**
- * @deprecated since 1.25, use UtfNormal\Constants instead
- */
-define( 'UTF8_TAIL', true );
diff --git a/includes/libs/normal/UtfNormalUtil.php b/includes/libs/normal/UtfNormalUtil.php
deleted file mode 100644 (file)
index 9ed9bc2..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-/**
- * Some of these functions are adapted from places in MediaWiki.
- * Should probably merge them for consistency.
- *
- * Copyright © 2004 Brion Vibber <brion@pobox.com>
- * https://www.mediawiki.org/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup UtfNormal
- */
-
-
-use UtfNormal\Utils;
-
-/**
- * Return UTF-8 sequence for a given Unicode code point.
- *
- * @param $codepoint Integer:
- * @return String
- * @throws InvalidArgumentException if fed out of range data.
- * @public
- * @deprecated since 1.25, use UtfNormal\Utils directly
- */
-function codepointToUtf8( $codepoint ) {
-       return Utils::codepointToUtf8( $codepoint );
-}
-
-/**
- * Take a series of space-separated hexadecimal numbers representing
- * Unicode code points and return a UTF-8 string composed of those
- * characters. Used by UTF-8 data generation and testing routines.
- *
- * @param $sequence String
- * @return String
- * @throws InvalidArgumentException if fed out of range data.
- * @private
- * @deprecated since 1.25, use UtfNormal\Utils directly
- */
-function hexSequenceToUtf8( $sequence ) {
-       return Utils::hexSequenceToUtf8( $sequence );
-}
-
-/**
- * Take a UTF-8 string and return a space-separated series of hex
- * numbers representing Unicode code points. For debugging.
- *
- * @fixme this is private but extensions + maint scripts are using it
- * @param string $str UTF-8 string.
- * @return string
- * @private
- */
-function utf8ToHexSequence( $str ) {
-       $buf = '';
-       foreach ( preg_split( '//u', $str, -1, PREG_SPLIT_NO_EMPTY ) as $cp ) {
-               $buf .= sprintf( '%04x ', UtfNormal\Utils::utf8ToCodepoint( $cp ) );
-       }
-
-       return rtrim( $buf );
-}
-
-/**
- * Determine the Unicode codepoint of a single-character UTF-8 sequence.
- * Does not check for invalid input data.
- *
- * @param $char String
- * @return Integer
- * @public
- * @deprecated since 1.25, use UtfNormal\Utils directly
- */
-function utf8ToCodepoint( $char ) {
-       return Utils::utf8ToCodepoint( $char );
-}
-
-/**
- * Escape a string for inclusion in a PHP single-quoted string literal.
- *
- * @param string $string string to be escaped.
- * @return String: escaped string.
- * @public
- * @deprecated since 1.25, use UtfNormal\Utils directly
- */
-function escapeSingleString( $string ) {
-       return Utils::escapeSingleString( $string );
-}
index ac50d29..d029bf7 100644 (file)
@@ -25,7 +25,7 @@ require_once __DIR__ . '/../Maintenance.php';
 
 /**
  * Generates the normalizer data file for Arabic.
- * For NFC see includes/libs/normal.
+ * For NFC see includes/compat/normal.
  *
  * @ingroup MaintenanceLanguage
  */
index 8580187..770a98c 100644 (file)
@@ -25,7 +25,7 @@ require_once __DIR__ . '/../Maintenance.php';
 
 /**
  * Generates the normalizer data file for Malayalam.
- * For NFC see includes/libs/normal.
+ * For NFC see includes/compat/normal.
  *
  * @ingroup MaintenanceLanguage
  */