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
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
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
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
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
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
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
Temporary users are blocked if their IP address is listed in
$wgDnsBlacklistUrls or $wgSoftBlockRanges.
Bug: T343704
Change-Id: Ia3383bd10c3c6c35c586550b68f4af5f4659e815
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
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
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
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
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
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
Add a service for convenient interpretation of UserIdentity instances,
especially relating to the TempUser migration.
Bug: T341976
Change-Id: I94e8620cd3187f41f04cdf24b5b553baadfbc22d
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
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
- 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
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
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