Whether or not LogFormatter::getActionText() and friends are safe
for html depends on the runtime value of LogFormatter::$plaintext
which is beyond the abilities of phan-taint-check's static analysis
to determine. Thus this method results in a lot of false positives.
To prevent that, add an annotation that marks the method as always
safe for html. This is not ideal, but refactoring this method while
maintaining back-compat looks like it would be very challenging.
Bug: T197002
Change-Id: I9aded350ed4acc733b4fb697dd3400686a178fa9
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '
(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)
Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).
Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
Breaks some line where the ignore is not needed.
The sniff was changed upstream to be okay
with long unbreakable lines in comments
Change-Id: I2bbe2be7cedd4d3c0ce8dc3e62d0e268bc171876
If the title for a 'title' or 'title-link' type is invalid, the code
still must not return a non-array from the method.
I'm not sure this is what was behind T176938, but it's the only thing I
can find that might cause the errors I saw logged at about the same
time.
Change-Id: Iae77eb6ad9a64d8b67074164ff0c0fea36826f3c
Pass a LinkRenderer instance from SpecialLog, through LogEventsList,
onto LogFormatter instances, which tend to make many links.
Bug: T168924
Change-Id: I264da6f63678917c7335adee5a0b64cbcded66f3
It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345"
except where it doesn't, so let's just standardise on the real numbers.
Change-Id: I6f59febaf8fc96e80f8cfc11f4356283f461142a
DatabaseLogEntry::newFromRow can take both
objects and arrays (arrays are cast to objects).
An array is passed into this method in the
CheckUser extension.
Fixing this phpdoc will mean static analysis
tools will no longer detect that as an error
Change-Id: I84f35c21f8b4e3be0f5b5bd2051f566bda6544fc
The target of the right log entry is shown with namespace prefix, but it
is always a user, so skip the namespace prefix.
Change-Id: Ibe6005cc70ff3933836166d97c544267fb7d9951
This localize the protect type, level and expiry on Special:Log/protect.
To allow i18n there are some details stored in the log params of new log
items, these details also shown on API output.
The details cannot get from the old existing data, because there are
containing L10n strings therefore i18n works only for new items.
In the api and for IRC the old description text is still stored in the
log params for backward compatibility.
This allows use of gender on Special:Log. Old messages are kept for use
in IRC. Tests already exists to ensure an unchanged IRC message.
Bug: T47988
Change-Id: I3bb85c61b857972e66c99c499d7d785c88cafb25
Migrate the move protect log as first sub type of the protection log,
because it does not have complex log parameter, which needs some way of
handling/migration.
It also keeps the gerrit change smaller and hopefully makes review
easier.
The other sub types of the protection log will be migrated in a later
patch set.
This allows use of gender on Special:Log. Old message is kept for use
in IRC. A test was added to ensure an unchanged IRC message.
Bug: T47988
Change-Id: I57b3bd8a7dc823acdbb56520d2364f5542283373
Using assertSame also checks for internal types to be correct.
Needs the following fixes:
- MergeLogFormatterTest: Use correct array key order
- NewUsersLogFormatterTest: Input user id as integer
- PatrolLogFormatter: Ensure in LogFormatter that
integer is not casted to float
Change-Id: I2cab5335d6654f6cda15fc4e9fbae2c1ca1b27ff
These were flagged by mediawiki/tools/code-utils/check-vars.php
because they were located inside a switch statement, or inside an
if statement and used outside the statement. All other warnings
from that script are bogus, mostly because the script has no
support for PHP 5.3 namespaces.
Change-Id: If93bae4434b5c28845125095f6a22d6788a76efc
This allows for extensions to format their log entry parameters, and
keeps the code for formatting API log entry parameters in the same place
as for other formatting.
This also takes the opportunity to rearrange the output format slightly
to avoid conflicts like what's happening in T73020.
Bug: T35235
Bug: T73020
Bug: T91466
Change-Id: I6846ce09322eb404c506b5a51780a44ce9279fe2
You can add tags at the same time as performing action=edit, as long as you
have the "applychangetags" right. Also, you can add or remove tags after
the fact from revisions and log entries using the API action=tags.
No UI is provided for either of these changes. The target audience is user
scripts, gadgets and similar tools.
Includes a new log parameter format type: "list", for a comma-separated
list of values.
Logging of change tag events is limited to those that do not accompany an
edit (i.e. those done after the fact), and is hidden from Special:Log by
default, similar to the patrol log.
Bug: T20670
Change-Id: I37275e0f73fa3127f55da0c320b892551b61ee80
This file was not being indexed due to a parse error.
> /includes/logging/LogFormatter.php:844:
> warning: Reached end of file while still inside a (nested) comment.
> Nesting level 2 (probable line reference: 48, 26)
Change-Id: Ie34ae644d06e705991b934d4389e8c41bb7f77a7
There is no need for an extra formatter class, because at the moment
there is nothing extra to format.
This allows use of gender on Special:Log. Old messages are kept for use
in IRC. A test was added to ensure an unchanged IRC message.
The new log message for import-interwiki is used from
I3ca8b21bce49b41cac7109efb8056ca4469b88d7 to avoid "transwiki jargon".
Bug: T57404
Change-Id: I590075b203548c071a98c1eaa4b1bc9250f60e22
The CheckUser and GlobalBlocking extension are inserting the block logs
over the old logging system, where the keys are numeric.
This case is not known when building the irc line, because that was
already migrated to just get the new style.
Added compatibility code for legacy rows.
Needs the legacy flag also in ManualLogEntry to make this happen,
because it is using the LogFormatter of the new logging system to format
the actionText.
Have not found the old way for block/reblock, so just for block/block.
Bug: T92713
Follow-Up: Ibc7fcaa5a952ff90d42a6477da4baa429f3de64b
Change-Id: I08aea8399ce766e98c1a76e237169f220c6cc751
The new block log params does not known the message number 4 (which is
index 3), therefore LogFormatter::getMessageParameters adds empty index
to keep the sequence in strong order.
But the loop was starting at index 4, not 3, which skips the needed
empty index 3 for the order.
Due to the missing $4 the legacy log params returning index 3 and 4,
therefore move them one up to match the new numbers.
Also fixed undefined index warnings for api's list=logevents
Follow-Up: Ibc7fcaa5a952ff90d42a6477da4baa429f3de64b
Change-Id: Ie23be129ee2bd1d2bf753c3b5cba293d64b8e0e8
This allows use of gender on Special:Log.
Old messages are kept for use in IRC.
A test was added to ensure an unchanged IRC message.
Bug: T57402
Change-Id: Ibc7fcaa5a952ff90d42a6477da4baa429f3de64b
This allows use of gender on Special:Log
Old message is kept for use in irc,
a test is added to ensure a unchanged irc message.
Change-Id: I0557a0d2751540cf0d7967333ffd767b934011c6
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling
Change-Id: I41a84e8e1dec39170aa655250325ffc485eaeaef
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.
Change-Id: Iced714bca004756b461b66067a49a925a7e3b877
Split the variable assignment and the return statement in two lines for
better readability.
When there was two return statements in one method the logic was swapped
to have only one return statement.
Change-Id: Id7a01b4a2df96036435f9e1a9be5678dd124b0af
Also:
* Take function call out of for loop test part.
* Suppress CodeSniffer warnings for unavoidable long lines.
Change-Id: I14044f14b30d494d910541a1dac50921254a7398
Except LegacyLogFormatter.
includes/logging/LogFormatter.php is getting bigger and bigger with
the addition of new formatters when logs are changed to use them
instead of the old method, so better doing this now before we get
new formatters for remaining log types.
Change-Id: I6aab19c8d68bf47beddad42632b0360a7b12f251