aboutsummaryrefslogtreecommitdiffstats
path: root/includes/logging
Commit message (Collapse)AuthorAgeFilesLines
* Use namespaced classesUmherirrender2024-10-217-0/+9
| | | | | | | Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: I73fb416573f5af600e529d224b5beb5d2e3d27d3
* Use explicit nullable type on parameter argumentsUmherirrender2024-10-165-7/+7
| | | | | | | | | | | 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 namespace to maintenance/includes classesJames D. Forrester2024-10-091-0/+1
| | | | | | | Also a few other fixes of PHP class aliases spotted by phan. Bug: T353458 Change-Id: Ie79d65722c47c24f8f20f1293355cfd3c2e8c2ad
* Add missing documentation to class properties (frontend-related)Umherirrender2024-09-051-0/+1
| | | | | | | | | | 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
* logging: Hard-deprecate LogFormatter::newFromRow/newFromEntryUmherirrender2024-07-291-2/+4
| | | | | | Depends-On: Icd3316b7f475a09390be8787fae6a8b63dcd6418 Depends-On: I007a318135db35fc82011540b3b2baf6f358b753 Change-Id: Id2c48651e1ca28146ab6bcb57c789fae69e5c251
* Replace deprecated LogFormatter::newFromRow/newFromEntryUmherirrender2024-07-294-8/+16
| | | | Change-Id: I453ce3148a46fcb9cc5c685cee92274e0cb4f98a
* Merge "logging: Combine log types in one database condition on LogPager"jenkins-bot2024-07-201-1/+5
|\
| * logging: Combine log types in one database condition on LogPagerUmherirrender2024-07-181-1/+5
| | | | | | | | | | | | | | | | | | 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
* | Merge "i18n: Use local digits for users rename log entry"jenkins-bot2024-07-191-0/+5
|\ \
| * | i18n: Use local digits for users rename log entryEbrahim Byagowi2024-07-201-0/+5
| |/ | | | | | | | | | | | | | | | | 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
* / Add a grep helper in RenameuserLogFormatterEbrahim Byagowi2024-07-191-0/+3
|/ | | | | | | 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
* Merge "MoveLogFormatter::getPreloadTitles: Handle bad titles"jenkins-bot2024-07-181-2/+9
|\
| * MoveLogFormatter::getPreloadTitles: Handle bad titlesLucas Werkmeister2024-07-181-2/+9
| | | | | | | | | | | | | | | | | | | | | | 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
* | logging: Use `getPage()` instead of `getTitle()`Derick Alangi2024-07-131-1/+6
|/ | | | | | | 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
* TagLogFormatter: Don't depend on Message implementation detailsBartosz Dziewoński2024-06-252-5/+5
| | | | | | | You're not really supposed to know how Message represents the parameters internally. Change-Id: Ib2f31703c3c7d50ab98d64289140a1e4296d5c63
* Use namespaced classes (2)Umherirrender2024-06-1612-0/+17
| | | | | | | Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: Id9f3e775e143d1a17b6b96812a8230cfba14d9d3
* Use real type hints for services etc. in includes/page/Bartosz Dziewoński2024-06-111-0/+2
| | | | | | | | | | | | | | | | | 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
* Add namespace and deprecation alias to Xml and XmlSelectEbrahim Byagowi2024-05-161-0/+1
| | | | | | | | | | 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
* Use functions of SelectQueryBuilder for STRAIGHT_JOIN / LIMITUmherirrender2024-04-151-1/+1
| | | | Change-Id: I0324f87ebf80f1c97ab162fcef9550fef691674f
* Merge "logging: Hard-deprecate instantiating core loggers without DI"jenkins-bot2024-04-051-6/+4
|\
| * logging: Hard-deprecate instantiating core loggers without DIBartosz Dziewoński2024-04-031-6/+4
| | | | | | | | | | Bug: T356468 Change-Id: Idffbf09a32e111cf169f0e38acd178148c9bf33b
* | Merge "LogFormatterFactory: Inject LinkRenderer too"jenkins-bot2024-04-031-0/+5
|\|
| * LogFormatterFactory: Inject LinkRenderer tooBartosz Dziewoński2024-04-021-0/+5
| | | | | | | | Change-Id: I1edfc9cc4e2ad794b226b4f8be03c3846bbeb84d
* | Merge "logging: Add LogFormatterFactory"jenkins-bot2024-04-022-23/+78
|\|
| * logging: Add LogFormatterFactoryGergő Tisza2024-03-302-23/+78
| | | | | | | | | | Bug: T356468 Change-Id: I8dc2ec7993d8d5268877518c86df8c604380c8a0
* | Merge "Log duplicate translations of options-messages for HTMLFormField"jenkins-bot2024-04-011-1/+15
|\ \ | |/ |/|
| * Log duplicate translations of options-messages for HTMLFormFieldDreamy Jazz2024-04-011-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | logging: Inject services into LegacyLogFormatterUmherirrender2024-03-282-3/+13
| | | | | | | | | | Bug: T356468 Change-Id: I3cc079364f9e287d9aef66a02cbaca701ec38608
* | logging: Inject services into PageLangLogFormatterUmherirrender2024-03-281-4/+13
| | | | | | | | | | Bug: T356468 Change-Id: I593fbd8c340aa9ea75a303115d1355f3ce96be11
* | Merge "logging: Inject services into LogFormatter base class and use it"jenkins-bot2024-03-283-14/+93
|\ \ | |/ |/|
| * logging: Inject services into LogFormatter base class and use itUmherirrender2024-03-283-14/+93
| | | | | | | | | | | | | | | | Using the same technique as used for SpecialPage base class with setter for each used service. Bug: T356468 Change-Id: I5269633bb7389c48f807ce164f85b21d7d5954cc
* | Use a different message for preloaded reason field on Special:MovePageMatěj Suchánek2024-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "MoveLogFormatter: Don't show revert link if the destination doesn't ↵jenkins-bot2024-03-191-1/+1
|\ \ | | | | | | | | | exist"
| * | MoveLogFormatter: Don't show revert link if the destination doesn't existMatěj Suchánek2024-03-151-1/+1
| |/ | | | | | | | | | | | | 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
* / Standardise all our class alias deprecation comments for ease of greppingJames D. Forrester2024-03-191-4/+1
|/ | | | Change-Id: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
* Replace last remaining wfGetDB() calls in core, except ResourceLoaderJames D. Forrester2024-02-141-2/+8
| | | | | Bug: T330641 Change-Id: I6d30af6ff9f667e367d39befb80c2bb0bf5fb29e
* Merge "logging: Clarify meaning of `userToolLinks($edits)` parameter"jenkins-bot2024-02-141-3/+1
|\
| * logging: Clarify meaning of `userToolLinks($edits)` parameterTimo Tijhof2024-02-131-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | == 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
* | Move away from wfGetDB() callsAmir Sarabadani2024-02-122-3/+4
|/ | | | | | | | | | | 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
* Update name & email for bvibberBrooke Vibber2024-02-083-3/+3
| | | | | | | | | | | | | 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
* Namespace includes/contextJames D. Forrester2024-02-084-0/+7
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* Merge "Use native str_contains/str_starts_with in a few more places"jenkins-bot2024-01-251-1/+1
|\
| * Use native str_contains/str_starts_with in a few more placesthiemowmde2024-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Replace more instances of unchecked MWExceptionDaimona Eaytoy2024-01-231-2/+1
| | | | | | | | | | | | | | | | Most (all?) of the remaining usages are caught somewhere and will be migrated later. Bug: T328220 Change-Id: I5c36693a5361dd75b4f1e7a0bab5ad48626ed75c
* | Change uses of getDBLoadBalancerFactory() to getConnectionProvider()Bartosz Dziewoński2024-01-223-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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 8604c384f624273f46b653ec252ffaed30e6ff89. Change-Id: Id0e7d02bab0c570343c2b1f03c70b44ee39db112
* | Support dependency injection in log formattersGergő Tisza2024-01-202-35/+35
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 b6d72cfeb2d10801f0aebdda9545e2d6cfc83255, but then 4ac56c2466594875a0bee5086b4028dc53e6753b 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
* Allow MergeHistory to split up joined revisions with same timestampPppery2024-01-051-1/+8
| | | | | Bug: T183501 Change-Id: Iedd818a83838683fb07334aade11754557828062
* Migrate remaining Database::insert calls to InsertQueryBuilderAmir Sarabadani2023-12-222-14/+11
| | | | | | | | | Tests are not checked. There is nothing left as far I can check. Bug: T353219 Change-Id: I1d58397118c7ab1110b9d7cf400c59c4bff7378c
* Use InsertQueryBuilder in ManualLogEntryThomas Chin2023-12-121-5/+14
| | | | | Bug: T353219 Change-Id: Ibebb3b92f9ed6a69688a7357cec813ffc33fbd16
* Fix documentation for LoggingSelectQueryBuilderDreamy Jazz2023-11-291-1/+1
| | | | | | | | | | | | 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