Hard deprecate Language::truncate()
authorC. Scott Ananian <cscott@cscott.net>
Wed, 13 Jun 2018 17:49:29 +0000 (13:49 -0400)
committerC. Scott Ananian <cscott@cscott.net>
Mon, 9 Jul 2018 18:07:23 +0000 (14:07 -0400)
This was split into Language::truncateForVisual() (which measures characters)
and Language::truncateForDatabase() (which measures bytes) in 1.31.

Bug: T197492
Change-Id: I949eab4ceb8dcb707b45edf7623e496eb99fe33b

RELEASE-NOTES-1.32
languages/Language.php

index c41e5b5..03dc9af 100644 (file)
@@ -225,6 +225,12 @@ because of Phabricator reports.
   it had unexpected behavior (only marking text if it looked like a URL)
   and was only used in a single place in the code.  Use
   LanguageConverter::markNoConversion() instead.
+* (T197492) Language::truncate() was soft deprecated in 1.31 and is
+  hard deprecated in this release.  It has been split into two similar
+  methods, Language::truncateForVisual() and Language::truncateForDatabase(),
+  which measure length in characters and bytes, respectively.  Use
+  Language::truncateForVisual() when possible to provide equity to users
+  of multibyte scripts.
 * (T176526) EditPage::getContextTitle() falling back to $wgTitle when the
   context title is unset is now deprecated; anything creating an EditPage
   instance should set the context title via ::setContextTitle().
index 3253957..71b3666 100644 (file)
@@ -3489,6 +3489,7 @@ class Language {
         * @return string
         */
        function truncate( $string, $length, $ellipsis = '...', $adjustLength = true ) {
+               wfDeprecated( __METHOD__, '1.31' );
                return $this->truncateForDatabase( $string, $length, $ellipsis, $adjustLength );
        }