Commit graph

9180 commits

Author SHA1 Message Date
jenkins-bot
0f76e5ad26 Merge "Hard deprecate UserLoadOptions hook" 2021-08-12 13:32:22 +00:00
jenkins-bot
372f4218b9 Merge "objectcache: BagOStuff::genericKeyFromComponents() empty component fix" 2021-08-12 01:45:25 +00:00
Aaron Schulz
f27367af09 objectcache: BagOStuff::genericKeyFromComponents() empty component fix
Empty leading components should still be colon separated. Although the
keyspace and collection should never be empty strings, it does not hurt
to handle that case anyway for safety.

Change-Id: Ic89acaf1fe5c34e58323b2913a9a26f973868590
2021-08-11 17:57:59 -07:00
TChin
22e919e3cb Hard deprecate UserLoadOptions hook
Bug: T287439
Change-Id: I454259592c10793ea579b11a96482c3196492d79
2021-08-11 17:15:29 -04:00
jenkins-bot
a31fa46ad5 Merge "Use MovePageFactory and hard deprecate constructing MovePage objects directly" 2021-08-11 20:29:44 +00:00
TChin
715f60357d Use MovePageFactory and hard deprecate constructing MovePage objects directly
Bug: T252934
Change-Id: I9345c1869310b6db82c50984a8ee80cc68ec7ff9
2021-08-11 15:44:09 -04:00
jenkins-bot
4a77ea0cf0 Merge "Hard deprecate UserSaveOptions hook" 2021-08-11 19:29:12 +00:00
TChin
879fa6e1e6 Hard deprecate UserSaveOptions hook
Bug: T287409
Change-Id: I8ea94949881e41467a46d325ddf9e8a3d0778d94
2021-08-11 10:10:20 -04:00
Alexander Vorwerk
0d48f7d25b Hard deprecate User::getIntOption()
deprecated since 1.35 and unused

Bug: T274211
Change-Id: If739492953ee53a39c81894c48f16be81c845542
2021-08-11 14:16:40 +02:00
Tim Starling
088a313fec ContribsPager row filtering with RevisionStore::isRevisionRow
Flow hooks into ContribsPager, causing formatRow() to be called with
FormatterRow objects instead of stdClass objects. formatRow() is
expected to silently decline to format such objects, leaving formatting
up to a subsequent hook.

Instead of calling newRevisionFromRow with all warnings suppressed and
all exceptions caught, provide isRevisionRow() which determines whether
the row is valid. Thus, unexpected exceptions will be visible and the
code does not depend on details of how newRevisionFromRow() validates
its arguments.

Bug: T288563
Change-Id: Id0316886d770cd905897d515b3eb658a5875bd80
2021-08-10 17:59:30 -07:00
jenkins-bot
9a8e410a68 Merge "ParserOptions: support setting a default for lazy options" 2021-08-10 18:36:13 +00:00
Petr Pchelko
79475042a5 ParserOptions: support setting a default for lazy options
If the default is not set for a lazy loaded option,
canonical parser output key ends up being 'lazy_option=default',
because when computing the keys we exclude defaults.

If on the other hand we register a default for a lazy option,
it does not get loaded, since in lazyLoadOption we believe
the default is already the loaded value.

Change-Id: I92b3e18fabef4eecac2ec2a4844f1be2716e5d89
Needed-By: I3bce04684070ad306685dabbc51267def25773cd
2021-08-10 10:22:05 -07:00
jenkins-bot
bb1766a6ba Merge "AuthManager: inject more services" 2021-08-10 12:40:38 +00:00
jenkins-bot
4b65affbc7 Merge "Fix mw.util.getUrl when given empty title with fragment" 2021-08-10 07:14:09 +00:00
jenkins-bot
ccd236abe1 Merge "objectcache: make use of new modtoken field in SqlBagOStuff" 2021-08-09 20:27:45 +00:00
Bartosz Dziewoński
1ed281afd9 Fix mw.util.getUrl when given empty title with fragment
In PHP, Title::getLinkURL() and related methods will make a
fragment-only link in this case (and ignore the given query
parameters). In JS we previously generated a link to the main page.
Change the JS code to match. Also add a unit test for this in PHP.

This also affects mw.Title#getUrl and the parsing of messages using
mediawiki.jqueryMsg.

Bug: T288415
Change-Id: I4aeba3409581f6a1d49a17e823ec83d8b76b844f
2021-08-09 19:21:15 +02:00
jenkins-bot
b036ab73aa Merge "Move Language subclasses to includes/" 2021-08-07 21:03:03 +00:00
jenkins-bot
898030fddb Merge "ChangeTagsTest: make use of assertSelect()" 2021-08-05 23:52:30 +00:00
DannyS712
9ec9693a55 ChangeTagsTest: make use of assertSelect()
Helper function MediaWikiIntegrationTestCase::assertSelect

Change-Id: I3628e968aa8b19edcb1015d6a5f1b0c744b55ba4
2021-08-05 22:55:21 +00:00
Kunal Mehta
a85f569dd1 Revert "Use CsrfTokenSet as CSRF token source"
This reverts commit 0d75fdb4f7.

Bug: T287542
Change-Id: Iedd3461869f973f8d621a39e6ad4674cbb577551
2021-08-05 15:48:26 -07:00
DannyS712
791e890fd5 AuthManager: inject more services
- BotPasswordStore
- UserFactory
- UserIdentityLookup
- UserOptionsManager

Bug: T265769
Bug: T141495
Change-Id: If220a25b8dfc9105faee5c04ea17ae8487b275f0
2021-08-05 21:31:02 +00:00
jenkins-bot
f0d0098338 Merge "DeprecationHelper: Support mocking and dynamic properties" 2021-08-05 17:40:20 +00:00
Aaron Schulz
d56a686f83 objectcache: make use of new modtoken field in SqlBagOStuff
Add a multi-primary mode option that supports MySQL DB setups
that use circular replication with STATEMENT formatted binlogs.
The `modtoken` column is only used when multi-primary mode is
explicitly enabled in configuration. The column is used by write
queries to determine the "winning" version of keys, with the goal
of approximating "Last-Write-Wins" eventual consistency.

Writes with different timestamps can be handled by picking the
one with the highest timestamp as the "winner". Writes with the
same timestamp, from different primary DBs, can be handled by
picking the one from the primary DB with the highest server_id.
Writes with the same token timestamp from the same primary DB can
be handled by picking the last write to appear in the binlog.
The delete() operation uses tombstones in multi-primary mode,
since there must be a key version to actually compare with the
versions from other operations.

Also:
* Remove "LOCK IN SHARE MODE" that was made obsolete by the
  CONN_TRX_AUTOCOMMIT flag. For the SQLite transaction case,
  it is serializable anyway.
* Simplified handleWriteError() to match handleReadError()
  and merged them into handleDBError().

Bug: T274174
Change-Id: Icc5eff9a032dd3403b5718058f20e38f8ea84af5
2021-08-05 02:33:00 +01:00
jenkins-bot
593c333ab1 Merge "parser: Replace deprecated MWHttpRequest::factory" 2021-08-04 23:13:56 +00:00
Timo Tijhof
7c39f76452 Move Language subclasses to includes/
Depending on which namespace we want these classes to have after
T166010 they could either stay in includes/languages/ (plural) in
their own MediaWiki\Languages\-namespace dedicated to Language
subclasses, or they could go in into a subdirectory like
`includes/language/languages/` if we want to keep them in the same
top-level namespace as other Language classes and services, but in
a more nested namespace.

For now, I've made the smaller change and kept the Language subclasses
in their own directory directly under includes/, not nested further.

Bug: T225756
Change-Id: I01015424707b442853879fd50c97f00215e5c2fa
2021-08-04 23:44:46 +01:00
Petr Pchelko
ac629eed2d DeprecationHelper: Support mocking and dynamic properties
DeprecationHelper currently breaks dynamic properties
on phpunit mocks. This happens because phpunit starts
mocking the magic methods if they're explicitly defined.

By default, magic methods and up doing nothing, but
if proxying to original methods is enabled, magic methods
are called like regular methods, regarless of whether
property exists or not. With this patch we can workaround
this issue, and create mocks for classes with deprecations.

Needed-By: I4297aea3489bb66c98c664da2332584c27793bfa
Change-Id: Id60a7751ece05669eced6eddd3216da7149411c7
2021-08-04 12:38:02 -07:00
Umherirrender
134045b9aa tests: Swap assertion order in unit tests
Changes from patch set Icb93c79f4843b59dae80d3eda1a880457a1a68f2
Also some swaps from assertEquals to assertSame/True/False/Null

Change-Id: Ife497ae6cb1888b77eb25e85b76df72adc65641a
2021-08-04 20:21:01 +02:00
Umherirrender
d1950d924a parser: Replace deprecated MWHttpRequest::factory
Change-Id: Id5fe298209cfbc09037799a2cdc117c9b7119172
2021-08-04 13:22:50 +00:00
Umherirrender
9b41241cc8 api: Use fake timer to test ApiQueryLanguageinfo
The difference is that previously we used microtime(), which provides a
float, and now time() is used, which provides an int, but there is no
difference for the comparison.

Change-Id: If1463e0fc2a2526ab4d2af64830b73ae3bf330f6
2021-08-04 02:27:04 +00:00
jenkins-bot
a06a42d62f Merge "Replace Assert::parameterType with typehints" 2021-08-03 14:49:42 +00:00
TChin
077b9af960 Replace Assert::parameterType with typehints
Bug: T287530
Change-Id: I6060e194339614b53e3a9c036ff3a3ac2e68f8df
2021-08-03 10:03:48 -04:00
James D. Forrester
8eb07a8ef4 ILoadBalancer: Rename finalizeMasterChanged() to finalizePrimaryChanges()
Bug: T282894
Change-Id: Ic863ee6ec1d6e6488db77dd697ac7422d105f3ca
2021-08-02 18:15:12 +00:00
James D. Forrester
1d71fd91d6 ILoadBalancer and IDatabase: Rename getMasterPos to getPrimaryPos
Bug: T282894
Change-Id: I30a600335af735a13a6ad2d3df56a5f17e05bfab
2021-08-02 18:14:41 +00:00
James D. Forrester
d11c59538a Rename DB primary position interfaces to DBPrimaryPos and MySQLPrimaryPos
And replace all uses.

Bug: T282894
Change-Id: I5222a8568255ac9fa5e2350e2264b8d2ee5eb968
2021-08-02 17:59:39 +00:00
jenkins-bot
64b11e338f Merge "DeprecationHelper: Support null coalescing on dynamic props" 2021-08-02 17:40:30 +00:00
jenkins-bot
55369c004c Merge "AuthManager: inject remaining services" 2021-08-02 17:15:24 +00:00
vladshapik
1be1fae99f DeprecationHelper: Support null coalescing on dynamic props
Change-Id: If46287f0b29fee043d212944cb64d56ecf2e413a
2021-08-02 09:00:04 -07:00
jenkins-bot
f91965a992 Merge "SpecialPageAction: inject action name and SpecialPageFactory" 2021-08-02 01:16:16 +00:00
jenkins-bot
e14101c802 Merge "Inject services into WatchAction and UnwatchAction" 2021-08-02 00:25:55 +00:00
DannyS712
4a82f51d17 Inject JobQueueGroup into UserGroupManager
UserGroupManagerFactory takes care of getting the
correct JobQueueGroup for the domain.

Bug: T287808
Change-Id: I548f0c52b298bfcae386ca1a427521c81dc802fe
2021-07-31 07:09:27 +00:00
DannyS712
5b5763e230 SpecialPageAction: inject action name and SpecialPageFactory
Instead of trying to figure out the name based on the
context, which duplicates the handling in ActionFactory,
make use of ObjectFactory specs' `args` feature to inject
the name.

Also inject the SpecialPageFactory service.

Bug: T253078
Change-Id: Iec223583f93d45184152862d9eee735737453417
2021-07-31 03:43:56 +00:00
Alexander Vorwerk
84b8655fb5 AuthManager: inject remaining services
Bug: T141495
Change-Id: Ibb549da3ebc2a9cb7709aaaa31407066361cbaa2
2021-07-30 16:09:24 +02:00
jenkins-bot
eb58fa9d82 Merge "Move Content::preSaveTransform to ContentHandler" 2021-07-29 19:25:28 +00:00
jenkins-bot
bc7167be2e Merge "Support fluent interface for PageUpdater" 2021-07-29 18:30:55 +00:00
TChin
48496b8526 Support fluent interface for PageUpdater
Also refactored some calls to use it.

Bug: T287484
Change-Id: Ibb745e0131761600789dcb1a2065a981a65ec515
2021-07-29 12:09:37 -04:00
jenkins-bot
53c539f4ba Merge "Hard-deprecate Title::isNamespaceProtected" 2021-07-29 15:33:14 +00:00
Petr Pchelko
b782a7e66d Move Content::preSaveTransform to ContentHandler
Create ContentTransformer to access ContentHandler::preSaveTransform through the service.
Prepare object to hold a data that required for ContentHandler::preSaveTranform params.

This will require making a semi-backwards-incompatible
change no matter what, we don't really have a great way
of hard-deprecating overriding methods.

However, with the ContentHandler calling Content and
Content calling ContentHandler, and with the ProxyContent
trick to stop infinite recursion, it doesn't matter whether
callers use Content or ContentHandler. This will allow us
to naturally convert all callers. But won't really allow
hard-deprecation.

Bug: T287156
Change-Id: If6a2025868ceca3a3b6f11baec39695e47292e40
2021-07-29 18:06:02 +03:00
Petr Pchelko
0c395c3592 DeprecationHelper: allow or deprecate dynamic property access.
Setting and getting dynamic class properties (e.g. $parser->my_fancy_prop)
is a horrific practice that we should get rid of, but it is still
used. DeprecationHelper right now can not be used on classes
where this practice is used by extensions. Introduce methods
to allow or deprecate this practice.

Change-Id: Ib378bef792dd31be155f186f1a4965a05004a37c
2021-07-29 07:57:20 -07:00
Aryeh Gregor
b19db60c70 Hard-deprecate Title::isNamespaceProtected
No callers, deprecated in 1.34.

Change-Id: If2e1c762f91e3c8255fbb58b7c9f01e8929a7fa2
2021-07-29 17:15:33 +03:00
jenkins-bot
5d1bca6a1d Merge "PNGMetadataExtractor: skip oversize chunks instead of aborting" 2021-07-29 05:12:11 +00:00