Commit graph

891 commits

Author SHA1 Message Date
jenkins-bot
20e44f1e07 Merge "rdbms: Inject CP instead of relying on LBF" 2023-09-05 17:54:52 +00:00
jenkins-bot
14fa41652a Merge "Stats: make component optional" 2023-09-04 17:17:32 +00:00
Cole White
bb864c4885 Stats: make component optional
* Add withComponent() to configure StatsFactory components.
 * Throw exception on setting static labels without component.
 * Clean up ServiceWiring and MediaWikiServices.
 * Rename withLabel to setLabel.
 * Rename withSampleRate to setSampleRate.
 * Rename withStaticLabel to addStaticLabel.
 * Update tests.

Bug: T240685
Change-Id: I6c99a532431f00bd140f44cb2d5eba2a9d83ca57
2023-09-04 18:00:49 +01:00
Amir Sarabadani
70dcaba317 rdbms: Inject CP instead of relying on LBF
This patch makes two major changes:
 - In the PoolCounter chain, we simply inject CP and call it directly
   and as result, there is no need for ILBF::getChronologyProtectorTouched
 - Instead of injecting CP callback to LB, just pass the object down the
   chain which leads to simpler and more stable code.

Bug: T275713
Change-Id: If78f4498d98e256015e54cc46561cb11b2947058
2023-09-04 12:29:05 +02:00
jenkins-bot
208232e281 Merge "Remove migration code from CommentStoreBase" 2023-09-01 10:30:19 +00:00
Amir Sarabadani
788d2f0a28 Centralize logic behind building ChronologyProtector object
Building blocks of CP don't really need to depend on LBF. Even the
config value for CP stash type is also different. But it's being passed
around along the rest of LB/LBF config and possibly down to the DB
object.

This is making the code much harder to understand, adds more coupling
than it needs to, and it's making pieces that don't need to rely on LFB
(like load.php) actually depend on LBF just to disable CP.

This clean up also helps improving DI of LB/LBF and building of DB
objects down the road.

Bug: T275713
Change-Id: Ic27269a1f1190ee7a03c6a422ada7ff293c3cab1
2023-08-30 18:44:09 +00:00
Lucas Werkmeister
b4af67e6ce Remove migration code from CommentStoreBase
As far as I can tell, there are no other CommentStoreBase subclasses
anywhere, and everything outside the tests calls CommentStore with
hardcoded MIGRATION_NEW, so all the support for other migration stages
has been dead code for a while now. Let’s remove it to make the code
simpler and less confusing.

Bug: T343558
Change-Id: I411967bd19979de47463aa93891cdc55baf89653
2023-08-29 12:37:44 +02:00
Func
596ea5eacb Remove deprecated ActorMigration usages around ContribsPager
Change-Id: I1a4224eac8bad47f7228faf68ea7f9c7d44a44ad
2023-08-25 17:43:44 +08:00
Amir Sarabadani
17d04077fd site: Migrate DBSiteStore to use ICP
Bug: T330641
Change-Id: If4bd4c0f3b2b74d3056db9b9521e7e6f1a25f307
2023-08-24 13:34:35 +02:00
Amir Sarabadani
e282d37272 interwiki: Switch ClassicInterwikiLookup to use ICP
Bug: T330641
Change-Id: Ibb1381b75bdc12d469ca04ec33ca552a69655a34
2023-08-24 13:28:19 +02:00
Derick Alangi
ae8c71feae deferred: Drop support for DeferredUpdatesManager
Revert of I7f07eddf2fc399b15db4fe9be4c792ef8eb0747b.

Bug: T265749
Change-Id: I5ab08bda82a79a518dd508383c60863d73cfdac4
2023-08-21 22:57:41 +00:00
jenkins-bot
cf8a38cca0 Merge "Disallow hiding temporary users via blocks" 2023-08-18 21:49:47 +00:00
jenkins-bot
43607fd156 Merge "language: Inject ParserFactory into MessageCache" 2023-08-16 15:59:05 +00:00
Thalia
878602ad97 Disallow hiding temporary users via blocks
Ensure that temporary users cannot have their name hidden via a block.

Temporary users are now handled the same as IP users:
* SpecialBlock: the option to hide a user is disabled if the target
  entered is a temporary user name
* BlockUser: the option to hide a user cannot be set to true if the
  target is a temporary user; however a non-hiding block is still made

Bug: T343705
Change-Id: I47b2ca55797d4e7d9dc1b61d0368e1269ad0fd3c
2023-08-14 18:12:03 +01:00
Umherirrender
1796dc225c preferences: Pass ParserFactory to DefaultPreferencesFactory
Bug: T343070
Change-Id: I10307ba3b76bc7b86617dbe2c4da6d745a73fdbe
2023-08-14 17:05:56 +00:00
Amir Sarabadani
64a3552a40 ResourceLoader: Completely remove FileCache
When I was testing for caching in RL, I realized file cache is
completely broken and mostly useless, specially for not taking into
account new query parameters and thinking basically all RL modules are
uncachable.

Let's just remove this.

Bug: T330576
Change-Id: I5b17bfc4c5543bd0e96e1099c87341ddf8fd6572
2023-08-11 13:50:41 +02:00
jenkins-bot
d336e242d2 Merge "SignatureValidator: Call Parsoid directly instead of via REST API" 2023-08-09 19:58:14 +00:00
jenkins-bot
eafcbe2578 Merge "Ensure temporary users are blocked by configured IP blocks" 2023-08-09 15:55:28 +00:00
Bartosz Dziewoński
ec9247c3e8
SignatureValidator: Call Parsoid directly instead of via REST API
I wrote this code before it was feasible to call Parsoid directly from
MediaWiki code, but now it is, so let's get rid of all this indirection.

This lets us add tests for this without mocking the whole world.

Change-Id: I32fea6d0e309ca6f06b3a249fba6e9a311057ce4
2023-08-09 09:39:23 +01:00
jenkins-bot
49cb8edc37 Merge "http: Propagate tracestate and traceparent headers" 2023-08-08 01:07:08 +00:00
Piotr Miazga
67c1e15469 http: Propagate tracestate and traceparent headers
Introduce a Telemetry singleton for propagating `tracestate` and
`traceheaders` during a MW web request. This class allows for easier
testing and mocking.

In the future we might use this as a wrapper for OpenTelemetry.

Bug: T320559
Change-Id: I3e5e54afa21f8c099877b3765c769f2d2f8f5d61
2023-08-07 21:04:19 +00:00
jenkins-bot
9d9c15f736 Merge "specials: Use cross-wiki aware UserIdentityLookup on Special:UserRights" 2023-08-07 14:55:46 +00:00
Thalia
13f4d6bc83 Ensure temporary users are blocked by configured IP blocks
Temporary users are blocked if their IP address is listed in
$wgDnsBlacklistUrls or $wgSoftBlockRanges.

Bug: T343704
Change-Id: Ia3383bd10c3c6c35c586550b68f4af5f4659e815
2023-08-07 14:14:54 +01:00
Daimona Eaytoy
c98aeff078 Allow DefaultOptionsLookup to be used with registered users in tests
Some tests use fake registered users which end up being passed to
DefaultOptionsLookup when storage is disabled. This should not be
considered a bug, and using the default preferences in this scenario
makes sense.

Add a switch to DefaultOptionsLookup to disable the precondition check
in that scenario.

Change-Id: I5987c4f1c3c502b23113d6688bbff7f1abe65879
2023-08-07 01:18:50 +02:00
Daimona Eaytoy
6b1a62e169 Fix more non-database tests accessing the database
Mock the needed services, or set fixed values to avoid DB lookups, when
possible. Add the test to the Database group otherwise, e.g. for things
like Skin and Parser that use global state all over the place.

Change-Id: I8d87013d89accaf04d0ac19cb4b7216290383eb5
2023-08-06 15:30:41 +00:00
Amir Sarabadani
974313663a Reorg: Move ProxyLookup to Request/
It's basically only used there.

Bug: T321882
Change-Id: Ibd9cac69772270b50152572ed618c692bbd5e4d9
2023-08-06 12:22:58 +02:00
jenkins-bot
15b80e9921 Merge "TempUserConfig: Add getMatchPattern" 2023-08-04 06:57:03 +00:00
Subramanya Sastry
5dd1b08b26 Remove unused ParsoidOutputAccess from PageUpdater classes
This usage moved to ParsoidCachePrewarmJob.php that was
created in 99d989087d

Change-Id: Ic0e57bdd7c572094daa92a9c288320edd88e7b58
2023-08-03 16:25:57 -05:00
Martin Urbanec
0a2b654e55 TempUserConfig: Add getMatchPattern
Why:
There are extensions that need to check a handful of
users for temp-ness at once (such as GrowthExperiments).
This is not really possible as of now (it would be necessary
to call UserIdentityUtils::isTemp several times, which can get
slow for large bulks of users).

What:
Add TempUserConfig::getMatchPattern() that can be used
to generate a LIKE database condition.

While at it, this patch also adds named() and temp() to
UserSelectQueryBuilder.

Bug: T341389
Change-Id: I90b5c59462c5c98bf5dcf9fa15d20553ef6599a5
2023-08-02 16:07:55 +02:00
Umherirrender
c87c8f6470 specials: Use cross-wiki aware UserIdentityLookup on Special:UserRights
Replace deprecated UserRightsProxy

Adjust type hints in ApiUserrights

Fix: Change the call to invalidate cache in service wiring to the new
UserFactory::invalidateCache (from 9116c387)

Original commit is 12b14620be.
This reverts the revert commit 5dbe1af8f8.

Bug: T255309
Change-Id: I2827e99d0990fefee260c7e8dc272312a3aea7cb
2023-08-01 10:29:02 +00:00
Timo Tijhof
e446a71f86 ResourceLoader: Switch Resources.php to MW_INSTALL_PATH
Follows-up Ib4caa80bb700, which introduced MW_INSTALL_PATH as
alternative to $IP, but also introduced $wgBaseDirectory.

Its not clear to me whether we actually want/need $wgBaseDirectory
long-term as it introduces significant complexity for a distinction
that remains theoretical, not enforced, and lacking a use case.

But, at least here we don't need it as these all explicitly reference
files that are in the source tree. Mocking the path differently would
fail the tests.

There are some individual methods (OutputPage, used via SkinModule)
that do not make assumptions on file paths and work with any file
paths at runtime. Those indeed need $wgBaseDirectory for DI and
testability.

Change-Id: I56c28d36e2d7bbf7ec5a8f2f5ae99b291e7ee4e8
2023-07-31 13:00:27 +02:00
Umherirrender
937ebeb585 language: Inject ParserFactory into MessageCache
Avoid clone of Parser object, create a new one

Reset the UrlUtils services after changing the server setting,
it is a dependency of the ParserFactory and gets initalizied earlier now

Bug: T250448
Change-Id: Ie62250242965d3d90873909795ced2cbda506ddb
2023-07-30 22:08:46 +02:00
Urbanecm
5dbe1af8f8 Revert "specials: Use cross-wiki aware UserIdentityLookup on Special:UserRights"
This reverts commit 12b14620be.

Reason for revert: causes a train blocker, T342747.

Bug: T255309
Bug: T342747
Change-Id: I2f3a80b09538f517ab271192cd0df9746280c3a9
2023-07-26 13:41:46 +00:00
jenkins-bot
b81e02c18d Merge "specials: Use cross-wiki aware UserIdentityLookup on Special:UserRights" 2023-07-24 22:31:09 +00:00
Tim Starling
31e3fd4329 Add UserIdentityUtils service
Add a service for convenient interpretation of UserIdentity instances,
especially relating to the TempUser migration.

Bug: T341976
Change-Id: I94e8620cd3187f41f04cdf24b5b553baadfbc22d
2023-07-24 09:52:10 +10:00
Umherirrender
12b14620be specials: Use cross-wiki aware UserIdentityLookup on Special:UserRights
Replace deprecated UserRightsProxy

Adjust type hints in ApiUserrights

Bug: T255309
Change-Id: If11f65a87d7de8282abd7344a3ac6693b389f9b0
2023-07-20 18:45:11 +00:00
Daimona Eaytoy
0e55aa602a Inject extension namespaces into NamespaceInfo
The service was previously accessing the global ExtensionRegistry
singleton, making it lose its statelessness. Dependencies should always
be injected, so add constructor parameters for that.

Simplify tests accordingly.

Change-Id: Iae375a81cab411fab607cba0addb2088131b3c81
2023-07-16 22:53:26 +02:00
Amir Sarabadani
5eae1de53f search: Make DB-backed search engines use ICP instead of LB/LBF
Bug: T330641
Change-Id: I5eff8865d77bbcca78b891a440fdde9f312a013c
2023-07-13 12:31:06 +02:00
Amir Sarabadani
3e157496ff Migrate several wfGetDB() to use ICP
And doing proper dependency injection.

Bug: T330641
Change-Id: I4978c158e513f88f5547343c4fbbe4b39078dc09
2023-07-05 11:00:59 +02:00
jenkins-bot
806a686f88 Merge "ServiceWiring: Use more specific ConfigException when wgObjectCaches is misconfigured" 2023-06-24 11:20:11 +00:00
jenkins-bot
8647f03800 Merge "Convert PageRedirectHandlerTrait to PageRedirectHelper" 2023-06-23 13:05:51 +00:00
daniel
5bc235c966 Convert PageRedirectHandlerTrait to PageRedirectHelper
Using a helper object instead of a trait allows for dependency
injection through PageRestHelperFactory. This will make it easier to add
language variant redirects in the next step.

Change-Id: I1d4f26c380797e28e1b97051400bb9b1301b89ab
2023-06-20 21:15:24 +02:00
jenkins-bot
b7ab187f9d Merge "Inject DeferredUpdatesManager into DeletePage" 2023-06-20 12:04:51 +00:00
jenkins-bot
52dbd8ee6f Merge "RateLimiter: collect statistics" 2023-06-20 11:54:45 +00:00
Daimona Eaytoy
1e27f61cc5 mail: Final round of EmailUser refactoring
- Replace MessageLocalizer with message formatters. This is still not
  very pretty, but at least now callers don't need to obtain monster
  classes like RequestContext to use this service.
- Update the documentation and add a couple notes about potential future
  improvements.

A subsequent patch will make the service stable for use, deprecate the
old stuff, and update the release notes.

Bug: T265541
Change-Id: Ic9b0ef7b3b410d48375836f4db565ffd46936319
2023-06-20 11:02:51 +00:00
daniel
e70e811ee3 RateLimiter: collect statistics
To prepare for changes to how, when and where we check rate limits,
we should start collecting statistics on how limits are checked and
enforced in production. This will alert us to unintended effects of
the refactoring. In addition, it provides information on the impact
each limit rule has.

Bug: T310476
Change-Id: I9dfbf3847b73ab5f145722c45b93056408ad9444
2023-06-19 21:18:56 +02:00
jenkins-bot
347d1a9870 Merge "Drop $wgCommentTempTableSchemaMigrationStage" 2023-06-13 10:25:40 +00:00
Alexander Vorwerk
8b754c90cf Reorg: Move EventRelayerGroup to libs/eventrelayer/
Bug: T321882
Change-Id: Ic00f83d127845f99acca9c1f8907db7c6dc03b9e
2023-06-10 12:30:12 +02:00
Amir Sarabadani
a5dac5d598 Start using ChangeTagsStore
Also some clean ups here and there

Bug: T245964
Change-Id: Ibf20eec3257a2dc54e3ccbe766b679ebdfbab8d9
2023-06-09 15:09:06 +02:00
Alexander Vorwerk
27beeac288 Drop $wgCommentTempTableSchemaMigrationStage
This was a temporary flag to allow setting the migration stage for a
comment migration with a temp table.

Since the rev_comment_id migration is done, this is no longer needed.

Dropping the compatibility code for temp tables will be done in
follow-ups.

Bug: T299954
Change-Id: I290a74f27b05cd7e062dda78766911ffe3053d08
2023-06-09 11:32:16 +00:00