Changes to the use statements done automatically via script
Addition of missing use statement done manually
Change-Id: I73fb416573f5af600e529d224b5beb5d2e3d27d3
Implicitly marking parameter $... as nullable is deprecated in php8.4,
the explicit nullable type must be used instead
Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a
Break one long line in SpecialPage.php
Bug: T376276
Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.
Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.
Change-Id: Id75cb2e5fbee0fe7600f92473d876f23730d46b7
The issue can be spotted on the following link that number of edits
the user had before the rename isn't getting proper local number format,
https://fa.wikipedia.org/wiki/Special:Log/renameuser?uselang=fa
Change-Id: Ieb258f2363ef0f4e370aaba040c11750f3d8684f
As I had some difficulty finding where the messages are used in
the code so hopefully this will help the next person.
Change-Id: I5b6669a3c7df13f622a10f43679b88da3e3a0cd4
Use a NOT IN clause when there are more types to exclude
Old: (log_type != 'patrol') AND (log_type != 'tag')
New: (log_type NOT IN ('patrol','tag'))
Change-Id: Ib256b5be2dc2028dd50708e2e9a87b0428453a50
If the namespace configuration changed, it’s possible that the title in
the params can no longer be parsed. In that case, we shouldn’t return a
null entry, but just an empty array instead. (I haven’t tried it out
locally, but the test suggests that the actual formatting of the row
works without issue, with the title being shown as Special:BadTitle.)
Bug: T370396
Change-Id: I6335e12efa518332f7cd2268a833f8b60b8e6abe
The latter is the new way, we don't want to rely on the full Title
object these days and the former has already been deprecated.
Change-Id: Id37b1e36d5211d1218e80f8b4da420c2a65bd2fe
Changes to the use statements done automatically via script
Addition of missing use statement done manually
Change-Id: Id9f3e775e143d1a17b6b96812a8230cfba14d9d3
Mostly used find-and-replace:
Find:
/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?)[\s\*]+/\s*(private|protected|public) (\$[a-z]\w+;\n)((?=\s*/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?))\n|)
Replace with:
\3 \1 \4
More could be done, but to keep this patch reasonably sized, I only
changed the most obvious and unambiguously correct cases.
In some cases, I also removed redundant doc comments on the
constructor, and re-ordered the properties to match the constructor.
Change-Id: I7eb97640c0543ae10bf2431623a5f7efdc3349b7
This patch introduces a new namespace declaration,
MediaWiki\Xml and adds Xml and XmlSelect to it
and establishes class aliases marked as deprecated
since version 1.43.
Bug: T353458
Change-Id: I45cccd540b6e15f267d3ab588a064fbeb719d921
Why:
* When using a HTMLFormField that has accepts the options-messages
parameter, the message keys are the key and the value is either
an array of options or the name of the value.
* However, when converting the message key to the translated text
it is possible for two or more message keys to have the same
translation (for example T19746 and T347314). This causes only
one of the duplicate items to be displayed in the options list.
* As such, an logstash error should be raised when this happens
so that, when debugging a missing option, the error can be found
and lead to the issue being found quickly. For example, in
T347314 it took several months for the issue to be found and
solved.
What:
* In HTMLFormField::lookupOptionsKeys, add code to check if the
translated text for the message key already exists in the array
of translated text to option value. If it does, then create a
logstash error and skip adding the item to the array (as it
will override the already added item).
* Also do this in LogEventsList and UsersPager, where the code
passes the options using the 'options' key and uses the
HTMLSelectFieldand. This means that HTMLFormField
::lookupOptionsKeys will not be called and as such need the
same code to handle the duplicate values.
Bug: T360326
Change-Id: Ifdeb917f7034967feed7a3b86aabec3c4d49bcc6
Using the same technique as used for SpecialPage base class
with setter for each used service.
Bug: T356468
Change-Id: I5269633bb7389c48f807ce164f85b21d7d5954cc
For many languages, I believe, it is too restrictive to require
the same message for the button text and the reason.
Additionally, this change makes the capitalization consistent
for English. Compare with "editundo" (link text) and "undo-summary"
(edit summary default text).
Change-Id: I344ca3b567b5dafbe4417228ea9e8ea27d95a45e
If the destination page doesn't exist anymore (moved somewhere else,
already undone, deleted etc.), the revert link will only show an error.
Change-Id: I0b449f042fa54f4f946a1d9ec87d8ee76250baa6
== Optional ==
It was described as "optional" but it's not a "typical" optional
parameter because its presence has non-trivial consequences on the
output in a way that can't be ignored by callers.
It sounded like passing it would be faster for cases where the caller
has computed it already and can pass it to allow re-use, and
otherwise the function will compute it on-demand, but behave the same
way logically. Except, that isn't true at all.
== Null fallback ==
Replace the overcomplicated `intval( $edits ) === 0 && $edits !== 0`
expression with an explicit `=== null` check. The old logic actually
also accepted values that cast to zero, but are not zero.
This originates from a misunderstanding in a 2012 code review,
where it was suggested to use `(int)` on the non-null before
returning it. But this author did not do that, and instead created the
above complicated conditional. [1]
Change 26457, PS2:
> ```
> $count = !is_null( $edits ) ? $edits : $user->getEditCount();
> ```
> Should `? $edits` be `? intval( $edits )`?
Change 26457, PS3:
```
if ( intval( $edits ) === 0 && $edits !== 0 ) {
$edits = $user->getEditCount();
}
```
I believe the intention of the reviewer was:
```
$count = $edits !== null ? (int)$edits : $user->getEditCount();
```
[1] https://gerrit.wikimedia.org/r/c/mediawiki/core/+/26457/2
== Redundant null ==
Follows-up I62faf9d042a92. Remove another redundant ternary from
a UserEditTracker caller, in LogFormatter, as getEditCount() already
returns `int|null` based on User->getId().
Change-Id: Iaf68ec373f2458554cd028844e6531244cd28356
If we are serious about getting rid of wfGetDB(), we should start
replcing callers with proper replacement.
These classes don't have any injection so it doesn't make sense to
introduce it for this specific usecase.
Bug: T330641
Change-Id: I645f67324d441288c63787c7e42390b59106c585
Updating name & email addresses for Brooke Vibber.
Re-ran updateCredits.php as well so there are some new entries in
there as well.
There are a couple of files in resources/libs that will have to
be changed upstream to keep tests happy, I will do patches
later. :D
Change-Id: I2f2e75d3fa42e8cf6de19a8fbb615bac28efcd54
This makes the code quit a bit more readable, I believe.
strpos is especially confusing because it can return false when a
string doesn't contain the needle, as well as 0 when the string
starts with the needle. This is sometimes used as a feature (i.e. to
check if a string contains the needle, but doesn't start with it),
but that's not the case here.
A slightly more complicated change is made in TitleTest. But this is
only in a test and should verify itself when the test still succeeds.
Change-Id: I355ad1dc8e1725ae7a1eb652ec047ce7ff589cdf
Update cases where one of the IConnectionProvider methods is called
immediately.
This doesn't really change anything, but I hope it helps promote
getConnectionProvider() as the common way to do this.
Follow-up to 8604c384f6.
Change-Id: Id0e7d02bab0c570343c2b1f03c70b44ee39db112
Use ObjectFactory specifications instead of class names in
$wgLogActionHandlers, like in most other places. Class name
support is retained for B/C.
Also remove old LogPage code that assumed $wgLogActionsHandlers
is an array of callables. This is how $wgLogActionsHandlers was
defined in b6d72cfeb2, but then
4ac56c2466 redefined it to an
array of classnames (and I6846ce0 adjusted the documentation),
and the old functionality has been broken since.
Make LogFormatter::__construct() public so subclasses can be
created in the service wiring.
Technically this is a breaking change since there is no
guarantee existing formatter classes are publicly creatable,
but there is no way to issue a deprecation warning about that,
and it isn't really covered by the stable interface policy.
All non-public constructors found by codesearch are fixed in
companion patches.
Bug: T54220
Change-Id: I72427a4b3f4be1c3c1eb3522a8b58fe9445a3397
Depends-On: Ie691e8d59141f696619dce8f756645c45a3e943a
Depends-On: I41562247d51f4f9fe8dafed37ba2ad81c881d99d
Why:
* The documentation for the LoggingSelectQueryBuilder incorrectly
states to use RevisionStore::newSelectQueryBuilder. This
should be instead the DatabaseLogEntry::newSelectQueryBuilder.
What:
* Fix the documentation for LoggingSelectQueryBuilder::__construct
Change-Id: I6f07a771ed0aa41d29b407eb56555b8d25584b2a