Commit graph

5949 commits

Author SHA1 Message Date
Timo Tijhof
36f84edc11 WebRequest: Fix flaky testGetElapsedTime test case
* Increase tolerance from 0.2s to 60s.

* Update mock to only set 'requestTime' when needed.

* Inject the mock timestamp.

* Increase test coverage by not just ensuring 0.0 is returned
  when invoked right after (which would be satisfied if it
  always returned 0.0), but use a timestamp that started
  slightly in the past to confirm it does (likely) do
  computation.

Bug: T199764
Change-Id: Iad9499391eecb4a9d1923d231a1a5f1afe173ecc
2018-07-16 20:23:30 -07:00
jenkins-bot
df6491f78b Merge "objectcache: make BagOStuff::mergeViaLock() timeout more sensible" 2018-07-17 01:09:25 +00:00
Tim Starling
31372c619e In PathRouterTest use @dataProvider where possible
"Where possible" turns out to be every test in this class.

I used named data sets (i.e. array keys in the provided array) for the
main set of tests, to improve the PHPUnit output.

Change-Id: Ic68edc01b3e0e174983471a36f3c5d52e28abfdd
2018-07-16 15:55:59 +10:00
Aaron Schulz
563026acf4 Convert PasswordReset to using MapCacheLRU
Avoid NULL user name that caused test failures

Change-Id: Ifc3b19cc7e172300123e7d2c7153b4357917ca74
2018-07-14 01:31:54 +00:00
jenkins-bot
48d63885f8 Merge "Accept BCP 47 codes as aliases for nonstandard variants" 2018-07-14 00:30:44 +00:00
jenkins-bot
55a0d9edeb Merge "tests: Add a doc test for release notes' existence and line length" 2018-07-14 00:27:22 +00:00
James D. Forrester
1b5ed07827 tests: Add a doc test for release notes' existence and line length
Change-Id: I502bedc0221e52b78b15b1749918500842533e7c
2018-07-13 17:10:03 -07:00
C. Scott Ananian
0818070c59 Accept BCP 47 codes as aliases for nonstandard variants
The browser Accept-Language header uses BCP 47 codes, which don't
precisely match our internal mediawiki variant names in a number of
places.  Allow proper BCP 47 codes to alias our internal variants
for: Accept-Language parsing, URL parsing, user preferences, and
explicit enumeration of codes in LanguageConverter rules.

Change-Id: I8468a56d5b88f5786abd0a17b67bda2f1687fd0c
2018-07-13 17:43:20 -04:00
jenkins-bot
5905218e69 Merge "Ensure LanguageCode::bcp47() returns a valid BCP 47 language code" 2018-07-13 19:28:25 +00:00
C. Scott Ananian
8380f0173e Ensure LanguageCode::bcp47() returns a valid BCP 47 language code
MediaWiki uses a number of nonstandard codes which do not validate
according to the IANA language subtag registry.  Some of them have
the wrong semantics entirely: MediaWiki's `sr-ec` variant maps to
BCP 47 `sr-EC` which is "Serbian as used in Ethiopia" (!).

Extend LanguageCode::bcp47() to map our nonstandard codes to valid
BCP 47 language codes.  Export the mapping so that it can be used
in JavaScript's corresponding mw.language.bcp47() implementation
as well.

Thanks to TheDJ (I10b4473c7e53f027812bbccf26bb47aec15fddfd) and
Fomafix (I93efc190714ba76247d30ba49fc21ae872fc3555) for previous
attempts at this!

Also removed a fixme for the name of 'Twi', dating back to 2004
(f59c3be23b) -- checking
tw.wikipedia.org it certainly appears that the autonym of 'Twi'
is correctly 'Twi'.

Tracking bugs for invalid language codes are T125073 and T145535.
Discussion of zh-XX => zh-HanX-XX mapping is at T198419.

Bug: T34483
Bug: T106367
Bug: T120847
Change-Id: I807dd55d49e9bd19443329231326a5b0d3e6c453
2018-07-13 14:56:18 -04:00
Brad Jorsch
c6810d74d1 Deprecate ContentHandler::makeParserOptions()
Having a different ParserOptions for each content model isn't feasible
in an MCR world. And the only thing using this was Wikibase, which has
been fixed to do what it needs in a different way.

Bug: T194263
Change-Id: I01373b29ee25fa9346c6b0317155be4ccdc8c515
2018-07-13 14:32:59 -04:00
daniel
e4adfdc4fe Add test for PageArchive::getPreviousRevision
Regression test for  I4e2031f9625744

Change-Id: Id22984bf7d1c3d6f57e827e9f1283231918b59b1
2018-07-13 12:16:36 +02:00
Aaron Schulz
b8779134ed objectcache: make BagOStuff::mergeViaLock() timeout more sensible
Interpret "1 attempt" as non-blocking and use 3 seconds otherwise
(instead of 6 seconds). This means that the WAN cache merge call
does not block.

Bug: T198239
Change-Id: Ieb194a949f18785c2cc9dd20fdc4d2e3fed51abf
2018-07-12 16:02:38 +01:00
jenkins-bot
1828e901ab Merge "Add config to use change_tag_def table for Special:Tags" 2018-07-11 22:13:07 +00:00
jenkins-bot
216865344b Merge "rdbms: add IDatabase::lockForUpdate() convenience method" 2018-07-11 19:52:31 +00:00
Amir Sarabadani
9fed3f0fd3 Add config to use change_tag_def table for Special:Tags
Bug: T199334
Change-Id: Ieb8709caf0d8ee16086296baa75f751c7723c101
2018-07-11 16:44:28 +02:00
jenkins-bot
ef97002179 Merge "Simplify PHP by using ?? and ?:" 2018-07-11 09:09:18 +00:00
Fomafix
6866cfec37 Simplify PHP by using ?? and ?:
Also remove not necessary surrounding parentheses.

Change-Id: I0eb5c9c1bdfb09a800258379cdcefb5fd4d3d21c
2018-07-10 20:03:17 +00:00
Aaron Schulz
9eff263e8e rdbms: add IDatabase::lockForUpdate() convenience method
Change-Id: I238fd96407e1122e90058e2c4acf743044a267ec
2018-07-10 20:09:01 +01:00
jenkins-bot
722f51c7e8 Merge "[MCR] Make PageArchive aware of MCR" 2018-07-10 15:04:59 +00:00
daniel
4943c74ac4 [MCR] Make PageArchive aware of MCR
Bug: T194015
Change-Id: I92afda87961860983f080d96fa0616a6fcca64e4
2018-07-10 16:36:57 +02:00
jenkins-bot
8c96aec32c Merge "Fix the bug for dates between 1912 and 1941 in Thai language" 2018-07-10 08:55:56 +00:00
Brian Wolff
53a18d1294 CSP: Allow an option of disabling nonces
The current rollout plan calls for initial rollout to only
disallow external JS, and leave removing unsafe inline stuff
to a later date. Thus this adds a useNonces option to the CSP
config to allow that.

Renamed ContentSecurityPolicy::isEnabled() to isNonceRequired
for clarity. The old name has never been in a released version
of MediaWiki, so is removed immediately.

Change-Id: I756d8e97b77c6f97dbbf040a20c8750fecb157c5
2018-07-10 00:12:32 +00:00
jenkins-bot
ead3a32d9f Merge "Add a method to HTMLForm that allows the preText to be accessed externally." 2018-07-09 18:35:24 +00:00
David Barratt
d609da624b
Add a method to HTMLForm that allows the preText to be accessed externally.
Currently there is no way to access the preText outside of an HTMLForm. Adding
a getPreText method to HTMLForm so the preText is accessible.

Bug: T199115
Change-Id: I937028e7025b4a7b5d333e9bf5a25920f6a88316
2018-07-09 10:42:19 -04:00
daniel
59ea200662 Avoid losing cached ParserOutput in doEditContent.
Without this fix, the Content would be parsed twice during an edit,
if extensions that hook into EditFilter and similar
pre-parse hooks call WikiPage::prepareContentForEdit.

With this fix, ParserOutput created by prepareContentForEdit is
re-used by doEditContent.

This is a stop-gap solution. The Real Fix (tm) is to stop using
doEditContent, and use a PageUpdater instead.

Bug: T198483
Change-Id: I42123e48de2b087ef98d8a4855ee3aebd7f1de57
2018-07-09 15:24:45 +02:00
Timo Tijhof
ea7101e6e4 resourceloader: Add coverage for StartupModule::getAllModuleHashes
Change-Id: I94551a938cd93152eb1bb0a4748e1c0155539c4c
2018-07-07 23:49:20 -07:00
jenkins-bot
c07b08b36c Merge "Avoid deprecated IDatabase::getWikiId() reference" 2018-07-07 23:07:45 +00:00
Aaron Schulz
86dd3b0ac0 Avoid deprecated IDatabase::getWikiId() reference
Change-Id: I26991079b1630335c8a6e907554760fc85c1bad6
2018-07-07 22:55:15 +00:00
Umherirrender
130ec2523d Fix PhanTypeMismatchDeclaredParam
Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff

Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
2018-07-07 00:34:30 +00:00
jenkins-bot
8a176cd9ea Merge "Use consistent caching strategy in Revision storage classes" 2018-07-06 18:09:13 +00:00
jenkins-bot
4fba841df3 Merge "rdbms: add resolveDomainID() method to LBFactory/LoadBalancer" 2018-07-06 17:54:01 +00:00
jenkins-bot
e2a0b34b7f Merge "Allow extra slots in write-both/read-new mode." 2018-07-06 17:53:55 +00:00
jenkins-bot
fa321e4632 Merge "Introduce new schema flags and use them in RevisionStore." 2018-07-06 17:53:44 +00:00
daniel
53fd8295ff Use consistent caching strategy in Revision storage classes
DEPLOYMENT: This changes the cache key for revision
content blobs. Expect a brief rise in ExternalStore hits.

Bug: T198704
Change-Id: Icc2d16bc5a1e27ba4caea49a784ba7aeac15042a
2018-07-05 17:44:24 +02:00
jenkins-bot
368c698631 Merge "Revert "Introduce RevisionStoreFactory & Tests"" 2018-07-05 15:08:36 +00:00
Aaron Schulz
2fd62f5dc9 rdbms: add resolveDomainID() method to LBFactory/LoadBalancer
Also add LBFactory::getLocalDomainID to match the one in LoadBalancer

Change-Id: Ia31f0800bd3b692194c08b1eab9cfb2f43679c7a
2018-07-05 14:07:04 +01:00
jenkins-bot
55420abd95 Merge "Add support for extra database connections in unit tests." 2018-07-05 11:05:12 +00:00
daniel
6cfdbdf60e Add support for extra database connections in unit tests.
This adds a way to take any connection to the wiki database and
allow it to be used for unit tests.

This is needed to test code that requires two independent DB
connections, to the same database or to a different wiki's database.

Change-Id: I0b84a0c4d174cbde830786028ee7568c4ea9fb5d
2018-07-04 19:07:45 +02:00
Aaron Schulz
1da16f1639 Fix CONCAT assertions in some MCR tests
Change-Id: I9507ae60751f8e9cc5e6205148cf2e37f67f42c5
2018-07-04 08:20:53 +01:00
Addshore
2a6af6854d Revert "Introduce RevisionStoreFactory & Tests"
This needs more work, I'll file some tickets with TODOs

This reverts commit eb39d5f945.

Change-Id: I0678d0c4e4e7496a67dfe826b00246723e9c7d54
2018-07-03 14:32:44 +01:00
jenkins-bot
be004af9a2 Merge "Add MediaWikiService::getPerDbNameStatsdDataFactory" 2018-07-03 07:58:40 +00:00
jenkins-bot
4b5773a4de Merge "rdbms: fix Sqlite::tableExists() method to avoid STATUS_TRX_ERROR" 2018-07-03 05:40:03 +00:00
daniel
f81dc6e753 Allow extra slots in write-both/read-new mode.
Bug: T198413
Change-Id: I3125d5c7ef8d12936d4332cd1602f2eaab2482b2
2018-07-02 19:44:05 +02:00
addshore
72c50093a4 Add MediaWikiService::getPerDbNameStatsdDataFactory
Bug: T196609
Change-Id: I08a4909e2855e33569641166b77be5d8bf4e2c34
2018-07-02 18:31:03 +01:00
daniel
33258e04d1 Introduce new schema flags and use them in RevisionStore.
NOTE: this changes the numeric values of the MIGRATION_XXX constants!
Order is preserved.

Bug: T197619
Change-Id: I16db7dd5799ab98c1cb12e7cd1e0b2da83b366fc
2018-07-02 17:20:14 +02:00
MusikAnimal
72566c80b1 Allow MediaWikiTestCase::insertPage to use given User
Sometimes you need to create pages with a non-sysop.
Example: I31aedcb9af7584fa5504916c67ca10f205ec9910

Change-Id: I9e48f7c00efbce8c2de3f5db3a74462d47ae8f64
2018-06-29 17:04:33 -04:00
Kevin Israel
a50f61009d MWNamespace: Add getCategoryLinkType() method
This method returns the value used as cl_type for category links that
are "from" pages within the namespace, and is added to avoid duplication
of code across a few classes.

Change-Id: I4e55932a5a27858cfedb12009b455fcd02f9b5df
2018-06-29 15:37:11 +00:00
addshore
fb97a7bad3 Ensure services are added to MediaWikiServicesTest::provideGetService
Change-Id: I3f6ded009ed98b615adb7c46d41bced450972b54
2018-06-29 12:55:35 +00:00
addshore
c37c3a66b7 MediaWikiServicesTest, remove out of date note
provideGetters is now automatically populated using the
provideGetService method so we don't need to actually add
the service there

Change-Id: I07e8f54e5c4aa7ff22d02312bf51ac8d1cc4b5c2
2018-06-29 12:55:28 +00:00