Merge "Deprecate $wgFixArabicUnicode / $wgFixMalayalamUnicode"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 22 Oct 2018 17:08:50 +0000 (17:08 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 22 Oct 2018 17:08:50 +0000 (17:08 +0000)
18 files changed:
RELEASE-NOTES-1.33
includes/EditPage.php
includes/FileDeleteForm.php
includes/filerepo/file/LocalFile.php
includes/installer/WebInstallerDocument.php
includes/installer/WebInstallerOutput.php
includes/installer/WebInstallerWelcome.php
includes/page/Article.php
includes/page/ImagePage.php
includes/specials/SpecialEditTags.php
includes/specials/SpecialImport.php
includes/specials/SpecialRevisiondelete.php
includes/specials/SpecialSpecialpages.php
includes/specials/SpecialTags.php
includes/specials/SpecialUndelete.php
includes/specials/SpecialUserrights.php
languages/Language.php
languages/classes/LanguageBe_tarask.php

index 91b53fb..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 ===
index 03b7b45..90db70f 100644 (file)
@@ -1640,11 +1640,7 @@ class EditPage {
                        case self::AS_CANNOT_USE_CUSTOM_MODEL:
                        case self::AS_PARSE_ERROR:
                        case self::AS_UNICODE_NOT_SUPPORTED:
-                               $out->addWikiTextAsInterface(
-                                       '<div class="error">' . "\n" .
-                                       $status->getWikiText() .
-                                       '</div>'
-                               );
+                               $out->wrapWikiTextAsInterface( 'error', $status->getWikiText() );
                                return true;
 
                        case self::AS_SUCCESS_NEW_ARTICLE:
@@ -2995,7 +2991,7 @@ ERROR;
                                        $this->contentFormat,
                                        $ex->getMessage()
                                );
-                               $out->addWikiTextAsInterface( '<div class="error">' . $msg->plain() . '</div>' );
+                               $out->wrapWikiTextAsInterface( 'error', $msg->plain() );
                        }
                }
 
@@ -3470,7 +3466,7 @@ ERROR;
                                        $this->contentFormat,
                                        $ex->getMessage()
                                );
-                               $out->addWikiTextAsInterface( '<div class="error">' . $msg->plain() . '</div>' );
+                               $out->wrapWikiTextAsInterface( 'error', $msg->plain() );
                        }
                }
        }
index f23d6ec..3e0595e 100644 (file)
@@ -120,9 +120,10 @@ class FileDeleteForm {
 
                        if ( !$status->isGood() ) {
                                $wgOut->addHTML( '<h2>' . $this->prepareMessage( 'filedeleteerror-short' ) . "</h2>\n" );
-                               $wgOut->addWikiTextAsInterface( '<div class="error">' .
+                               $wgOut->wrapWikiTextAsInterface(
+                                       'error',
                                        $status->getWikiText( 'filedeleteerror-short', 'filedeleteerror-long' )
-                                       . '</div>' );
+                               );
                        }
                        if ( $status->isOK() ) {
                                $wgOut->setPageTitle( wfMessage( 'actioncomplete' ) );
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 e528929..af4f293 100644 (file)
@@ -792,7 +792,7 @@ class Article implements Page {
                                                        $outputPage->setRobotPolicy( 'noindex,nofollow' );
 
                                                        $errortext = $error->getWikiText( false, 'view-pool-error' );
-                                                       $outputPage->addWikiTextAsInterface( Html::errorBox( $errortext ) );
+                                                       $outputPage->wrapWikiTextAsInterface( 'errorbox', $errortext );
                                                }
                                                # Connection or timeout error
                                                return;
@@ -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 ) {
@@ -2088,8 +2088,9 @@ class Article implements Page {
                        );
 
                        if ( $error == '' ) {
-                               $outputPage->addWikiTextAsInterface(
-                                       "<div class=\"error mw-error-cannotdelete\">\n" . $status->getWikiText() . "\n</div>"
+                               $outputPage->wrapWikiTextAsInterface(
+                                       'error mw-error-cannotdelete',
+                                       $status->getWikiText()
                                );
                                $deleteLogPage = new LogPage( 'delete' );
                                $outputPage->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) );
index 5d4f08e..c879a88 100644 (file)
@@ -539,16 +539,15 @@ class ImagePage extends Article {
                                // to the filename, because it can get copied with it.
                                // See T27277.
                                // phpcs:disable Generic.Files.LineLength
-                               $out->addWikiTextAsInterface( <<<EOT
-<div class="fullMedia"><span class="dangerousLink">{$medialink}</span> $dirmark<span class="fileInfo">$longDesc</span></div>
-<div class="mediaWarning">$warning</div>
+                               $out->wrapWikiTextAsInterface( 'fullMedia', <<<EOT
+<span class="dangerousLink">{$medialink}</span> $dirmark<span class="fileInfo">$longDesc</span>
 EOT
                                );
                                // phpcs:enable
+                               $out->wrapWikiTextAsInterface( 'mediaWarning', $warning );
                        } else {
-                               $out->addWikiTextAsInterface( <<<EOT
-<div class="fullMedia">{$medialink} {$dirmark}<span class="fileInfo">$longDesc</span>
-</div>
+                               $out->wrapWikiTextAsInterface( 'fullMedia', <<<EOT
+{$medialink} {$dirmark}<span class="fileInfo">$longDesc</span>
 EOT
                                );
                        }
@@ -571,10 +570,7 @@ EOT
                                        'file-no-thumb-animation'
                                )->plain();
 
-                               $out->addWikiTextAsInterface( <<<EOT
-<div class="mw-noanimatethumb">{$noAnimMesg}</div>
-EOT
-                               );
+                               $out->wrapWikiTextAsInterface( 'mw-noanimatethumb', $noAnimMesg );
                        }
 
                        if ( !$this->displayImg->isLocal() ) {
index c5914ba..6198a84 100644 (file)
@@ -454,8 +454,8 @@ class SpecialEditTags extends UnlistedSpecialPage {
         */
        protected function failure( $status ) {
                $this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
-               $this->getOutput()->addWikiTextAsInterface(
-                       Html::errorBox( $status->getWikiText( 'tags-edit-failure' ) )
+               $this->getOutput()->wrapWikiTextAsInterface(
+                       'errorbox', $status->getWikiText( 'tags-edit-failure' )
                );
                $this->showForm();
        }
index 12b8d50..839a9bc 100644 (file)
@@ -179,8 +179,9 @@ class SpecialImport extends SpecialPage {
 
                $out = $this->getOutput();
                if ( !$source->isGood() ) {
-                       $out->addWikiTextAsInterface( "<div class=\"error\">\n" .
-                               $this->msg( 'importfailed', $source->getWikiText() )->parse() . "\n</div>" );
+                       $out->wrapWikiTextAsInterface( 'error',
+                               $this->msg( 'importfailed', $source->getWikiText() )->plain()
+                       );
                } else {
                        $importer = new WikiImporter( $source->value, $this->getConfig() );
                        if ( !is_null( $this->namespace ) ) {
index dba4fb8..7661f28 100644 (file)
@@ -641,10 +641,9 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
        protected function failure( $status ) {
                // Messages: revdelete-failure, logdelete-failure
                $this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
-               $this->getOutput()->addWikiTextAsInterface(
-                       Html::errorBox(
-                               $status->getWikiText( $this->typeLabels['failure'] )
-                       )
+               $this->getOutput()->wrapWikiTextAsInterface(
+                       'errorbox',
+                       $status->getWikiText( $this->typeLabels['failure'] )
                );
                $this->showForm();
        }
index 6bb0a1c..585a7cd 100644 (file)
@@ -151,10 +151,9 @@ class SpecialSpecialpages extends UnlistedSpecialPage {
                        $out->wrapWikiMsg(
                                "<h2 class=\"mw-specialpages-note-top\">$1</h2>", 'specialpages-note-top'
                        );
-                       $out->addWikiTextAsInterface(
-                               "<div class=\"mw-specialpages-notes\">\n" .
-                               implode( "\n", $notes ) .
-                               "\n</div>"
+                       $out->wrapWikiTextAsInterface(
+                               'mw-specialpages-notes',
+                               implode( "\n", $notes )
                        );
                }
        }
index 9a9f4f2..ca8ce89 100644 (file)
@@ -321,8 +321,7 @@ class SpecialTags extends SpecialPage {
                        $out->addBacklinkSubtitle( $this->getPageTitle() );
                        return true;
                } else {
-                       $out->addWikiTextAsInterface( "<div class=\"error\">\n" . $status->getWikiText() .
-                               "\n</div>" );
+                       $out->wrapWikiTextAsInterface( 'error', $status->getWikiText() );
                        return false;
                }
        }
@@ -340,8 +339,7 @@ class SpecialTags extends SpecialPage {
                // is the tag actually able to be deleted?
                $canDeleteResult = ChangeTags::canDeleteTag( $tag, $user );
                if ( !$canDeleteResult->isGood() ) {
-                       $out->addWikiTextAsInterface( "<div class=\"error\">\n" . $canDeleteResult->getWikiText() .
-                               "\n</div>" );
+                       $out->wrapWikiTextAsInterface( 'error', $canDeleteResult->getWikiText() );
                        if ( !$canDeleteResult->isOK() ) {
                                return;
                        }
@@ -402,8 +400,7 @@ class SpecialTags extends SpecialPage {
                $func = $activate ? 'canActivateTag' : 'canDeactivateTag';
                $result = ChangeTags::$func( $tag, $user );
                if ( !$result->isGood() ) {
-                       $out->addWikiTextAsInterface( "<div class=\"error\">\n" . $result->getWikiText() .
-                               "\n</div>" );
+                       $out->wrapWikiTextAsInterface( 'error', $result->getWikiText() );
                        if ( !$result->isOK() ) {
                                return;
                        }
@@ -455,8 +452,7 @@ class SpecialTags extends SpecialPage {
                        $out->addReturnTo( $this->getPageTitle() );
                        return true;
                } else {
-                       $out->addWikiTextAsInterface( "<div class=\"error\">\n" . $status->getWikitext() .
-                               "\n</div>" );
+                       $out->wrapWikiTextAsInterface( 'error', $status->getWikitext() );
                        return false;
                }
        }
index be3433f..a93dec0 100644 (file)
@@ -1177,7 +1177,9 @@ class SpecialUndelete extends SpecialPage {
                // Show revision undeletion warnings and errors
                $status = $archive->getRevisionStatus();
                if ( $status && !$status->isGood() ) {
-                       $out->addWikiTextAsInterface( '<div class="error" id="mw-error-cannotundelete">' .
+                       $out->wrapWikiTextAsInterface(
+                               'error',
+                               '<div id="mw-error-cannotundelete">' .
                                $status->getWikiText(
                                        'cannotundelete',
                                        'cannotundelete'
@@ -1188,11 +1190,12 @@ class SpecialUndelete extends SpecialPage {
                // Show file undeletion warnings and errors
                $status = $archive->getFileStatus();
                if ( $status && !$status->isGood() ) {
-                       $out->addWikiTextAsInterface( '<div class="error">' .
+                       $out->wrapWikiTextAsInterface(
+                               'error',
                                $status->getWikiText(
                                        'undelete-error-short',
                                        'undelete-error-long'
-                               ) . '</div>'
+                               )
                        );
                }
        }
index 60f98f1..f63c884 100644 (file)
@@ -189,7 +189,7 @@ class UserrightsPage extends SpecialPage {
                                        return;
                                } else {
                                        // Print an error message and redisplay the form
-                                       $out->addWikiTextAsInterface( '<div class="error">' . $status->getWikiText() . '</div>' );
+                                       $out->wrapWikiTextAsInterface( 'error', $status->getWikiText() );
                                }
                        }
                }
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 07005d4..971cfad 100644 (file)
@@ -28,7 +28,7 @@
  * Belarusian in Taraškievica orthography (Беларуская тарашкевіца)
  *
  * @ingroup Language
- * @see http://be-x-old.wikipedia.org/wiki/Project_talk:LanguageBe_tarask.php
+ * @see https://be-tarask.wikipedia.org/wiki/Project_talk:LanguageBe_tarask.php
  */
 // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
 class LanguageBe_tarask extends Language {