Why:
- Calling getMessage()/getWikiText() with a good Status is a logic error
that converts the Status being operated on into a fatal one.
- However, this error is never logged anywhere, which can make it
difficult to diagnose such cases, as seen in
I17166e988bf389a5b03d4a74f539f7bec7f5997f.
What:
- Add a warning-level log for the case when getMessage() or
getWikiText() is invoked with a good Status.
Bug: T374436
Change-Id: I3efae5c4c336156924f1c9b4186fa9142aaed9ca
As noted on the comments, this needed a markup that work better
in bidi scenarios and as a part of replacing bidi control codes
with HTML markup I was able to test different bidi scenarios
using <bdi> HTML tags.
Bug: T375975
Change-Id: If2af751fc9f78869acf7b7e93199fa927de2cc19
This doesn't seem to be used anywhere except the tests and the
better API is to use $formatter->createBatch() API that
doesn't expose 'ugly boolean parameters' as described by
formatInternal method above so let's remove it.
https://codesearch.wmcloud.org/search/?q=formatStringsAsBlock
Change-Id: Ia7428f5dbdf6c76b7537ae3889aef077bb26c722
Why:
- When temporary users are enabled, creating IP actors is disallowed
apart from specific cases, such as importing revisions authored by
anonymous users.
- If such a revision includes a category link and
wgRCWatchCategoryMembership is true, MediaWiki will fire a job to
create a corresponding RC entry, which will attempt to attribute the RC
to the anonymous IP that authored the imported revision and fail in
doing so.
What:
- Track whether a category membership change job was triggered by an
import, and allow RecentChange objects created by such jobs to create
anonymous actors.
Test Plan:
1. On a wiki with temporary accounts enabled and wgRCWatchCategoryMembership = true,
import a revision via Special:Import that was authored by an anonymous user
and contains a category link.
2. Verify that the import succeeds and that the corresponding RC entry
shows up.
Bug: T373318
Change-Id: I89abdca9c4ab8796a211df8b37c1bd7173a496e5
In case a DB handle ends up in STATUS_TRX_ERROR, use "ROLLBACK" so
that assertQueryIsCurrentlyAllowed() does not complain.
Also improved related Database::assessConnectionLoss() comments.
Change-Id: I39cee1363496dfe29e268a219b39070b23fdee4c
We've discovered some new requirements.
Follow-up to 31f614f732.
The hook was not in a release yet, so we can rename it.
Bug: T371530
Change-Id: I82d8ae69c27a38c45eab5d19c063f0b9515b8ec8
Why:
- The installer feeds several user-provided values, such as the site
name, directly into LocalSettingsGenerator.
- There, these get passed through escapePhpString(), the output of which
is safe when rendered into a double-quoted string, but fails if the
input string contained single quotes and was rendered into a
single-quoted string.
What:
- Consistently output all strings in LocalSettingsGenerator as
double-quoted strings.
Bug: T372569
Change-Id: I27bb3c31d8e9957b4880d0faba8b79d121126a11
Move deduplication of language links out of Parser.php and into the
ParserOutput in order to be compatible with alternate Parsers (Parsoid).
Clean up various inconsistencies: ensure deduplication also happens in
OutputPage when multiple ParserOutputs are merged into the final output,
and ensure that the deduplication in LinksUpdate is done in the same
order (first link prevails) as in Parser/ParserOutput/OutputPage.
Deprecate OutputPage::setLanguageLinks() (the matching
ParserOutput::setLanguageLinks() was deprecated in 1.42).
As a breaking change, return an array, not an array *reference*, from
ParserOutput::getLanguageLinks(). This allows us to safely modify the
internal representation of language links. As far as I can tell, no one
used the returned reference to sneakily modify the list of language
links, and there not a good way to have deprecated this before making
the breaking change.
While we're at it, we've added tests to ensure that language link
fragments are preserved.
Bug: T26502
Bug: T358950
Bug: T375005
Change-Id: I82a05a51d94782ebb9fa87ff889ca0f633b3e15c
This avoids addition of new code with the deprecated global,
or at least it gives extra attention on review when new code also uses
the inline ignore
Change-Id: I5c1bc5a1685c28f153d4fbe3525959930f54b557
Why:
* When code throws a UserNotLoggedIn error for a temporary account,
this takes them to Special:UserLogin and asks them to log in to
an account
* Users using temporary accounts are less likely to have a named
account, so should instead be sent to Special:CreateAccount
(as described in T358586)
* When doing this, the warning message should be customised to
talk about the user needing to create an account (and not
log in)
What:
* Update UserNotLoggedIn to redirect to Special:CreateAccount
when the user is logged in to a temporary account
** The code which constructs the exception object can override
this and force the redirect to always be to Special:UserLogin.
* When the redirect is to Special:CreateAccount, allow customising
the message shown by adding a '-for-temp-user' suffix to the
message key in UserNotLoggedIn.
** This suffix is only added if the resulting message exists,
so that code can choose whether they need a message that is
different to the one on Special:UserLogin.
* Update SpecialPage::requiredNamedUser to allow special pages to
force the redirect to always be to Special:UserLogin
** This is made use of in Special:ChangeEmail and
Special:ConfirmEmail, as these special pages only make sense
for use with an existing account.
* Update and add message keys to allow a different message for
Special:CreateAccount.
* Update and add tests for these changes.
Bug: T358586
Change-Id: Ie0dd06f51b1e2b85eef6be377f673a02732ce604
Make store() handle cache purging upon new ID insertion and fetching
of the winning ID when raced out. This avoids the reloadMap() call.
Remove connection flag hack in reloadMap() given 0cb0f0ba7.
Remove comments about retryStore() logic removed in 505bd8e70f.
Clean up return types for the ID:name arrays.
Change-Id: Ic57eb5e2b59da67c6511b935d9e68ffb595028fa
Why:
* A hook is needed which is called when User::spreadAnyEditBlock
is called, so that extensions which provide alternative blocking
mechanisims (such as the GlobalBlocking extension) can spread
their blocks when local blocks are spread.
What:
* Add SpreadAnyEditBlockHook which is called from User
::spreadAnyEditBlock when it is called except when the user is
not registered.
** The hook is called even if the user is not locally blocked
* The return value of User::spreadAnyEditBlock is modified to
return true if either a local block or alternative blocking
mechanism spread blocks.
* Update UserTest to test this new behaviour.
Bug: T374857
Change-Id: Id302a6362d6177c89da9cdf4e677b3822ecb85f1
Follows-up 4e596f5112 (I59266726ad), which fixed bug T318272, but
did not add a regression test for it.
Bug: T318272
Bug: T327158
Change-Id: Ia8af6671887d3914fdc761d8e5d10fd33fb40f88
The use of this markup is triggering the loading of mediawiki.legacy.messageBox
and deprecation notices on all pages that use the Html method.
Bug: T360668
Depends-On: I4bd1a8a9d4eda1b3e89d067d6671d3f8bad4f584
Change-Id: I0195d4b0f790f6595cc626a6db96b4fc6380a0f4
This allows to access $this->blockUtils.
Also make the parameter WebRequest $request mandatory. because it is
already always present.
Change-Id: I97d5af0c5b1f54c4bd666183ae98199aa576596e
The discovery endpoint provides basic information about accessing the
wiki's APIs, as well as a directory of available modules.
Bug: T365753
Change-Id: I161aa68566da91867b650e13c8aadc87cd0c428c