Commit graph

8225 commits

Author SHA1 Message Date
Holger Knust
f60d04d3ea resourceloader: Add test to validate existence of ImageModule "images" files
New data provider and test method were added to ensure file paths are correct and the file is present.

Bug: T231430
Change-Id: Iadafe0df1104de8829ea87632d65b3008cf80d76
2020-02-12 14:04:33 +00:00
jenkins-bot
9b2199bcf1 Merge "ApiDisabled: Correctly fall back to api-help-no-extended-description" 2020-02-12 00:11:14 +00:00
jenkins-bot
3ac2e9ff04 Merge "Add more tests for the User class" 2020-02-11 18:01:17 +00:00
jenkins-bot
be493195a8 Merge "Use ObjectFactory to construct ContentHandlers" 2020-02-11 17:57:14 +00:00
jenkins-bot
9c2f06f68d Merge "shell: Skip FirejailCommandTest::testBuildFinalCommand() on Windows" 2020-02-11 16:49:56 +00:00
RazeSoldier
f58616acce shell: Skip FirejailCommandTest::testBuildFinalCommand() on Windows
firejail is a Linux sandboxing system, unavailable on Windows.

Bug: T228568
Change-Id: I115e0e72ec31ebd7fd61e90250c10b414eea2489
2020-02-11 16:31:31 +00:00
DannyS712
989c4f7723 Add more tests for the User class
Methods newly tested:
* ::isAllowedAny, ::isAllowedAll, ::isAllowed, ::isNewbie
* ::pingLimiter (basic testing)

Testing expanded for:
* ::checkPasswordValidity
* ::testRealName

Bug: T233385
Change-Id: I2848ecc401b55e4202a853f270f084a093ed46e4
2020-02-11 01:57:04 +00:00
ArtBaltai
272e941b7f Use ObjectFactory to construct ContentHandlers
Changed
 - ContentHandlerFactory with legacy support
 - ContentHandlerFactoryTests
Added
 - MediaWikiIntegrationNoDbTestCase for test without preparing DB
New
 - tests

Bug: T243560
Change-Id: I693dda56af55bd03e48d62a2f1ade42f65a8fac9
2020-02-10 21:36:36 +03:00
jenkins-bot
10b7602f69 Merge "Standardize information on Password Reset success page" 2020-02-10 17:10:25 +00:00
Sam Wilson
5b1978f797 Standardize information on Password Reset success page
For all successfully submitted (i.e. valid input) password reset
requests, display the same information. This removes the
distinction between email and username resets, and only shows the
user what they've already submitted.

Bug: T238961
Change-Id: Ic17acecf1e44401f7607cdaf90dcee1a26b8405f
2020-02-10 10:23:13 +08:00
Florian
c13605dba4 HTMLForm: Allow status object to have raw parameters
The status object, which can be returned after validating an HTMLForm,
can contain message objects. These message objects can be constructed
with the full feature set provided by Message, e.g. raw parameters.

The handling of these status objects in HTMLForm basically prevented
some features of the Message object in the status, as it parsed the
messages through the Parser, which does not recognize these raw
parameters as such and escapes them wrongly.

This behaviour is fixed with this change.

Bug: T240774
Change-Id: I152ec51f317799572bf6791e110cd72c42da82a0
2020-02-09 18:06:12 +01:00
jenkins-bot
c57205f452 Merge "API: Remove unused "non-whitelisted CORS origin" log" 2020-02-07 23:15:14 +00:00
jenkins-bot
30b2f833c2 Merge "resourceloader: Move site-level mw.config from startup to mediawiki.base" 2020-02-07 19:59:43 +00:00
Brad Jorsch
036cde7a04 resourceloader: Move site-level mw.config from startup to mediawiki.base
This data isn't needed for startup, and we can shave off a few K from
startup by moving it to mediawiki.base instead.

It was requested that this be done as a "package file", which
necessitated some other minor structural changes to mediawiki.base as
well.

Bug: T235350
Change-Id: I525a5203533089d5a542f83a847be58a10cb6319
2020-02-07 19:44:57 +00:00
jenkins-bot
af29679594 Merge "ResourceLoaderSkinModule: Restore previous behavior in getLogoData()" 2020-02-07 18:42:32 +00:00
jenkins-bot
692e5d9d0d Merge "Add test for JobRunner" 2020-02-07 17:05:28 +00:00
Petr Pchelko
c8136454cd Add test for JobRunner
Bug: T220127
Change-Id: I35ff5f97d3e8e677c5c236723df6f74b5e21214d
2020-02-07 11:32:17 -05:00
jenkins-bot
9c853a8675 Merge "ExternalUserNames: Handle otherwise-usable names with lowercase first letter" 2020-02-07 12:22:22 +00:00
jenkins-bot
fc86229acc Merge "EditWatchlist: Use dependency injection for WatchedItemStore" 2020-02-07 08:54:44 +00:00
Bartosz Dziewoński
68d10ec12d ResourceLoaderSkinModule: Restore previous behavior in getLogoData()
getAvailableLogos() can now also return multiple items if a 'wordmark'
logo is defined, but this method only cares about the DPI variants
('1x'/'1.5x'/'2x') and should return a string if there's only '1x'.

Bug: T244405
Change-Id: I69ddb1f9f97d06253b661caf112b48343cd2453f
2020-02-07 10:10:26 +08:00
jenkins-bot
3cddc7eb36 Merge "In Database::select() allow an empty array for $table" 2020-02-06 23:36:03 +00:00
Tim Starling
00c8a5cbde In Database::select() allow an empty array for $table
Previously it would give FROM followed by nothing which is always a
syntax error. Easier to fix it here than to convert empty arrays to
empty strings in SelectQueryBuilder.

Bug: T243051
Change-Id: I95a9b6a34cfb5c1ca4cf243c4226b5ed4f968035
2020-02-07 09:57:27 +11:00
jenkins-bot
206e2fd72d Merge "Introduce ContentHandlerFactory" 2020-02-06 22:38:37 +00:00
ArtBaltai
30e54b3962 Introduce ContentHandlerFactory
Added:
- ContentHandlerFactory
Tests:
- PHPUnit
Changed
- Calls of changed and deprecated
- DI for some service/api
Deprecated:
- ContentHandler::* then similar to ContentHandlerFactory
- ContentHandler::getForTitle
- ContentHandler::$handlers

Bug: T235165
Change-Id: I59246938c7ad7b3e70e46c9e698708ef9bc672c6
2020-02-07 00:53:51 +03:00
Aaron Schulz
85bc62c5a8 objectcache: add "coalesceKeys" option to WANObjectCache for key grouping
This is useful for grouping related keys on the same servers to reduce
the need for cache server connections and availability. A cache key that
uses "lockTSE" can already involve accessing several keys during the
read/write cache-aside paths:
a) The value key itself
b) The check key (named after the main key, a common pattern)
c) The mutex key (used if the value looks stale)
d) The cool-off key (used if regeneration took a while)

Any problems accessing the first two could cause extra value regenerations.
Problems with the mutex key could lead to stampedes due to threads assuming
another thread was regerating a soon-to-expire value when, in fact, none was.
A similar problem could happen with cool-off keys, with threads assuming
that another saved the newly regenerated value when, in fact, none did.

The use of hash stops puts the tiny related keys on the same server as the
main cache key that they serve. This is only for hash-based routing, and not
route prefix routing (e.g. All*Route still sends the key to multiple child
routes, but the PoolRoute/HashRoute function will hash differently).

The option is not enabled by default yet.

Change-Id: I37e92a88f356ef1e2a2b7728263040e2f6f09a13
2020-02-06 20:27:08 +00:00
jenkins-bot
bfac0ffc4f Merge "Add more tests for the User class" 2020-02-06 20:03:34 +00:00
jenkins-bot
2b51d32067 Merge "BlobStore: support "known bad" addresses." 2020-02-06 15:56:05 +00:00
Brad Jorsch
a04633f678 ParamValidator: Default PresenceBooleanDef to false rather than implicitly null
PresenceBooleanDef is causing ParamValidator::getValue() to return null,
while historical Action API behavior had returned false instead.

While it generally shouldn't make a difference since PHP considers both
falsey, and good arguments could be made either way, we can restore the
historical behavior easily enough by having normalizeSettings()
default PARAM_DEFAULT to false.

Bug: T244440
Change-Id: Iee1d8e5753407674adc3f7384989841bc9b44c54
2020-02-06 09:44:06 -05:00
jenkins-bot
8d1a7b906e Merge "Deprecate access of logos directly from config, introduce wgLogos" 2020-02-05 02:09:32 +00:00
jenkins-bot
7b54f5dc3d Merge "rdbms: add GREATEST/LEAST wrappers to IDatabase" 2020-02-04 22:03:11 +00:00
DannyS712
fc9671bdf5 Add more tests for the User class
Newly tested:
* ::getDefaultOption
* ::isCreatableName, ::isUsableName
* ::addToDatabase
* ::changeableGroups
* ::isBlockedFromUpload

Testing expanded for (mostly just specific edge cases):
* ::getIntOption, ::getId, ::getDefaultOptions
* ::addGroup, ::removeGroup
* ::newFromConfirmationCode
* ::idFromName
* ::findUsersByGroup

Bug: T233385
Change-Id: I12bdcffcc6af96da4425e0064f8d395153d05953
2020-02-04 21:14:26 +00:00
Brad Jorsch
724e1782db Add RestStructureTest
This tests validity of parameter definitions for the MW REST API, like
ApiStructureTest does for the Action API.

Bug: T243437
Change-Id: Iac9ca951d00573be6efe00cc07478c3581c84588
2020-02-04 20:30:10 +00:00
Brad Jorsch
d4c2f0d899 Move some validation logic from ApiStructureTest to ParamValidator
ApiStructureTest has a lot of logic for validating Action API settings
arrays during CI. Some of that logic should be part of ParamValidator
instead.

Bug: T242887
Change-Id: I3c3d23e38456de19179ae3e5855397316b6e4c40
Depends-On: I04de72d731b94468d8a12b35df67f359382b3742
2020-02-04 20:29:35 +00:00
Brad Jorsch
c2b1525908 API: Use ParamValidator library
This brings significant modularization to the Action API's parameter
validation, and allows the Action API and MW REST API to share
validation code.

Note there are several changes in this patch that may affect other code;
see the entries in RELEASE-NOTES-1.35 for details.

Bug: T142080
Bug: T232672
Bug: T21195
Bug: T34675
Bug: T154774
Change-Id: I1462edc1701278760fa695308007006868b249fc
Depends-On: I10011be060fe6d27c7527312ad41218786b3f40d
2020-02-04 13:36:14 -05:00
Peter Ovchyn
baa0e2a425 languages: Decrease visibility of public variables in LanguageConverter class
Bug: T243461
Change-Id: I461ce7daba3a6a85464a69f4de76b1740472702d
2020-02-04 16:53:15 +02:00
Peter Ovchyn
50e3bd4fac parser: Inject a LanguageConverterFactory through DI containers:
1. into class Parser
2. into class LinkHoderArray
3. into class DefaultPreferencesFactory

Add more tests for DefaultPreferencesFactory:
1. testVariantsSupport verifies that converter with variants is used correctly.
2. Test testUserGroupMemberships verifies that membership is used correctly

Bug: T243320, T243321, T243317
Change-Id: I1e5c37e18332d0d32391c74c06e3d84862e48df8
2020-02-04 14:42:03 +02:00
jdlrobson
8cd2e13363 Deprecate access of logos directly from config, introduce wgLogos
Add getAvailableLogos static method and wgLogos config variable

Longterm we'll phase out wgLogo and wgLogoHD for this more extendable
config.

wgLogoHD is marked as deprecated. wgLogo continues to function as before
when wgLogos doesn't exist to cause minimum disruption.

From now on all logos should be accessed via getAvailableLogos. Patches
in Minerva and Vector follow. See I00899c16c0325f36b671baf17e88c2b5187b3526,
I569e0d800e147eabc7852567acd140108613f074 and
I013bd0904fe8c55efa49d14e84cf06ec1412896f.

Bug: T232140
Change-Id: I66a971631c623cc94b58eb0e5e5bad804789bf1c
2020-02-04 01:56:20 +00:00
Brad Jorsch
5d9bc35dd6 ExternalUserNames: Handle otherwise-usable names with lowercase first letter
ExternalUserNames::applyPrefix() should probably apply the prefix to
otherwise-usable names that would fail User::isUsableName() only because
of a lowercase first letter (or other non-normalization that
User::getCanonicalName() fixes).

Bug: T211450
Change-Id: If695432d6b683442bd74ee160064c950b09c924a
2020-02-03 15:43:52 -05:00
jenkins-bot
7c6ec9a895 Merge "RevisionStore: fail on mismatching hash or size." 2020-02-03 20:25:36 +00:00
jenkins-bot
e799b64254 Merge "Fix TextPassDumperDatabaseTest to work with 0.11 schema" 2020-02-03 19:50:18 +00:00
jenkins-bot
c63dd159ca Merge "Add more tests for the user class (factory and preferences mostly)" 2020-02-03 17:17:12 +00:00
jenkins-bot
3cd45de6ed Merge "languages: Add @group Language to all tests related to Language for easier navigation through tests" 2020-02-03 16:41:25 +00:00
Peter Ovchyn
863a1d5bdd languages: Move Converter and tests to respective files
Bug: T226833, T243760
Change-Id: I6fc7f267098d663fbefd0e78457726c343c9b3e4
2020-02-03 15:31:08 +02:00
Peter Ovchyn
6ee4f72d1d languages: Add @group Language to all tests related to Language for easier navigation through tests
Bug: T226833, T243761
Change-Id: Ied7d4a1db661f5cfaefe6c392348ff56b1a5616c
2020-02-03 15:29:59 +02:00
Peter Ovchyn
61e0908fa2 languages: Introduce LanguageConverterFactory
Done:
* Replace LanguageConverter::newConverter by LanguageConverterFactory::getLanguageConverter
* Remove LanguageConverter::newConverter from all subclasses
* Add LanguageConverterFactory integration tests which covers all languages by their code.
* Caching of LanguageConverters in factory
* Make all tests running (hope that's would be enough)
* Uncomment  the deprecated functions.
* Rename FakeConverter to TrivialLanguageConverter
* Create ILanguageConverter to have shared ancestor
* Make the LanguageConverter class abstract.
* Create table with mapping between lang code and converter instead of using name convention
* ILanguageConverter @internal
* Clean up code

Change-Id: I0e4d77de0f44e18c19956a1ffd69d30e63cf51bf
Bug: T226833, T243332
2020-02-03 11:38:03 +02:00
DannyS712
0e301253f1 Add more tests for the user class (factory and preferences mostly)
Add tests for
* ::newFromId, ::newFromConfirmationCode
* ::getStubThreshold, ::requiresHTTPS
* ::setItemLoaded, ::isItemLoaded
* ::getGroupMemberships

Expand tests for
* ::getCanonicalName

Bug: T233385
Change-Id: I2c47590e1cef35387aa376303ebfa09e54c0cc34
2020-02-02 07:55:06 +00:00
jenkins-bot
51280df815 Merge "objectcache: fix cache pollution in WANObectCache Multi* methods" 2020-01-30 18:17:03 +00:00
Roan Kattouw
f8861b7622 TemplateParserTest: Add test case with syntax error
Change-Id: Id4860269e55345176ad58fd75dcf3522a8617fa2
2020-01-29 23:15:53 +00:00
Aaron Schulz
527fd0109f objectcache: fix cache pollution in WANObectCache Multi* methods
This was triggered by bad reference handling during preemptive refreshes

Bug: T235188
Change-Id: I239a3e1922f478c74c94d8d2debff28f525c7c31
2020-01-29 21:08:39 +00:00
Kosta Harlan
7b6510e50b EditWatchlist: Use dependency injection for WatchedItemStore
Change-Id: I37f46e758b12edbf38d0042c4364f21cfdfb6c6c
2020-01-29 18:38:29 +00:00