Merge "Hard deprecate Language::truncate()"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 13 Jul 2018 17:58:03 +0000 (17:58 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 13 Jul 2018 17:58:03 +0000 (17:58 +0000)
1  2 
RELEASE-NOTES-1.32
languages/Language.php

diff --combined RELEASE-NOTES-1.32
@@@ -23,12 -23,10 +23,12 @@@ production
    the parser allowing them to insert malicious attributes. Disabled by default,
    you can configure this via $wgCSPHeader and $wgCSPReportOnlyHeader.
  * New configuration variable has been added: $wgCookieSetOnIpBlock.
 -  This determines whether to set a cookie when an IP user is blocked. Doing so means
 -  that a blocked user, even after moving to a new IP address, will still be blocked.
 +  This determines whether to set a cookie when an IP user is blocked. Doing so
 +  means that a blocked user, even after moving to a new IP address, will still
 +  be blocked.
  * The archive table's ar_rev_id field is now unique.
  * Special:BotPasswords now requires reauthentication.
 +* (T194414) The default watchlist view time has been increased from 3 to 7 days.
  
  === New features in 1.32 ===
  * (T112474) Generalized the ResourceLoader mechanism for overriding modules
  * Added 'ApiParseMakeOutputPage' hook.
  * (T174313) Added checkbox on Special:ListUsers to display only users in
    temporary user groups.
 -* (T152462) A cookie can now be set when an IP user is blocked to track that user if
 -  they move to a new IP address. This is disabled by default.
 +* (T152462) A cookie can now be set when an IP user is blocked to track that
 +  user if they move to a new IP address. This is disabled by default.
  * (T194950) Added 'ApiMaxLagInfo' hook.
  * SpecialPage::checkLoginSecurityLevel() will now preserve POST data when
    reauthenticating.
  * FormSpecialPage::execute() will now call checkLoginSecurityLevel() if
    getLoginSecurityLevel() returns non-false.
  * The 'ImageBeforeProduceHTML' hook is now passed three new parameters, $parser,
 -  &$query and &$widthOption, allowing extensions even finer control over the resulting
 -  HTML code.
 +  &$query and &$widthOption, allowing extensions even finer control over the
 +  resulting HTML code.
  
  === External library changes in 1.32 ===
  * …
@@@ -181,8 -179,6 +181,8 @@@ because of Phabricator reports
    CapsuleMultiselectWidget. The following methods may no longer be used:
    * setItemsFromData: Use setValue instead
    * getItemsData: Use getItems instead and get the data property
 +* The hook 'LogEventsListGetExtraInputs' now needs a form descriptor array
 +  and not plain HTML.
  
  === Deprecations in 1.32 ===
  * Use of a StartProfiler.php file is deprecated in favour of placing
    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().
  * ResourceLoaderStartUpModule::getStartupModules() and ::getLegacyModules()
    are deprecated. These concepts are obsolete and have no replacement.
  * String type for $lang of DifferenceEngine::setTextLanguage is deprecated.
 +* The following methods of OutputPage are now deprecated in favour
 +  of using showFatalError directly: OutputPage::showFileDeleteError()
 +  OutputPage::showFileNotFoundError(), OutputPage::showFileRenameError()
 +  OutputPage::showFileCopyError() and OutputPage::showUnexpectedValueError().
 +* The Replacer, DoubleReplacer, HashtableReplacer, and RegexlikeReplacer
 +  classes are now deprecated. Use a Closure instead.
  
  === Other changes in 1.32 ===
 +* (T198811) The following tables have had their UNIQUE indexes turned into proper
 +  PRIMARY KEYs for increased maintainability: interwiki, page_props,
 +  protected_titles and site_identifiers.
  * …
  
  == Compatibility ==
diff --combined languages/Language.php
@@@ -1883,14 -1883,6 +1883,14 @@@ class Language 
                        # Add 543 years to the Gregorian calendar
                        # Months and days are identical
                        $gy_offset = $gy + 543;
 +                      # fix for dates between 1912 and 1941
 +                      # https://en.wikipedia.org/?oldid=836596673#New_year
 +                      if ( $gy >= 1912 && $gy <= 1940 ) {
 +                              if ( $gm <= 3 ) {
 +                                      $gy_offset--;
 +                              }
 +                              $gm = ( $gm - 3 ) % 12;
 +                      }
                } elseif ( ( !strcmp( $cName, 'minguo' ) ) || !strcmp( $cName, 'juche' ) ) {
                        # Minguo dates
                        # Deduct 1911 years from the Gregorian calendar
         * @return string
         */
        function truncate( $string, $length, $ellipsis = '...', $adjustLength = true ) {
+               wfDeprecated( __METHOD__, '1.31' );
                return $this->truncateForDatabase( $string, $length, $ellipsis, $adjustLength );
        }
  
         * @return bool
         */
        public function equals( Language $lang ) {
 -              return $lang->getCode() === $this->mCode;
 +              return $lang === $this || $lang->getCode() === $this->mCode;
        }
  
        /**