Commit graph

8211 commits

Author SHA1 Message Date
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
jenkins-bot
0a46bef2db Merge "objectcache: fix storage of null values in WANObjectCache" 2020-01-29 04:14:20 +00:00
C. Scott Ananian
a8f3eb96ce Hard deprecate Parser::setFunctionTagHook()
This is not used in production code.

Code search:
https://codesearch.wmflabs.org/search/?q=setFunctionTagHook%7CmFunctionTagHooks&i=nope&files=&repos=

Change-Id: Ie03b1687d1c65be23213035d7cb4011ef763b69a
2020-01-28 16:20:40 -08:00
C. Scott Ananian
0437877656 Whitelist aria-hidden attribute in Sanitizer
Bug: T204618
Change-Id: I34b9b729eccd7658d5165b6661e5fd45a733b36c
2020-01-28 21:54:16 +00:00
Thiemo Kreuz
9c57ea2b7f Replace complicated assertions with assertIsString() and such
This patch tries to make assertions in tests more readable by using more
self-documenting assertions as provided by modern PHPUnit versions. Among
a few others, these two main changes are done:

* I found a lot of assertions with the expected value being the *second*
parameter. I did not changed all of them. Only some that can be replaced
with assertNull() and such.

* I try to replace all `assertTrue( is_…() )` with dedicated assertions.

Change-Id: I1fc72188fbd0edacf13886e7f9a9eacbd85f13c2
2020-01-28 19:17:58 +00:00
DannyS712
262501f064 Add more tests for the user class (email and username related mostly)
Add tests for
* ::setId
* ::getName, ::setName
* ::getEmail, ::setEmail, ::invalidateEmail
* ::whoIs

Expand tests for
* ::newFromName

Add coverage tag for ::getDBTouched

Bug: T233385
Change-Id: I565cbc0660d7a9fb16e02595598003228f6fb238
2020-01-27 01:40:57 +00:00
jenkins-bot
015d3d7a9b Merge "Hard-deprecate Sanitizer::escapeId()" 2020-01-26 22:22:29 +00:00
C. Scott Ananian
b79c1e22ad Hard-deprecate Sanitizer::escapeId()
Deprecated in MW 1.30; time to clean up any remaining uses.

Code search:
https://codesearch.wmflabs.org/deployed/?q=escapeId%5C%28&i=nope&files=&repos=

Depends-On: Ic03a5da2e1d6b8f5656555420dd573a1d698b9cc
Depends-On: I311f44a5035f73c0fb2289f727eb39b73007429b
Depends-On: I76c5b539bae5572c4ac65f28fec9c0c36381348c
Depends-On: Id4cbfc3b113b1b04f949d485187e89ffe0b487f5
Depends-On: I7d5ba4930688ed7f011a4babed5986b8e40910a0
Depends-On: I964f83ce88fb9c66a7c59037c6066f4567bcf4c9
Change-Id: I89504cfdf8e02831d54a26900bfdc63a33b4eade
2020-01-26 22:05:45 +00:00
jenkins-bot
f9a08c0c83 Merge "Remove Preprocessor_DOM, deprecated in 1.34" 2020-01-26 02:02:44 +00:00
C. Scott Ananian
2d4aced658 Remove Sanitizer::attributeWhitelist()/setupAttributeWhitelist()
These method were deprecated in 1.34 and should never have been public
in the first place.  New private methods have replaced them.

Code search:
https://codesearch.wmflabs.org/deployed/?q=attributeWhitelist%5C%28&i=nope&files=&repos=

Change-Id: I363530b7edaced77f2c5b06721b1930d85e2e9dc
2020-01-25 13:06:19 -05:00
C. Scott Ananian
5cbb64f56a Remove Preprocessor_DOM, deprecated in 1.34
Remove the deprecated Preprocessor_DOM class, which was hard-deprecated
in 1.34.  This begins to simplify parser configuration and reduce redundant
code paths, but I've left two things for cleanup in a future patch:

1. The `preprocessorClass` configuration option to the parser, exposed
in `$wgParserConf`, ServiceWiring, ParserFactory, etc.  There is no reason
for this to be exposed as configurable, but I've left this clean up to a
future patch.

2. The `$wgMaxGeneratedPPNodeCount` configuration, exposed also in
ParserOptions.  Only Preprocessor_DOM calculated this count, and since
we are only using Preprocessor_Hash now, this configuration has no effect.
But since this value was exposed in ParserOptions and elsewhere, I've
deprecated where needed but left this clean up to a future patch.

Bug: T204945
Change-Id: I727f003f9a42d0c92bcbcce8a8289d5af6cd1298
2020-01-25 11:22:45 -05:00
Aaron Schulz
4fb5210b62 objectcache: fix storage of null values in WANObjectCache
Bug: T234583
Change-Id: I38a531b9a0acb95d7884519f3381b48cd9d8faa0
2020-01-24 22:49:26 +00:00
jenkins-bot
abc60d2f09 Merge "phpunit: fix parameter mangling" 2020-01-24 10:49:57 +00:00