Some of these parameters are marked as optional and nullable,
but can never be null (the test would fail then), and are
never missing.
While I'm here I also add more strict type hints for
parameters and return types. Note this is only done in tests
and impossible to cause trouble in production.
Change-Id: I1c66325c97d5ea86d9822e789a36542faad1272b
This re-applies I15cc5a64d7fcc3d09f9175a3ca8dd8180761f085
This reverts the revert in af71ce1864.
Reason for revert: should no longer fail with Title::assertProperPage no longer checking for fragments.
Change-Id: I60b8cd14c8304ad34a69e22b978fa476430a867c
When we find that a revision we loaded doesn't belong to the expected
title, log the error and continue, instead of failing hard.
This could happen if a caller to e.g. getRevisionById supplied a Title that is
plain wrong. In this case, we should ideally throw an IllegalArgumentException.
However, it is more likely that we encountered a race condition during a page
move (T268910, T279832) or database corruption (T263340). That situation
should not be ignored, but we can allow the request to continue in a reasonable
manner without breaking things for the user.
Note that this patch does not resolve the mentioend bugs. It only
reduces impact for users. We still need to find out when and why we are
gettign mismatching titles.
Bug: T259022
Bug: T268910
Bug: T263340
Bug: T279832
Change-Id: Ia64ad3b8a6e3c3348bc0a276d528ead127c6b0e0
These two special pages showed the username in plain text if the user ID
is zero, avoiding a call to userLink and userToolLinks(). But those
functions actually have quite nice handling for zero user IDs, notably
interwiki links for external usernames.
So, just call userLink() and userToolLinks() always.
Change-Id: I62021464355127b32ccb388e7c29440fd19f490d
This logic is not needed to run on every PHP process and was making
it difficult to run offline maintenance scripts without additional
complexity based on Maintenance::getDbType and DB_NONE.
Instead of skipping this only for DB_NONE, and establishing a pattern
that may spread to other ad-hoc places throughout the codebase, instead
remove this entirely from the eager set up code for all PHP processes
and move it to the service wiring and dependency injection.
That way, it naturally doesn't happen until and unless the DB service
is actually called upon. Scripts and entry point that need to disable
the DB service, can continue to use
MediaWikiServices::disableStorageBackend.
== Impact on SiteStatsUpdate ==
With wgCommandLineMode no longer being read at run-time from a global,
but in service wiring, this means SiteStatsUpdateTest can't change
the behaviour between CLI-like and Web-like, unless it e.g. resets
the 'DBLoadBalancerFactory' service first. Unfortunately, while most
any reset is supported, a reset of the 'DBLoadBalancerFactory' would
be unsupported as that would lose the temporary db clone context and
such, bringing us to either the developer's live db, or a broken set
up altogether. If there is a strong need for toggling oppertunistic
updates off and on at run-time, this could be supported in the
DeferredUpdates class perhaps, but we already have numerous methods
there (incl db begin/commit being a good proxy already), which this
test already used, so for now I've just removed the extra assertion
for this as it wasn't essential to that test.
Bug: T228895
Bug: T238436
Change-Id: Icf29bc484c155f52b6d8f61e5902233a15ba0c6d
This adds a new type of block restriction for actions, which extends
AbstractRestriction. Like page and namespace restrictions, action
restrictions are stored in the ipblocks_restrictions table.
Blockable actions are defined in a BlockActionInfo service, with a
method for getting all the blockable actions, getAllBlockActions.
Action blocks are checked for in PermissionManager::checkUserBlock
using DatabaseBlock::appliesToRight. To make this work, this patch
also removes the 'edit' case from AbstractBlock::appliesToRight,
which always returned true. This was incorrect, as blocks do not
always apply to edit, so cases that called appliesToRight('edit')
were fixed before this commit. appliesToRight('edit') now returns
null (i.e. unsure), which is correct because it is not possible to
determine whether a block applies to editing a particular page
without knowing what that page is, and appliesToRight doesn't know
that page.
There are some flags on sitewide blocks that predate partial blocks,
which block particular actions: 'createaccount' and 'sendemail'.
These are still handled in AbstractBlock::appliesToRight, and are
still checked for separately in the peripheral components.
The feature flag $wgEnablePartialActionBlocks must set to true to
enable partial action blocks.
Bug: T279556
Bug: T6995
Change-Id: I17962bb7c4247a12c722e7bc6bcaf8c36efd8600
This reverts commit 07d885248b.
Reason for revert: breaks tests in weird and unexpected ways
Bug: T279796
Bug: T281180
Change-Id: Iedc12256c8cd17498bcc12e184a12acbe5f2ac3b
From:
https://docs.openstack.org/swift/latest/overview_expiring_objects.html
The swift-object-expirer offers scheduled deletion of objects.
The Swift client would use the X-Delete-At or X-Delete-After
headers during an object PUT or POST and the cluster would
automatically quit serving that object at the specified time
and would shortly thereafter remove the object from the system.
Bug: T280496
Change-Id: I886f3cea51f80d820841f8548941ca02a0a514c3
init() method was added to AuthenticationProvider. It helps to inject
dependecies. Overridable postInitSetup() method was added to
AbstractAuthenticationProvider. A provider can override this to do
any necessary setup.
AbstractAuthenticationProvider ::setLogger(), ::setManager(), ::setConfig(),
::setHookContainer() were soft deprecated. Now developers must use
AbstractAuthenticationProvider::init().
Bug: T275030
Change-Id: I6ca63eddac1b177eeadbdcce992e71c44a480160
This introduces 2 new tags to track changes in media usage
across articles. These tags are both hidden & disabled by
default.
Bug: T266067
Change-Id: Ia230eadf7dcf6f52facab17b92293f25de38bb1c