Merge "resourceloader: Hard deprecate ResourceLoader::getLessVars"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 30 Sep 2019 00:34:28 +0000 (00:34 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 30 Sep 2019 00:34:28 +0000 (00:34 +0000)
RELEASE-NOTES-1.34
includes/specials/SpecialVersion.php
languages/i18n/en.json
languages/i18n/qqq.json
tests/phpunit/includes/filebackend/FileBackendTest.php

index 0d6f1e1..48fcbaf 100644 (file)
@@ -600,6 +600,10 @@ because of Phabricator reports.
   ApiQueryBlockInfoTrait instead.
 
 === Other changes in 1.34 ===
+* Added option to specify "Various authors" as author in extension credits using
+  "..." as the only author name. If the "author" array contains more than one
+  entry and "..." is one of the entries in the array, "..." will be parsed as
+  "others" (version-poweredby-others i18n message) like previously.
 * …
 
 == Compatibility ==
index fa78cbe..6ad02f0 100644 (file)
@@ -988,7 +988,27 @@ class SpecialVersion extends SpecialPage {
                $linkRenderer = $this->getLinkRenderer();
 
                $list = [];
-               foreach ( (array)$authors as $item ) {
+               $authors = (array)$authors;
+
+               // Special case: if the authors array has only one item and it is "...",
+               // it should not be rendered as the "version-poweredby-others" i18n msg,
+               // but rather as "version-poweredby-various" i18n msg instead.
+               if ( count( $authors ) === 1 && $authors[0] === '...' ) {
+                       // Link to the extension's or skin's AUTHORS or CREDITS file, if there is
+                       // such a file; otherwise just return the i18n msg as-is
+                       if ( $extName && $this->getExtAuthorsFileName( $extDir ) ) {
+                               return $linkRenderer->makeLink(
+                                       $this->getPageTitle( "Credits/$extName" ),
+                                       $this->msg( 'version-poweredby-various' )->text()
+                               );
+                       } else {
+                               return $this->msg( 'version-poweredby-various' )->escaped();
+                       }
+               }
+
+               // Otherwise, if we have an actual array that has more than one item,
+               // process each array item as usual
+               foreach ( $authors as $item ) {
                        if ( $item == '...' ) {
                                $hasOthers = true;
 
index 8092bf6..54f5567 100644 (file)
        "version-poweredby-credits": "This wiki is powered by <strong>[https://www.mediawiki.org/ MediaWiki]</strong>, copyright © 2001-$1 $2.",
        "version-poweredby-others": "others",
        "version-poweredby-translators": "translatewiki.net translators",
+       "version-poweredby-various": "Various authors",
        "version-credits-summary": "We would like to recognize the following persons for their contribution to [[Special:Version|MediaWiki]].",
        "version-license-info": "MediaWiki 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.\n\nMediaWiki is distributed in the hope that it will be useful, but <em>WITHOUT ANY WARRANTY</em>; without even the implied warranty of <strong>MERCHANTABILITY</strong> or <strong>FITNESS FOR A PARTICULAR PURPOSE</strong>. See the GNU General Public License for more details.\n\nYou should have received [{{SERVER}}{{SCRIPTPATH}}/COPYING 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 or [//www.gnu.org/licenses/old-licenses/gpl-2.0.html read it online].",
        "version-software": "Installed software",
index 6b141f9..81d9a8d 100644 (file)
        "version-poweredby-credits": "Message shown on [[Special:Version]]. Parameters:\n* $1 - the current year\n* $2 - a list of selected MediaWiki authors",
        "version-poweredby-others": "Used at the end of {{msg-mw|version-poweredby-credits}} on [[Special:Version]]. First, there's a long list of selected MediaWiki authors, then a comma and then this translation, which is supposed to credit the many other people than developer helping with MediaWiki.\n{{Identical|Other}}",
        "version-poweredby-translators": "Used as label for a link to [[Translating:MediaWiki/Credits]].\n\nPreceded by {{msg-mw|version-poweredby-others}} and {{msg-mw|and}}.\n\nUsed at the end of {{msg-mw|version-poweredby-credits}} on [[Special:Version]].",
+       "version-poweredby-various": "Shown on [[Special:Version]] as an author name if the extension or skin (etc.) credits contain only <code>...</code> which is used to indicate various (unknown or unspecified) authors. See also {{msg-mw|version-poweredby-others}}, which is used when an extension or a skin contains code by various named and unnamed contributors.",
        "version-credits-summary": "Summary of the [[Special:Version/Credits]] sub page, which lists all developers etc. who contributed to MediaWiki. Shown at the top.",
        "version-license-info": "[[wikipedia:GNU GPL|GNU GPL]] notice shown at [[Special:Version]]. See //www.gnu.org/licenses/old-licenses/gpl-2.0-translations.html for available translations.",
        "version-software": "Message shown on [[Special:Version]].\nThis message is followed by the list of installed software (MediaWiki, PHP and MySQL).",
index afa8283..9a7b1e2 100644 (file)
@@ -923,32 +923,129 @@ class FileBackendTest extends MediaWikiTestCase {
                return $cases;
        }
 
-       public function testDoQuickOperations() {
+       /**
+        * @dataProvider provider_quickOperations
+        */
+       public function testDoQuickOperations(
+               $files, $createOps, $copyOps, $moveOps, $overSelfOps, $deleteOps, $batchSize
+       ) {
                $this->backend = $this->singleBackend;
-               $this->doTestDoQuickOperations();
+               $this->doTestDoQuickOperations(
+                       $files, $createOps, $copyOps, $moveOps, $overSelfOps, $deleteOps, $batchSize
+               );
                $this->tearDownFiles();
 
                $this->backend = $this->multiBackend;
-               $this->doTestDoQuickOperations();
+               $this->doTestDoQuickOperations(
+                       $files, $createOps, $copyOps, $moveOps, $overSelfOps, $deleteOps, $batchSize
+               );
                $this->tearDownFiles();
        }
 
-       private function doTestDoQuickOperations() {
+       private function doTestDoQuickOperations(
+               $files, $createOps, $copyOps, $moveOps, $overSelfOps, $deleteOps, $batchSize
+       ) {
                $backendName = $this->backendClass();
 
+               foreach ( $files as $path ) {
+                       $status = $this->prepare( [ 'dir' => dirname( $path ) ] );
+                       $this->assertGoodStatus( $status,
+                               "Preparing $path succeeded without warnings ($backendName)." );
+               }
+
+               foreach ( array_chunk( $createOps, $batchSize ) as $batchOps ) {
+                       $this->assertGoodStatus(
+                               $this->backend->doQuickOperations( $batchOps ),
+                               "Creation of source files succeeded ($backendName)."
+                       );
+               }
+               foreach ( $files as $file ) {
+                       $this->assertTrue(
+                               $this->backend->fileExists( [ 'src' => $file ] ),
+                               "File $file exists."
+                       );
+               }
+
+               foreach ( array_chunk( $copyOps, $batchSize ) as $batchOps ) {
+                       $this->assertGoodStatus(
+                               $this->backend->doQuickOperations( $batchOps ),
+                               "Quick copy of source files succeeded ($backendName)."
+                       );
+               }
+               foreach ( $files as $file ) {
+                       $this->assertTrue(
+                               $this->backend->fileExists( [ 'src' => "$file-2" ] ),
+                               "File $file-2 exists."
+                       );
+               }
+
+               foreach ( array_chunk( $moveOps, $batchSize ) as $batchOps ) {
+                       $this->assertGoodStatus(
+                               $this->backend->doQuickOperations( $batchOps ),
+                               "Quick move of source files succeeded ($backendName)."
+                       );
+               }
+               foreach ( $files as $file ) {
+                       $this->assertTrue(
+                               $this->backend->fileExists( [ 'src' => "$file-3" ] ),
+                               "File $file-3 move in."
+                       );
+                       $this->assertFalse(
+                               $this->backend->fileExists( [ 'src' => "$file-2" ] ),
+                               "File $file-2 moved away."
+                       );
+               }
+
+               foreach ( array_chunk( $overSelfOps, $batchSize ) as $batchOps ) {
+                       $this->assertGoodStatus(
+                               $this->backend->doQuickOperations( $batchOps ),
+                               "Quick copy/move of source files over themselves succeeded ($backendName)."
+                       );
+               }
+               foreach ( $files as $file ) {
+                       $this->assertTrue(
+                               $this->backend->fileExists( [ 'src' => $file ] ),
+                               "File $file still exists after copy/move over self."
+                       );
+               }
+
+               foreach ( array_chunk( $deleteOps, $batchSize ) as $batchOps ) {
+                       $this->assertGoodStatus(
+                               $this->backend->doQuickOperations( $batchOps ),
+                               "Quick deletion of source files succeeded ($backendName)."
+                       );
+               }
+               foreach ( $files as $file ) {
+                       $this->assertFalse( $this->backend->fileExists( [ 'src' => $file ] ),
+                               "File $file purged." );
+                       $this->assertFalse( $this->backend->fileExists( [ 'src' => "$file-3" ] ),
+                               "File $file-3 purged." );
+               }
+       }
+
+       function provider_quickOperations() {
                $base = self::baseStorePath();
                $files = [
                        "$base/unittest-cont1/e/fileA.a",
                        "$base/unittest-cont1/e/fileB.a",
                        "$base/unittest-cont1/e/fileC.a"
                ];
-               $createOps = $copyOps = $moveOps = $deleteOps = [];
+
+               $createOps = $copyOps = $moveOps = $overSelfOps = $deleteOps = [];
                foreach ( $files as $path ) {
-                       $status = $this->prepare( [ 'dir' => dirname( $path ) ] );
-                       $this->assertGoodStatus( $status,
-                               "Preparing $path succeeded without warnings ($backendName)." );
-                       $createOps[] = [ 'op' => 'create', 'dst' => $path, 'content' => mt_rand( 0, 50000 ) ];
+                       $createOps[] = [ 'op' => 'create', 'dst' => $path, 'content' => 52525 ];
+                       $createOps[] = [ 'op' => 'create', 'dst' => "$path-x", 'content' => 832 ];
+                       $createOps[] = [ 'op' => 'null' ];
+
                        $copyOps[] = [ 'op' => 'copy', 'src' => $path, 'dst' => "$path-2" ];
+                       $copyOps[] = [
+                               'op' => 'copy',
+                               'src' => "$path-nothing",
+                               'dst' => "$path-nowhere",
+                               'ignoreMissingSource' => true
+                       ];
+                       $copyOps[] = [ 'op' => 'null' ];
+
                        $moveOps[] = [ 'op' => 'move', 'src' => "$path-2", 'dst' => "$path-3" ];
                        $moveOps[] = [
                                'op' => 'move',
@@ -956,6 +1053,11 @@ class FileBackendTest extends MediaWikiTestCase {
                                'dst' => "$path-nowhere",
                                'ignoreMissingSource' => true
                        ];
+                       $moveOps[] = [ 'op' => 'null' ];
+
+                       $overSelfOps[] = [ 'op' => 'copy', 'src' => $path, 'dst' => $path ];
+                       $overSelfOps[] = [ 'op' => 'move', 'src' => $path, 'dst' => $path ];
+
                        $deleteOps[] = [ 'op' => 'delete', 'src' => $path ];
                        $deleteOps[] = [ 'op' => 'delete', 'src' => "$path-3" ];
                        $deleteOps[] = [
@@ -963,56 +1065,14 @@ class FileBackendTest extends MediaWikiTestCase {
                                'src' => "$path-gone",
                                'ignoreMissingSource' => true
                        ];
-               }
-               $deleteOps[] = [ 'op' => 'null' ];
-
-               $this->assertGoodStatus(
-                       $this->backend->doQuickOperations( $createOps ),
-                       "Creation of source files succeeded ($backendName)." );
-               foreach ( $files as $file ) {
-                       $this->assertTrue( $this->backend->fileExists( [ 'src' => $file ] ),
-                               "File $file exists." );
-               }
-
-               $this->assertGoodStatus(
-                       $this->backend->doQuickOperations( $copyOps ),
-                       "Quick copy of source files succeeded ($backendName)." );
-               foreach ( $files as $file ) {
-                       $this->assertTrue( $this->backend->fileExists( [ 'src' => "$file-2" ] ),
-                               "File $file-2 exists." );
+                       $deleteOps[] = [ 'op' => 'null' ];
                }
 
-               $this->assertGoodStatus(
-                       $this->backend->doQuickOperations( $moveOps ),
-                       "Quick move of source files succeeded ($backendName)." );
-               foreach ( $files as $file ) {
-                       $this->assertTrue( $this->backend->fileExists( [ 'src' => "$file-3" ] ),
-                               "File $file-3 move in." );
-                       $this->assertFalse( $this->backend->fileExists( [ 'src' => "$file-2" ] ),
-                               "File $file-2 moved away." );
-               }
-
-               $this->assertGoodStatus(
-                       $this->backend->quickCopy( [ 'src' => $files[0], 'dst' => $files[0] ] ),
-                       "Copy of file {$files[0]} over itself succeeded ($backendName)." );
-               $this->assertTrue( $this->backend->fileExists( [ 'src' => $files[0] ] ),
-                       "File {$files[0]} still exists." );
-
-               $this->assertGoodStatus(
-                       $this->backend->quickMove( [ 'src' => $files[0], 'dst' => $files[0] ] ),
-                       "Move of file {$files[0]} over itself succeeded ($backendName)." );
-               $this->assertTrue( $this->backend->fileExists( [ 'src' => $files[0] ] ),
-                       "File {$files[0]} still exists." );
-
-               $this->assertGoodStatus(
-                       $this->backend->doQuickOperations( $deleteOps ),
-                       "Quick deletion of source files succeeded ($backendName)." );
-               foreach ( $files as $file ) {
-                       $this->assertFalse( $this->backend->fileExists( [ 'src' => $file ] ),
-                               "File $file purged." );
-                       $this->assertFalse( $this->backend->fileExists( [ 'src' => "$file-3" ] ),
-                               "File $file-3 purged." );
-               }
+               return [
+                       [ $files, $createOps, $copyOps, $moveOps, $overSelfOps, $deleteOps, 1 ],
+                       [ $files, $createOps, $copyOps, $moveOps, $overSelfOps, $deleteOps, 2 ],
+                       [ $files, $createOps, $copyOps, $moveOps, $overSelfOps, $deleteOps, 100 ]
+               ];
        }
 
        /**