From: jenkins-bot Date: Tue, 29 May 2018 19:04:27 +0000 (+0000) Subject: Merge "API: ApiBase::getParameter() shouldn't throw on other params' errors" X-Git-Tag: 1.34.0-rc.0~5264 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=e19e52c8e046e98f926936853fda023bf47b67f1;hp=24be43b9aaffa5b723f5074bef10485cf34c3788;p=lhc%2Fweb%2Fwiklou.git Merge "API: ApiBase::getParameter() shouldn't throw on other params' errors" --- diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index bef365393f..b016d0bf5c 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -123,6 +123,9 @@ because of Phabricator reports. The UtfNormal\Utils class from the utfnormal library should be used instead. * The deprecated UTF8_ and UNICODE_ constants were removed. The class constants from the UtfNormal\Constants class from the utfnormal library should be used +* (T140807) The wgResourceLoaderLESSImportPaths configuration option was removed + from ResourceLoader. Instead, use `@import` statements in LESS to import + files directly from nearby directories within the same project. === Deprecations in 1.32 === * Use of a StartProfiler.php file is deprecated in favour of placing @@ -149,6 +152,7 @@ because of Phabricator reports. with the 'unwatch' action parameter instead. * IcuCollation::getICUVersion() is deprecated, as you can just use the PHP constant INTL_ICU_VERSION directly in all versions that MediaWiki supports. +* Parser::fetchFile() is deprecated. Use ::fetchFileAndTitle() instead. === Other changes in 1.32 === * Soft hyphens (U+00AD) are now automatically removed from titles; these diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 1f55d327f3..562d887e17 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3778,23 +3778,6 @@ $wgResourceLoaderLESSVars = [ 'deviceWidthTablet' => '720px', ]; -/** - * Default import paths for LESS modules. LESS files referenced in @import - * statements will be looked up here first, and relative to the importing file - * second. To avoid collisions, it's important for the LESS files in these - * directories to have a common, predictable file name prefix. - * - * Extensions need not (and should not) register paths in - * $wgResourceLoaderLESSImportPaths. The import path includes the path of the - * currently compiling LESS file, which allows each extension to freely import - * files from its own tree. - * - * @since 1.22 - */ -$wgResourceLoaderLESSImportPaths = [ - "$IP/resources/src/mediawiki.less/", -]; - /** * Whether ResourceLoader should attempt to persist modules in localStorage on * browsers that support the Web Storage API. diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 2696f4d27a..dfd9602de3 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -3689,8 +3689,10 @@ class Parser { * @param Title $title * @param array $options Array of options to RepoGroup::findFile * @return File|bool + * @deprecated since 1.32, use fetchFileAndTitle instead */ public function fetchFile( $title, $options = [] ) { + wfDeprecated( __METHOD__, '1.32' ); return $this->fetchFileAndTitle( $title, $options )[0]; } diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 1b8a4a8648..f3b6a70c6d 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -1711,6 +1711,7 @@ MESSAGE; * @return Less_Parser */ public function getLessCompiler( $vars = [] ) { + global $IP; // When called from the installer, it is possible that a required PHP extension // is missing (at least for now; see T49564). If this is the case, throw an // exception (caught by the installer) to prevent a fatal error later on. @@ -1720,9 +1721,9 @@ MESSAGE; $parser = new Less_Parser; $parser->ModifyVars( $vars ); - $parser->SetImportDirs( - array_fill_keys( $this->config->get( 'ResourceLoaderLESSImportPaths' ), '' ) - ); + $parser->SetImportDirs( [ + "$IP/resources/src/mediawiki.less/" => '', + ] ); $parser->SetOption( 'relativeUrls', false ); return $parser; diff --git a/includes/specials/SpecialPasswordPolicies.php b/includes/specials/SpecialPasswordPolicies.php index 415f973525..0a3a6799a5 100644 --- a/includes/specials/SpecialPasswordPolicies.php +++ b/includes/specials/SpecialPasswordPolicies.php @@ -44,7 +44,8 @@ class SpecialPasswordPolicies extends SpecialPage { $out = $this->getOutput(); $out->addModuleStyles( 'mediawiki.special' ); - $this->addHelpLink( 'Help:Password policies' ); + // TODO: Have specific user documentation page for this feature + $this->addHelpLink( 'Manual:$wgPasswordPolicy' ); $out->addHTML( Xml::openElement( 'table', [ 'class' => 'wikitable mw-passwordpolicies-table' ] ) . diff --git a/languages/i18n/en.json b/languages/i18n/en.json index f36c8edb4a..837e3b5007 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -4472,7 +4472,6 @@ "unregistered-user-config": "For security reasons JavaScript, CSS and JSON user subpages cannot be loaded for unregistered users.", "passwordpolicies": "Password policies", "passwordpolicies-summary": "This is a list of the effective password policies for the user groups defined in this wiki.", - "passwordpolicies-helppage": "Manual:$wgPasswordPolicy", "passwordpolicies-group": "Group", "passwordpolicies-policies": "Policies", "passwordpolicies-policy-display": "$1 ($2)", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 417e0f7b7f..139c91c591 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -4671,7 +4671,6 @@ "unregistered-user-config": "Shown when viewing a user JS, CSS or JSON subpage with ?action=raw&ctype= where there is no such user. It is shown as a paragraph after a header saying 'Forbidden'.", "passwordpolicies": "The name of the special page [[Special:PasswordPolicies]].", "passwordpolicies-summary": "The description used on [[Special:PasswordPolicies]].\n\nRefers to {{msg-mw|Passwordpolicies-helppage}}.", - "passwordpolicies-helppage": "The link used on [[Special:PasswordPolicies]].", "passwordpolicies-group": "The title of the column in the table, about user groups (like you are in the ''translator'' group).\n\n{{Identical|Group}}\n{{Related|Passwordpolicies}}", "passwordpolicies-policies": "The title of the column in the table, about password policies.\n{{Related|Passwordpolicies}}", "passwordpolicies-policy-display": "{{optional}}\nParameters:\n* $1 - the text from the \"passwordpolicies-policy-...\" messages, i.e. {{msg-mw|passwordpolicies-policy-minimalpasswordlength}}\n* $2 - the name of this password policy", diff --git a/resources/src/mediawiki.htmlform.ooui.styles.less b/resources/src/mediawiki.htmlform.ooui.styles.less index 61a1c9cc56..0b56df1b00 100644 --- a/resources/src/mediawiki.htmlform.ooui.styles.less +++ b/resources/src/mediawiki.htmlform.ooui.styles.less @@ -6,6 +6,8 @@ @ooui-spacing-medium: 12 / @ooui-font-size-browser / @ooui-font-size-base; // equals `0.8571429em`≈`12px` @ooui-spacing-large: 16 / @ooui-font-size-browser / @ooui-font-size-base; // equals `1.1428571em`≈`16px` +@ooui-padding-horizontal: 12 / @ooui-font-size-browser / @ooui-font-size-base; +@ooui-padding-vertical: 4 / @ooui-font-size-browser / @ooui-font-size-base; // equals `0.285714em`≈`4px` .mw-htmlform-ooui-wrapper.oo-ui-panelLayout-padded { padding: @ooui-spacing-medium @ooui-spacing-large @ooui-spacing-large; @@ -23,11 +25,16 @@ } .mw-htmlform-matrix { - border-spacing: 0; + border-spacing: 0 2px; td { - padding: 0.35em 0.7em; + padding: @ooui-padding-vertical @ooui-padding-horizontal; + text-align: center; .transition( background-color 250ms ); + + &:first-child { + text-align: left; + } } tbody tr:nth-child( even ) td { @@ -40,6 +47,7 @@ tbody tr:first-child td { background-color: #fff; + padding-bottom: 0; } td.first { diff --git a/resources/src/mediawiki.less/mediawiki.mixins.less b/resources/src/mediawiki.less/mediawiki.mixins.less index 53dccc2e07..55be237efe 100644 --- a/resources/src/mediawiki.less/mediawiki.mixins.less +++ b/resources/src/mediawiki.less/mediawiki.mixins.less @@ -1,6 +1,6 @@ // Common Less mixin library for MediaWiki // -// By default the folder containing this file is included in $wgResourceLoaderLESSImportPaths, +// By default the folder containing this file is included in the LESS import paths, // which makes this file importable by all less files via `@import 'mediawiki.mixins';`. // // The mixins included below are considered a public interface for MediaWiki extensions. diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index bffc56ed11..216d7e5d3c 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -62,6 +62,12 @@ Template:Foo FOO !!endarticle +!! article +Template:redirect to foo +!! text +#REDIRECT [[Template:Foo]] +!! endarticle + !! article Template:Blank !! text @@ -1861,6 +1867,17 @@ maxtemplatedepth=1

!! end +!! test +multiple templates that are redirects +!! wikitext +{{redirect to foo}} +{{redirect to foo}} +!! html +

FOO +FOO +

+!! end + !! test Multiple comments should still parse as SOL-transparent !! options diff --git a/tests/phpunit/data/registration/good.json b/tests/phpunit/data/registration/good.json index ad16c5e452..cfad069c17 100644 --- a/tests/phpunit/data/registration/good.json +++ b/tests/phpunit/data/registration/good.json @@ -1,4 +1,12 @@ { "name": "FooBar", - "manifest_version": 1 + "attributes": { + "FooBar": { + "Attr": [ "test" ] + }, + "NotLoaded": { + "Attr": [ "test2" ] + } + }, + "manifest_version": 2 } diff --git a/tests/phpunit/includes/registration/ExtensionRegistryTest.php b/tests/phpunit/includes/registration/ExtensionRegistryTest.php index 67bc088d78..a372c8c26d 100644 --- a/tests/phpunit/includes/registration/ExtensionRegistryTest.php +++ b/tests/phpunit/includes/registration/ExtensionRegistryTest.php @@ -51,6 +51,26 @@ class ExtensionRegistryTest extends MediaWikiTestCase { $registry->loadFromQueue(); } + public function testLoadFromQueue() { + $registry = new ExtensionRegistry(); + $registry->queue( "{$this->dataDir}/good.json" ); + $registry->loadFromQueue(); + $this->assertArrayHasKey( 'FooBar', $registry->getAllThings() ); + $this->assertTrue( $registry->isLoaded( 'FooBar' ) ); + $this->assertSame( [ 'test' ], $registry->getAttribute( 'FooBarAttr' ) ); + $this->assertSame( [], $registry->getAttribute( 'NotLoadedAttr' ) ); + } + + /** + * @expectedException PHPUnit_Framework_Error + */ + public function testReadFromQueue_nonexistent() { + $registry = new ExtensionRegistry(); + $registry->readFromQueue( [ + __DIR__ . '/doesnotexist.json' => 1 + ] ); + } + /** * @dataProvider provideExportExtractedDataGlobals */ diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php index 71a6339536..e0b8c5e03c 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php @@ -8,7 +8,6 @@ class ResourceLoaderTest extends ResourceLoaderTestCase { parent::setUp(); $this->setMwGlobals( [ - 'wgResourceLoaderLESSImportPaths' => [], 'wgResourceLoaderLESSVars' => [ 'foo' => '2px', 'Foo' => '#eeeeee', @@ -737,6 +736,21 @@ mw.example(); $this->assertEquals( $expected, $response, $message ?: 'Response' ); } + /** + * @covers ResourceLoader::makeModuleResponse + */ + public function testMakeModuleResponseEmpty() { + $rl = new EmptyResourceLoader(); + $context = $this->getResourceLoaderContext( + [ 'modules' => '', 'only' => 'scripts' ], + $rl + ); + + $response = $rl->makeModuleResponse( $context, [] ); + $this->assertSame( [], $rl->getErrors(), 'Errors' ); + $this->assertRegExp( '/^\/\*.+no modules were requested.+\*\/$/ms', $response ); + } + /** * Verify that when building module content in a load.php response, * an exception from one module will not break script output from @@ -809,7 +823,7 @@ mw.example(); $this->assertCount( 2, $errors ); $this->assertRegExp( '/Ferry not found/', $errors[0] ); - $this->assertRegExp( '/Problem.+\n\s*"ferry":\s*"error"/m', $errors[1] ); + $this->assertRegExp( '/Problem.+"ferry":\s*"error"/ms', $errors[1] ); $this->assertEquals( '.foo{}.bar{}', $response