From 5a21de8abb7f03e72a07d8578babc1835dff4a64 Mon Sep 17 00:00:00 2001 From: Amir Sarabadani Date: Fri, 18 May 2018 16:44:18 +0200 Subject: [PATCH] Remove everything related to CollationFa This workaround was needed when ICU in production was broken but after T189295 this is not needed anymore and we switched off this collation from all Persian Wikis already Bug: T139110 Change-Id: Ifad89555b6ac96a3eb36ca24b55e1f8ee57a1f05 --- RELEASE-NOTES-1.32 | 1 + autoload.php | 1 - includes/collation/Collation.php | 2 - includes/collation/CollationFa.php | 60 ------------------- .../includes/collation/CollationFaTest.php | 55 ----------------- 5 files changed, 1 insertion(+), 118 deletions(-) delete mode 100644 includes/collation/CollationFa.php delete mode 100644 tests/phpunit/includes/collation/CollationFaTest.php diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index c06ba9143a..fe86dee900 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -109,6 +109,7 @@ because of Phabricator reports. * Overriding SearchEngine::{searchText,searchTitle,searchArchiveTitle} in extending classes is deprecated. Extend related doSearch* methods instead. +* CollationFa has been removed completely as it's not needed anymore === Other changes in 1.32 === * … diff --git a/autoload.php b/autoload.php index c55b931235..9e876db955 100644 --- a/autoload.php +++ b/autoload.php @@ -280,7 +280,6 @@ $wgAutoloadLocalClasses = [ 'Collation' => __DIR__ . '/includes/collation/Collation.php', 'CollationCkb' => __DIR__ . '/includes/collation/CollationCkb.php', 'CollationEt' => __DIR__ . '/includes/collation/CollationEt.php', - 'CollationFa' => __DIR__ . '/includes/collation/CollationFa.php', 'CommandLineInc' => __DIR__ . '/maintenance/commandLine.inc', 'CommandLineInstaller' => __DIR__ . '/maintenance/install.php', 'CommentStore' => __DIR__ . '/includes/CommentStore.php', diff --git a/includes/collation/Collation.php b/includes/collation/Collation.php index 30cae5a883..f52dcae017 100644 --- a/includes/collation/Collation.php +++ b/includes/collation/Collation.php @@ -63,8 +63,6 @@ abstract class Collation { return new CollationCkb; case 'xx-uca-et': return new CollationEt; - case 'xx-uca-fa': - return new CollationFa; case 'uppercase-ab': return new AbkhazUppercaseCollation; case 'uppercase-ba': diff --git a/includes/collation/CollationFa.php b/includes/collation/CollationFa.php deleted file mode 100644 index 7410886eca..0000000000 --- a/includes/collation/CollationFa.php +++ /dev/null @@ -1,60 +0,0 @@ - U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE - "\xd8\xa7" => "\xd8\xa3", - // U+0648 ARABIC LETTER WAW => U+0649 ARABIC LETTER ALEF MAKSURA - "\xd9\x88" => "\xd9\x89", - // U+0672 ARABIC LETTER ALEF WITH WAVY HAMZA ABOVE => U+F3001 (private use area) - "\xd9\xb2" => "\xF3\xB3\x80\x81", - // U+0673 ARABIC LETTER ALEF WITH WAVY HAMZA BELOW => U+F3002 (private use area) - "\xd9\xb3" => "\xF3\xB3\x80\x82", - ]; - - public function __construct() { - parent::__construct( 'fa' ); - } - - public function getSortKey( $string ) { - $modified = strtr( $string, $this->override ); - return parent::getSortKey( $modified ); - } - - public function getFirstLetter( $string ) { - if ( isset( $this->override[substr( $string, 0, 2 )] ) ) { - return substr( $string, 0, 2 ); - } - return parent::getFirstLetter( $string ); - } -} diff --git a/tests/phpunit/includes/collation/CollationFaTest.php b/tests/phpunit/includes/collation/CollationFaTest.php deleted file mode 100644 index f7455419ad..0000000000 --- a/tests/phpunit/includes/collation/CollationFaTest.php +++ /dev/null @@ -1,55 +0,0 @@ -checkPHPExtension( 'intl' ); - } - - /** - * @dataProvider provideGetFirstLetter - */ - public function testGetFirstLetter( $letter, $str ) { - $coll = new CollationFa; - $this->assertEquals( $letter, $coll->getFirstLetter( $str ), $str ); - } - - public function provideGetFirstLetter() { - return [ - [ - '۷', - '۷' - ], - [ - 'ا', - 'ا' - ], - [ - 'ا', - 'ایران' - ], - [ - 'ب', - 'برلین' - ], - [ - 'و', - 'واو' - ], - [ "\xd8\xa7", "\xd8\xa7Foo" ], - [ "\xd9\x88", "\xd9\x88Foo" ], - [ "\xd9\xb2", "\xd9\xb2Foo" ], - [ "\xd9\xb3", "\xd9\xb3Foo" ], - ]; - } -} -- 2.20.1