Merge "Fix bad join on ChangeTag subquery"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 22 Oct 2018 17:38:02 +0000 (17:38 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 22 Oct 2018 17:38:02 +0000 (17:38 +0000)
14 files changed:
RELEASE-NOTES-1.33
includes/DefaultSettings.php
includes/Setup.php
includes/filerepo/file/LocalFile.php
includes/installer/WebInstallerDocument.php
includes/installer/WebInstallerOutput.php
includes/installer/WebInstallerWelcome.php
includes/page/Article.php
languages/Language.php
languages/LanguageCode.php
languages/classes/LanguageAr.php
languages/classes/LanguageMl.php
tests/phpunit/languages/classes/LanguageArTest.php
tests/phpunit/languages/classes/LanguageMlTest.php

index 5da6863..d48322e 100644 (file)
@@ -53,6 +53,7 @@ because of Phabricator reports.
 * Skin::doEditSectionLink requires type Language for the parameter $lang.
   The parameters $tooltip and $lang are mandatory. Omitting the parameters is
   deprecated since 1.32.
+* Language::truncate(), deprecated in 1.31, has been removed.
 * …
 
 === Deprecations in 1.33 ===
@@ -60,6 +61,11 @@ because of Phabricator reports.
   to be removed in a future release.
 * The configuration option $wgSquidPurgeUseHostHeader has been deprecated,
   and is expected to be removed in a future release.
+* The configuration options $wgFixArabicUnicode and $wgFixMalayalamUnicode,
+  introduced in MW 1.17, have been deprecated.  These fixes will always be
+  applied for Arabic and Malayalam in the future.  Please enable these on
+  your local wiki (if you have them explicitly set to false) and run
+  maintenance/cleanupTitles.php to fix any existing page titles.
 * …
 
 === Other changes in 1.33 ===
index fa95633..20d965d 100644 (file)
@@ -2999,8 +2999,11 @@ $wgExtraLanguageNames = [];
  * @since 1.29
  */
 $wgExtraLanguageCodes = [
+       // Language codes of macro languages, which get mapped to the main language
        'bh' => 'bho', // Bihari language family
        'no' => 'nb', // Norwegian language family
+
+       // Language variants which get mapped to the main language
        'simple' => 'en', // Simple English
 ];
 
@@ -3019,6 +3022,8 @@ $wgDummyLanguageCodes = [];
  *
  * Note that pages with titles containing presentation forms will become
  * inaccessible, run maintenance/cleanupTitles.php to fix this.
+ *
+ * @deprecated since 1.33: in the future will always be true.
  */
 $wgFixArabicUnicode = true;
 
@@ -3030,6 +3035,8 @@ $wgFixArabicUnicode = true;
  *
  * If you enable this on an existing wiki, run maintenance/cleanupTitles.php to
  * fix any ZWJ sequences in existing page titles.
+ *
+ * @deprecated since 1.33: in the future will always be true.
  */
 $wgFixMalayalamUnicode = true;
 
index bdfce62..aba050d 100644 (file)
@@ -498,11 +498,24 @@ if ( is_array( $wgExtraNamespaces ) ) {
        $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
 }
 
+// Hard-deprecate setting $wgDummyLanguageCodes in LocalSettings.php
+if ( count( $wgDummyLanguageCodes ) !== 0 ) {
+       wfDeprecated( '$wgDummyLanguageCodes', '1.29' );
+}
 // Merge in the legacy language codes, incorporating overrides from the config
 $wgDummyLanguageCodes += [
+       // Internal language codes of the private-use area which get mapped to
+       // themselves.
        'qqq' => 'qqq', // Used for message documentation
        'qqx' => 'qqx', // Used for viewing message keys
 ] + $wgExtraLanguageCodes + LanguageCode::getDeprecatedCodeMapping();
+// Merge in (inverted) BCP 47 mappings
+foreach ( LanguageCode::getNonstandardLanguageCodeMapping() as $code => $bcp47 ) {
+       $bcp47 = strtolower( $bcp47 ); // force case-insensitivity
+       if ( !isset( $wgDummyLanguageCodes[$bcp47] ) ) {
+               $wgDummyLanguageCodes[$bcp47] = $wgDummyLanguageCodes[$code] ?? $code;
+       }
+}
 
 // These are now the same, always
 // To determine the user language, use $wgLang->getCode()
index d22c9a6..ebbc8f8 100644 (file)
@@ -1570,7 +1570,13 @@ class LocalFile extends File {
                                        [ 'image_comment_temp' => [ 'LEFT JOIN', [ 'imgcomment_name = img_name' ] ] ]
                                );
                                foreach ( $res as $row ) {
-                                       $commentStore->insert( $dbw, 'img_description', $row->img_description );
+                                       $imgFields = $commentStore->insert( $dbw, 'img_description', $row->img_description );
+                                       $dbw->update(
+                                               'image',
+                                               $imgFields,
+                                               [ 'img_name' => $row->img_name ],
+                                               __METHOD__
+                                       );
                                }
                        }
 
@@ -2566,7 +2572,13 @@ class LocalFileDeleteBatch {
                                        [ 'image_comment_temp' => [ 'LEFT JOIN', [ 'imgcomment_name = img_name' ] ] ]
                                );
                                foreach ( $res as $row ) {
-                                       $commentStore->insert( $dbw, 'img_description', $row->img_description );
+                                       $imgFields = $commentStore->insert( $dbw, 'img_description', $row->img_description );
+                                       $dbw->update(
+                                               'image',
+                                               $imgFields,
+                                               [ 'img_name' => $row->img_name ],
+                                               __METHOD__
+                                       );
                                }
                        }
 
index 43fe748..f79d272 100644 (file)
@@ -29,7 +29,7 @@ abstract class WebInstallerDocument extends WebInstallerPage {
        public function execute() {
                $text = $this->getFileContents();
                $text = InstallDocFormatter::format( $text );
-               $this->parent->output->addWikiTextInterface( $text );
+               $this->parent->output->addWikiTextAsInterface( $text );
                $this->startForm();
                $this->endForm( false );
        }
index dd76ce9..6c1f2ec 100644 (file)
@@ -89,17 +89,18 @@ class WebInstallerOutput {
 
        /**
         * @param string $text
-        * @deprecated since 1.32; use addWikiTextInterface instead
+        * @deprecated since 1.32; use addWikiTextAsInterface instead
         */
        public function addWikiText( $text ) {
                wfDeprecated( __METHOD__, '1.32' );
-               $this->addWikiTextInterface( $text );
+               $this->addWikiTextAsInterface( $text );
        }
 
        /**
         * @param string $text
+        * @since 1.32
         */
-       public function addWikiTextInterface( $text ) {
+       public function addWikiTextAsInterface( $text ) {
                $this->addHTML( $this->parent->parse( $text ) );
        }
 
index 0d79484..a4f031c 100644 (file)
@@ -30,12 +30,12 @@ class WebInstallerWelcome extends WebInstallerPage {
                                return 'continue';
                        }
                }
-               $this->parent->output->addWikiTextInterface( wfMessage( 'config-welcome' )->plain() );
+               $this->parent->output->addWikiTextAsInterface( wfMessage( 'config-welcome' )->plain() );
                $status = $this->parent->doEnvironmentChecks();
                if ( $status->isGood() ) {
                        $this->parent->output->addHTML( '<span class="success-message">' .
                                wfMessage( 'config-env-good' )->escaped() . '</span>' );
-                       $this->parent->output->addWikiTextInterface( wfMessage( 'config-copyright',
+                       $this->parent->output->addWikiTextAsInterface( wfMessage( 'config-copyright',
                                SpecialVersion::getCopyrightAndAuthorList() )->plain() );
                        $this->startForm();
                        $this->endForm();
index 59d3857..af4f293 100644 (file)
@@ -822,7 +822,7 @@ class Article implements Page {
                $pOutput = ( $outputDone instanceof ParserOutput )
                        // phpcs:ignore MediaWiki.Usage.NestedInlineTernary.UnparenthesizedTernary -- FIXME T203805
                        ? $outputDone // object fetched by hook
-                       : $this->mParserOutput ?: null; // ParserOutput or null, avoid false
+                       : ( $this->mParserOutput ?: null ); // ParserOutput or null, avoid false
 
                # Adjust title for main page & pages with displaytitle
                if ( $pOutput ) {
index fb78f13..e75ea1a 100644 (file)
@@ -3538,28 +3538,6 @@ class Language {
                );
        }
 
-       /**
-        * This method is deprecated since 1.31 and kept as alias for truncateForDatabase, which
-        * has replaced it. This method provides truncation suitable for DB.
-        *
-        * The database offers limited byte lengths for some columns in the database;
-        * multi-byte character sets mean we need to ensure that only whole characters
-        * are included, otherwise broken characters can be passed to the user.
-        *
-        * @deprecated since 1.31, use truncateForDatabase or truncateForVisual as appropriate.
-        *
-        * @param string $string String to truncate
-        * @param int $length Maximum length (including ellipsis)
-        * @param string $ellipsis String to append to the truncated text
-        * @param bool $adjustLength Subtract length of ellipsis from $length.
-        *      $adjustLength was introduced in 1.18, before that behaved as if false.
-        * @return string
-        */
-       function truncate( $string, $length, $ellipsis = '...', $adjustLength = true ) {
-               wfDeprecated( __METHOD__, '1.31' );
-               return $this->truncateForDatabase( $string, $length, $ellipsis, $adjustLength );
-       }
-
        /**
         * Truncate a string to a specified length in bytes, appending an optional
         * string (e.g. for ellipsis)
index b0baec1..1e10496 100644 (file)
@@ -31,9 +31,10 @@ class LanguageCode {
         * Mapping of deprecated language codes that were used in previous
         * versions of MediaWiki to up-to-date, current language codes.
         * These may or may not be valid BCP 47 codes; they are included here
-        * because MediaWiki remapped these particular codes at some point.
+        * because MediaWiki renamed these particular codes at some point.
         *
-        * @var array Mapping from language code to language code
+        * @var array Mapping from deprecated MediaWiki-internal language code
+        *   to replacement MediaWiki-internal language code.
         *
         * @since 1.30
         * @see https://meta.wikimedia.org/wiki/Special_language_codes
@@ -71,7 +72,8 @@ class LanguageCode {
         * `kk-Cyrl` is a valid code, although some validators may emit
         * a warning note.
         *
-        * @var array Mapping from nonstandard codes to BCP 47 codes
+        * @var array Mapping from nonstandard MediaWiki-internal codes to
+        *   BCP 47 codes
         *
         * @since 1.32
         * @see https://meta.wikimedia.org/wiki/Special_language_codes
index f2ce178..24b5e6c 100644 (file)
@@ -45,6 +45,8 @@ class LanguageAr extends Language {
                $s = parent::normalize( $s );
                if ( $wgFixArabicUnicode ) {
                        $s = $this->transformUsingPairFile( 'normalize-ar.php', $s );
+               } else {
+                       wfDeprecated( '$wgFixArabicUnicode = false', '1.33' );
                }
                return $s;
        }
index 176c64c..3dd0d37 100644 (file)
@@ -46,6 +46,8 @@ class LanguageMl extends Language {
                $s = parent::normalize( $s );
                if ( $wgFixMalayalamUnicode ) {
                        $s = $this->transformUsingPairFile( 'normalize-ml.php', $s );
+               } else {
+                       wfDeprecated( '$wgFixMalayalamUnicode = false', '1.33' );
                }
                return $s;
        }
index 296ee60..c7ff3bb 100644 (file)
@@ -34,6 +34,7 @@ class LanguageArTest extends LanguageClassesTestCase {
                $this->assertSame( $expected, $this->getLang()->normalize( $input ), 'ar-normalised form' );
 
                $this->setMwGlobals( 'wgFixArabicUnicode', false );
+               $this->hideDeprecated( '$wgFixArabicUnicode = false' );
                $this->assertSame( $input, $this->getLang()->normalize( $input ), 'regular normalised form' );
        }
 
index 59b7ba8..f5b33e9 100644 (file)
@@ -52,6 +52,7 @@ class LanguageMlTest extends LanguageClassesTestCase {
                $this->assertSame( $expected, $this->getLang()->normalize( $input ), 'ml-normalised form' );
 
                $this->setMwGlobals( 'wgFixMalayalamUnicode', false );
+               $this->hideDeprecated( '$wgFixMalayalamUnicode = false' );
                $this->assertSame( $input, $this->getLang()->normalize( $input ), 'regular normalised form' );
        }