Merge "Fix covers tag in GlobalTest"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 16 Nov 2013 15:08:11 +0000 (15:08 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 16 Nov 2013 15:08:11 +0000 (15:08 +0000)
12 files changed:
RELEASE-NOTES-1.23
includes/content/ContentHandler.php
languages/Language.php
languages/messages/MessagesEn.php
maintenance/archives/patch-val_ip.sql [deleted file]
maintenance/archives/patch-validate.sql [deleted file]
resources/mediawiki.action/mediawiki.action.edit.js
tests/TestsAutoLoader.php
tests/phpunit/languages/LanguageTest.php
tests/phpunit/mocks/media/MockBitmapHandler.php
tests/phpunit/mocks/media/MockImageHandler.php [new file with mode: 0644]
tests/phpunit/mocks/media/MockSvgHandler.php [new file with mode: 0644]

index 8ef5acd..d7c252a 100644 (file)
@@ -73,6 +73,8 @@ changes to languages because of Bugzilla reports.
 ** The rc_type field of recentchanges will be deprecated in a future point
    release.
 * The global variable $wgArticle has been removed after a lengthy deprecation.
+* The global functions addButton and insertTags (for mw.toolbar.addButton and
+  mw.toolbar.insertTags) now emits mw.log.warn when accessed.
 
 == Compatibility ==
 
index 8991290..ede4306 100644 (file)
@@ -350,10 +350,12 @@ abstract class ContentHandler {
         * @param string $name The content model ID, as given by a CONTENT_MODEL_XXX
         *    constant or returned by Revision::getContentModel().
         *
-        * @return string The content format's localized name.
+        * @return string The content model's localized name.
         * @throws MWException if the model id isn't known.
         */
        public static function getLocalizedName( $name ) {
+               // Messages: content-model-wikitext, content-model-text,
+               // content-model-javascript, content-model-css
                $key = "content-model-$name";
 
                $msg = wfMessage( $key );
index 6bbd8bf..2038bac 100644 (file)
@@ -3325,11 +3325,13 @@ class Language {
                                $length -= $eLength;
                                $string = substr( $string, 0, $length ); // xyz...
                                $string = $this->removeBadCharLast( $string );
+                               $string = rtrim( $string );
                                $string = $string . $ellipsis;
                        } else {
                                $length += $eLength;
                                $string = substr( $string, $length ); // ...xyz
                                $string = $this->removeBadCharFirst( $string );
+                               $string = ltrim( $string );
                                $string = $ellipsis . $string;
                        }
                }
index c290e8f..0766cd2 100644 (file)
@@ -915,7 +915,7 @@ $1',
 'disclaimers'          => 'Disclaimers',
 'disclaimerpage'       => 'Project:General disclaimer',
 'edithelp'             => 'Editing help',
-'edithelppage'         => '//www.mediawiki.org/wiki/Special:MyLanguage/Help:Editing_pages', # do not translate or duplicate this message to other languages
+'edithelppage'         => 'https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Editing_pages', # do not translate or duplicate this message to other languages
 'helppage'             => 'Help:Contents',
 'mainpage'             => 'Main Page',
 'mainpage-description' => 'Main page',
@@ -3566,7 +3566,7 @@ In the latter case you can also use a link, for example [[{{#Special:Export}}/{{
 'allmessagesdefault'            => 'Default message text',
 'allmessagescurrent'            => 'Current message text',
 'allmessagestext'               => 'This is a list of system messages available in the MediaWiki namespace.
-Please visit [//www.mediawiki.org/wiki/Localisation MediaWiki Localisation] and [//translatewiki.net translatewiki.net] if you wish to contribute to the generic MediaWiki localisation.',
+Please visit [https://www.mediawiki.org/wiki/Localisation MediaWiki Localisation] and [//translatewiki.net translatewiki.net] if you wish to contribute to the generic MediaWiki localisation.',
 'allmessagesnotsupportedDB'     => "This page cannot be used because '''\$wgUseDatabaseMessages''' has been disabled.",
 'allmessages-filter-legend'     => 'Filter',
 'allmessages-filter'            => 'Filter by customization state:',
@@ -4536,7 +4536,7 @@ $8', # only translate this message to other languages if you have to change it
 
 # External editor support
 'edit-externally'      => 'Edit this file using an external application',
-'edit-externally-help' => '(See the [//www.mediawiki.org/wiki/Manual:External_editors setup instructions] for more information)',
+'edit-externally-help' => '(See the [https://www.mediawiki.org/wiki/Manual:External_editors setup instructions] for more information)',
 
 # 'all' in various places, this might be different for inflected languages
 'watchlistall2' => 'all',
@@ -4851,7 +4851,7 @@ You can also [[Special:EditWatchlist|use the standard editor]].',
 'version-version'                       => '(Version $1)',
 'version-svn-revision'                  => '(r$2)', # only translate this message to other languages if you have to change it
 'version-license'                       => 'License',
-'version-poweredby-credits'             => "This wiki is powered by '''[//www.mediawiki.org/ MediaWiki]''', copyright © 2001-$1 $2.",
+'version-poweredby-credits'             => "This wiki is powered by '''[https://www.mediawiki.org/ MediaWiki]''', copyright © 2001-$1 $2.",
 'version-poweredby-others'              => 'others',
 'version-poweredby-translators'         => 'translatewiki.net translators',
 'version-credits-summary'               => 'We would like to recognize the following persons for their contribution to [[Special:Version|MediaWiki]].',
diff --git a/maintenance/archives/patch-val_ip.sql b/maintenance/archives/patch-val_ip.sql
deleted file mode 100644 (file)
index 9214218..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
--- Column added 2005-05-24
-
-ALTER TABLE /*$wgDBprefix*/validate
-  ADD COLUMN val_ip varchar(20) NOT NULL default '';
diff --git a/maintenance/archives/patch-validate.sql b/maintenance/archives/patch-validate.sql
deleted file mode 100644 (file)
index 9701083..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
--- For article validation
-
-DROP TABLE IF EXISTS /*$wgDBprefix*/validate;
-CREATE TABLE /*$wgDBprefix*/validate (
-  `val_user` int(11) NOT NULL default '0',
-  `val_page` int(11) unsigned NOT NULL default '0',
-  `val_revision` int(11) unsigned NOT NULL default '0',
-  `val_type` int(11) unsigned NOT NULL default '0',
-  `val_value` int(11) default '0',
-  `val_comment` varchar(255) NOT NULL default '',
-  `val_ip` varchar(20) NOT NULL default '',
-  KEY `val_user` (`val_user`,`val_revision`)
-) /*$wgDBTableOptions*/;
index ec923dd..299fabd 100644 (file)
        };
 
        // Legacy (for compatibility with the code previously in skins/common.edit.js)
-       window.addButton = toolbar.addButton;
-       window.insertTags = toolbar.insertTags;
+       mw.log.deprecate( window, 'addButton', toolbar.addButton, 'Use mw.toolbar.addButton instead' );
+       mw.log.deprecate( window, 'insertTags', toolbar.insertTags, 'Use mw.toolbar.insertTags instead' );
 
        // Expose API publicly
        mw.toolbar = toolbar;
index dec8e22..46a894c 100644 (file)
@@ -89,8 +89,8 @@ $wgAutoloadClasses += array(
        'MockFSFile' => "$testDir/phpunit/mocks/filebackend/MockFSFile.php",
        'MockFileBackend' => "$testDir/phpunit/mocks/filebackend/MockFileBackend.php",
        'MockBitmapHandler' => "$testDir/phpunit/mocks/media/MockBitmapHandler.php",
-       'MockImageHandler' => "$testDir/phpunit/mocks/media/MockBitmapHandler.php",
-       'MockSvgHandler' => "$testDir/phpunit/mocks/media/MockBitmapHandler.php",
+       'MockImageHandler' => "$testDir/phpunit/mocks/media/MockImageHandler.php",
+       'MockSvgHandler' => "$testDir/phpunit/mocks/media/MockSvgHandler.php",
 
        # tests/phpunit/languages
        'LanguageClassesTestCase' => "$testDir/phpunit/languages/LanguageClassesTestCase.php",
index 78929e2..aa09def 100644 (file)
@@ -241,6 +241,26 @@ class LanguageTest extends LanguageClassesTestCase {
                        $this->getLang()->truncate( "123456789", -5, 'XXXXXXXXXXXXXXX' ),
                        'truncate suffix, large ellipsis'
                );
+               $this->assertEquals(
+                       "123XXX",
+                       $this->getLang()->truncate( "123                ", 9, 'XXX' ),
+                       'truncate prefix, with spaces'
+               );
+               $this->assertEquals(
+                       "12345XXX",
+                       $this->getLang()->truncate( "12345            8", 11, 'XXX' ),
+                       'truncate prefix, with spaces and non-space ending'
+               );
+               $this->assertEquals(
+                       "XXX234",
+                       $this->getLang()->truncate( "1              234", -8, 'XXX' ),
+                       'truncate suffix, with spaces'
+               );
+               $this->assertEquals(
+                       "12345XXX",
+                       $this->getLang()->truncate( "1234567890", 5, 'XXX', false ),
+                       'truncate without adjustment'
+               );
        }
 
        /**
index 742b41e..38cacf9 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Fake handler for images.
+ * Fake handler for Bitmap images.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,68 +25,8 @@ class MockBitmapHandler extends BitmapHandler {
        function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
                return MockImageHandler::doFakeTransform( $this, $image, $dstPath, $dstUrl, $params, $flags );
        }
+
        function doClientImage( $image, $scalerParams ) {
                        return $this->getClientScalingThumbnailImage( $image, $scalerParams );
        }
 }
-class MockSvgHandler extends SvgHandler {
-       function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
-               return MockImageHandler::doFakeTransform( $this, $image, $dstPath, $dstUrl, $params, $flags );
-       }
-}
-/**
- * Mock handler for images.
- *
- * This is really intended for unit testing.
- *
- * @ingroup Media
- */
-class MockImageHandler {
-
-       /**
-        * Override BitmapHandler::doTransform() making sure we do not generate
-        * a thumbnail at all. That is merely returning a ThumbnailImage that
-        * will be consumed by the unit test.  There is no need to create a real
-        * thumbnail on the filesystem.
-        */
-       static function doFakeTransform( $that, $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
-               # Example of what we receive:
-               # $image: LocalFile
-               # $dstPath: /tmp/transform_7d0a7a2f1a09-1.jpg
-               # $dstUrl : http://example.com/images/thumb/0/09/Bad.jpg/320px-Bad.jpg
-               # $params:  width: 320,  descriptionUrl http://trunk.dev/wiki/File:Bad.jpg
-
-               $that->normaliseParams( $image, $params );
-
-               $scalerParams = array(
-                       # The size to which the image will be resized
-                       'physicalWidth' => $params['physicalWidth'],
-                       'physicalHeight' => $params['physicalHeight'],
-                       'physicalDimensions' => "{$params['physicalWidth']}x{$params['physicalHeight']}",
-                       # The size of the image on the page
-                       'clientWidth' => $params['width'],
-                       'clientHeight' => $params['height'],
-                       # Comment as will be added to the EXIF of the thumbnail
-                       'comment' => isset( $params['descriptionUrl'] ) ?
-                       "File source: {$params['descriptionUrl']}" : '',
-                       # Properties of the original image
-                       'srcWidth' => $image->getWidth(),
-                       'srcHeight' => $image->getHeight(),
-                       'mimeType' => $image->getMimeType(),
-                       'dstPath' => $dstPath,
-                       'dstUrl' => $dstUrl,
-               );
-
-               # In some cases, we do not bother generating a thumbnail.
-               if ( !$image->mustRender() &&
-                       $scalerParams['physicalWidth'] == $scalerParams['srcWidth']
-                       && $scalerParams['physicalHeight'] == $scalerParams['srcHeight']
-               ) {
-                       wfDebug( __METHOD__ . ": returning unscaled image\n" );
-                       // getClientScalingThumbnailImage is protected
-                       return $that->doClientImage( $image, $scalerParams );
-               }
-
-               return new ThumbnailImage( $image, $dstUrl, false, $params );
-       }
-}
diff --git a/tests/phpunit/mocks/media/MockImageHandler.php b/tests/phpunit/mocks/media/MockImageHandler.php
new file mode 100644 (file)
index 0000000..b2f7fac
--- /dev/null
@@ -0,0 +1,79 @@
+<?php
+/**
+ * Fake handler for images.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Media
+ */
+
+/**
+ * Mock handler for images.
+ *
+ * This is really intended for unit testing.
+ *
+ * @ingroup Media
+ */
+class MockImageHandler {
+
+       /**
+        * Override BitmapHandler::doTransform() making sure we do not generate
+        * a thumbnail at all. That is merely returning a ThumbnailImage that
+        * will be consumed by the unit test.  There is no need to create a real
+        * thumbnail on the filesystem.
+        */
+       static function doFakeTransform( $that, $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
+               # Example of what we receive:
+               # $image: LocalFile
+               # $dstPath: /tmp/transform_7d0a7a2f1a09-1.jpg
+               # $dstUrl : http://example.com/images/thumb/0/09/Bad.jpg/320px-Bad.jpg
+               # $params:  width: 320,  descriptionUrl http://trunk.dev/wiki/File:Bad.jpg
+
+               $that->normaliseParams( $image, $params );
+
+               $scalerParams = array(
+                       # The size to which the image will be resized
+                       'physicalWidth' => $params['physicalWidth'],
+                       'physicalHeight' => $params['physicalHeight'],
+                       'physicalDimensions' => "{$params['physicalWidth']}x{$params['physicalHeight']}",
+                       # The size of the image on the page
+                       'clientWidth' => $params['width'],
+                       'clientHeight' => $params['height'],
+                       # Comment as will be added to the EXIF of the thumbnail
+                       'comment' => isset( $params['descriptionUrl'] ) ?
+                                       "File source: {$params['descriptionUrl']}" : '',
+                       # Properties of the original image
+                       'srcWidth' => $image->getWidth(),
+                       'srcHeight' => $image->getHeight(),
+                       'mimeType' => $image->getMimeType(),
+                       'dstPath' => $dstPath,
+                       'dstUrl' => $dstUrl,
+               );
+
+               # In some cases, we do not bother generating a thumbnail.
+               if ( !$image->mustRender() &&
+                       $scalerParams['physicalWidth'] == $scalerParams['srcWidth']
+                       && $scalerParams['physicalHeight'] == $scalerParams['srcHeight']
+               ) {
+                       wfDebug( __METHOD__ . ": returning unscaled image\n" );
+                       // getClientScalingThumbnailImage is protected
+                       return $that->doClientImage( $image, $scalerParams );
+               }
+
+               return new ThumbnailImage( $image, $dstUrl, false, $params );
+       }
+}
diff --git a/tests/phpunit/mocks/media/MockSvgHandler.php b/tests/phpunit/mocks/media/MockSvgHandler.php
new file mode 100644 (file)
index 0000000..21520c4
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Fake handler for SVG images.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Media
+ */
+
+class MockSvgHandler extends SvgHandler {
+       function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
+               return MockImageHandler::doFakeTransform( $this, $image, $dstPath, $dstUrl, $params, $flags );
+       }
+}