From 88ea69f2f7fa33dfc2ab787ed069380f76d4b7ef Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Fri, 25 May 2018 11:47:32 -0700 Subject: [PATCH] Remove deprecated utfnormal back-compat Change-Id: Id8f497d0bbaab8282057c9d271a7c9b1e77d1a3f --- RELEASE-NOTES-1.32 | 5 + includes/Defines.php | 1 - includes/Setup.php | 2 - includes/compat/normal/UtfNormalDefines.php | 186 -------------------- includes/compat/normal/UtfNormalUtil.php | 104 ----------- 5 files changed, 5 insertions(+), 293 deletions(-) delete mode 100644 includes/compat/normal/UtfNormalDefines.php delete mode 100644 includes/compat/normal/UtfNormalUtil.php diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index 146bcc6e73..c1b579afad 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -113,6 +113,11 @@ because of Phabricator reports. any HTMLForm object rather than PreferencesForm. * The non namespaced TimestampException class, deprecated in 1.29, was removed. Use Wikimedia\Timestamp\TimestampException instead. +* The global functions codepointToUtf8, hexSequenceToUtf8, utf8ToHexSequence, + utf8ToCodepoint, and escapeSingleString (deprecated in 1.25) were removed. + The UtfNormal\Utils class from the utfnormal library should be used instead. +* The deprecated UTF8_ and UNICODE_ constants were removed. The class constants + from the UtfNormal\Constants class from the utfnormal library should be used === Deprecations in 1.32 === * Use of a StartProfiler.php file is deprecated in favour of placing diff --git a/includes/Defines.php b/includes/Defines.php index 087af39db4..e5261e7931 100644 --- a/includes/Defines.php +++ b/includes/Defines.php @@ -22,7 +22,6 @@ require_once __DIR__ . '/libs/mime/defines.php'; require_once __DIR__ . '/libs/rdbms/defines.php'; -require_once __DIR__ . '/compat/normal/UtfNormalDefines.php'; use Wikimedia\Rdbms\IDatabase; diff --git a/includes/Setup.php b/includes/Setup.php index 9d7a155d37..f73e686a28 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -627,8 +627,6 @@ define( 'MW_SERVICE_BOOTSTRAP_COMPLETE', 1 ); MWExceptionHandler::installHandler(); -require_once "$IP/includes/compat/normal/UtfNormalUtil.php"; - // T48998: Bail out early if $wgArticlePath is non-absolute foreach ( [ 'wgArticlePath', 'wgVariantArticlePath' ] as $varName ) { if ( $$varName && !preg_match( '/^(https?:\/\/|\/)/', $$varName ) ) { diff --git a/includes/compat/normal/UtfNormalDefines.php b/includes/compat/normal/UtfNormalDefines.php deleted file mode 100644 index 38ce8550a6..0000000000 --- a/includes/compat/normal/UtfNormalDefines.php +++ /dev/null @@ -1,186 +0,0 @@ - - * 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 int $codepoint - * @return string - * @throws InvalidArgumentException if fed out of range data. - * @public - * @deprecated since 1.25, use UtfNormal\Utils directly - */ -function codepointToUtf8( $codepoint ) { - wfDeprecated( __FUNCTION__, '1.25' ); - 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 string $sequence - * @return string - * @throws InvalidArgumentException if fed out of range data. - * @private - * @deprecated since 1.25, use UtfNormal\Utils directly - */ -function hexSequenceToUtf8( $sequence ) { - wfDeprecated( __FUNCTION__, '1.25' ); - 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 ) { - wfDeprecated( __FUNCTION__, '1.25' ); - $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 string $char - * @return int - * @public - * @deprecated since 1.25, use UtfNormal\Utils directly - */ -function utf8ToCodepoint( $char ) { - wfDeprecated( __FUNCTION__, '1.25' ); - 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 ) { - wfDeprecated( __FUNCTION__, '1.25' ); - return Utils::escapeSingleString( $string ); -} -- 2.20.1