aboutsummaryrefslogtreecommitdiffstats
path: root/includes/logging
Commit message (Collapse)AuthorAgeFilesLines
...
* Namespace remaining files under includes/deferredJames D. Forrester2023-11-221-0/+1
| | | | | Bug: T166010 Change-Id: Ibd40734b96fd2900e3ce12239d09becfb4150059
* Migrate off wfGetDB() in more places to ICPAmir Sarabadani2023-11-202-4/+3
| | | | | | | | | | | | | | | | | This function is uber-deprecated, meaning even its replacement is deprecated, We have already migrated in static functions and more. In this batch, all calls have been migrated that there is already a call to MediaWikiServices::getInstance() making the migration easier. Of course in most cases, they should eventually turn into proper service injection but this at least makes it clear what services should be injected. Also removing "category" group since we are removing all groups except a handful from mw (see T263127 for more information). Bug: T330641 Change-Id: I90cd35ee45a37eb6e6bf7a531cc8f75effbd0328
* Migrate all non-API code to use expression builder instead of buildLikeAmir Sarabadani2023-11-071-2/+8
| | | | | Bug: T210206 Change-Id: Icf3a2c5e5fb40ff31c65ba182937510d44186e46
* Merge "Put tag parsing behind an in-process cache in more views"jenkins-bot2023-10-301-4/+15
|\
| * Put tag parsing behind an in-process cache in more viewsMatěj Suchánek2023-10-051-4/+15
| | | | | | | | | | | | | | Apply a468534 to Special:NewPages, Special:Log and action=history. Bug: T341319 Change-Id: I48faf3b1b19132204f8a079b292974ce20b1ba73
* | Mass migrate simple cases to use expression builderAmir Sarabadani2023-10-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Done via '([A-Za-z_\.]+) ?(=|!=|<|<=|>|>=) ?' . (\$db(?:r|w|))->addQuotes\( (.+?) \) to: $3->expr\( '$1', '$2', $4 \) And '([A-Za-z_\.]+) IS NULL OR ([A-Za-z_\.]+) ?(=|!=|<|<=|>|>=) ?' . (\$db(?:r|w|))->addQuotes\( (.+?) \) to: $4->expr( '$1', '=', null )->or\( '$2', '$3', $5 \) Bug: T210206 Change-Id: I109bf2a712bdefa9e074f775b1bee41ac5b9d665
* | Use IReadableDatabase over IDatabase in DatabaseLogEntry::newFromIdDreamy Jazz2023-10-112-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * The DatabaseLogEntry::newFromId method only uses the provided DB for SELECT queries (via the DatabaseLogEntry ::newSelectQueryBuilder method). * The DatabaseLogEntry::newSelectQueryBuilder method takes a IReadableDatabase object and this is the only usage of the DB provided to ::newFromId * As such, the ::newFromId type should be IReadableDatabase instead of IDatabase so that callers who only have a readable database connection can still use this method. What: * Change the type of the $db parameter of DatabaseLogEntry ::newFromId to be a IReadableDatabase instead of an IDatabase. * Update RCDatabaseLogEntry::newFromId to reflect the change in parameter type. * Update the associated tests to use a IReadableDatabase. Change-Id: Idc6c13b147a5ff99d0969c1120eb1deb2d111496
* | logging: Fix non-escaped messages used in rights logUmherirrender2023-10-061-1/+1
|/ | | | | | | $groups is array of messages from Language::getGroupMemberName, which are processed with Message::text() there and need escaping here. Change-Id: I594f7e53baabd69fbb750695879b2c8acb8f2efe
* Remove ip handling for RecentChange from ManualLogEntryUmherirrender2023-09-301-12/+2
| | | | | | | RecentChange::checkIPAddress would take the request ip when no ip is given, that works for anon as well Change-Id: I2b86ced735125d6000bc703ec09103a957ccb11b
* Introduce ChangeTagsStore::modifyDisplayQueryBuilder()Amir Sarabadani2023-09-271-28/+19
| | | | | | | | To deprecate ::modifyDisplayQuery() and unblock a lot of migrations to SelectQueryBuilder. Bug: T344971 Change-Id: Icb9265644bdbc0b30e2a419ae0103f0e78fe90bd
* Introduce LoggingSelectQueryBuilderAmir Sarabadani2023-09-252-10/+73
| | | | | | | | | | To replace DatabaseLogEntry::getSelectQueryData() Many migrations can't happen right now because of use of ChangeTagsStore::modifyDisplayQuery() but I will fix that soon. Bug: T344971 Change-Id: Iafb2bb5ea3a0da49da1dafb69b65dea3c15029ed
* LogEventsList: Allow filtering logs by imported actorsFunc2023-09-241-0/+1
| | | | | | | | | This works directly, but the importer would mangle the actor name's first letter of interwiki prefix to upper case, which can be fixed separately. Bug: T344978 Change-Id: I026ee23b70b7cddcdec2500911e0f407c7b2b387
* Namespace Sanitizer under \MediaWiki\ParserJames D. Forrester2023-09-211-0/+1
| | | | | Bug: T166010 Change-Id: Id13dcbf7a0372017495958dbc4f601f40c122508
* Namespace User under \MediaWiki\UserJames D. Forrester2023-09-194-0/+4
| | | | | Bug: T166010 Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
* Namespace remaining 'specialpage' files under \MediaWiki\SpecialPageJames D. Forrester2023-09-1810-0/+12
| | | | | | | SpecialPageFactory is already here, but none of the others were yet. Bug: T166010 Change-Id: I9689bf0a1ab329625e23669b99f019b96295fffd
* Namespace 'special' Pagers under \MediaWiki\PagerJames D. Forrester2023-09-182-1/+14
| | | | | | | | | | They're under 'specials' because that's where they're mostly used, but they're just another kind of Pager (shown by their use outwith the MediaWiki\Specials hierarchy, which is a bad code smell for us to review later). Bug: T166010 Change-Id: Iad3f91582b723c1e6679525aa852ffdfd8c6d5ba
* Namespace core Pagers under \MediaWiki\PagerJames D. Forrester2023-09-181-0/+1
| | | | | Bug: T166010 Change-Id: Ibe12d1754709d48f71edd4cde1f13a542344a21e
* pagers: Move lookup from getStartBody to doBatchLookupsUmherirrender2023-09-111-16/+10
| | | | Change-Id: I5646a280c434c91533eecdbc5c25e6076c9df3a0
* Remove redundant empty() constructs (2)Daimona Eaytoy2023-09-082-2/+2
| | | | | | | | | | | | | empty() only makes sense when the expression it checks is possibly undefined, otherwise it's equivalent to a truthiness check with the additional downside of suppressing errors when it's not wanted. Replace it with simple truthiness checks, using strict comparison when that seems to help with polymorphic variables. These were caught by a bespoke phan plugin. Change-Id: I70b629dbf9e47cf3ba48ff439b18f19e839677f4
* Remove redundant empty() constructsDaimona Eaytoy2023-09-081-1/+1
| | | | | | | | | | | | | empty() only makes sense when the expression it checks is possibly undefined, otherwise it's equivalent to a truthiness check with the additional downside of suppressing errors when it's not wanted. Replace it with simple truthiness checks, using strict comparison when that seems to help with polymorphic variables. These were caught by a bespoke phan plugin. Change-Id: I52999e5286a0d9ad70b0da40b41b9f998ecb990e
* Reorg: Move three output related classes to includes/Output/Amir Sarabadani2023-09-051-0/+1
| | | | | | | | | | And namesapce them: - StreamFile - OutputHandler - OutputPage Bug: T321882 Change-Id: Iedf8d88c595e580f2d8f0734c92aa5c45618ba33
* Migrate calls to wfGetDB() in static methodsAmir Sarabadani2023-09-051-1/+1
| | | | | | | | | | | | | wfGetDB() has been deprecated since 1.39 (or more?) and it's better to inject LBF and call ::getReplicaDatabase() or ::getPrimaryDatabase() which is not straightforward in classes but for static functions, there is no way to inject the method so we can simply call MediaWikiServices::getInstance()->getDBLoadBalancerFactory() While I was here, I migrated one call to SelectQueryBuilder. Bug: T330641 Change-Id: Idd2278cef647035dce05a2d461a620e145fe1167
* Merge "LogEventsList: Allow showing entries by non-existent users"jenkins-bot2023-08-271-1/+0
|\
| * LogEventsList: Allow showing entries by non-existent usersFunc2023-08-251-1/+0
| | | | | | | | | | | | | | Align with the behaviour of Special:Contributions. Bug: T344773 Change-Id: I8d3f89cd338649ee9ccb62ae044150def0bfc389
* | Reorg: Move Status to MediaWiki\Status\Amir Sarabadani2023-08-251-0/+1
|/ | | | | | | | | | This class is used heavily basically everywhere, moving it to Utils wouldn't make much sense. Also with this change, we can move StatusValue to MediaWiki\Status as well. Bug: T321882 Depends-On: I5f89ecf27ce1471a74f31c6018806461781213c3 Change-Id: I04c1dcf5129df437589149f0f3e284974d7c98fa
* ManualLogEntry: Drop setTags(), deprecated in 1.33James D. Forrester2023-08-241-20/+0
| | | | Change-Id: I38a36ef8a888a016aa37bd250c768ff086297029
* build: Remove unneeded newline from one line condition/foreachUmherirrender2023-08-221-4/+2
| | | | | | Improve readability Change-Id: I22ed08bbd8d821c4d4df620af4c5e97b043c305a
* Merge "LogEventsList: Remove the @stable to call notation on the constructor"jenkins-bot2023-08-221-4/+0
|\
| * LogEventsList: Remove the @stable to call notation on the constructorFunc2023-07-131-4/+0
| | | | | | | | | | | | | | | | All use cases are only for instancing LogPager which is not correct to do in extensions and will be fixed within T266480. Bug: T266480 Change-Id: Ic97680326442915f567a9ccd30f4f20ada5e5263
* | Avoid DB access in more non-Database testsDaimona Eaytoy2023-08-061-2/+1
| | | | | | | | | | Bug: T155147 Change-Id: Iae2512c66c32b209ea8579beecb3de94a744da14
* | Merge "changetags: Use LogPage::DELETED_RESTRICTED in ChangeTagsLogItem"jenkins-bot2023-07-261-3/+3
|\ \
| * | changetags: Use LogPage::DELETED_RESTRICTED in ChangeTagsLogItemUmherirrender2023-07-241-3/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | ChangeTagsLogItem::canView is used to detect if the log entry can be shown at all to the user, this is the case for all users when the log entry does not contains suppressed parts. When there are suppressed parts the user must have permissions for it to see the log entry. It needs just one suppressed part like user name, not all as the constant indicates. The check for all is not necessary and the called function does not work like that. This reverts the change to this file from 8a26fa05 Change-Id: Ia9cc015315ede4bcb96095a2f439842cf7102f72
* / Remove isRegistered checks from some UserEditTracker callersThalia2023-07-241-1/+1
|/ | | | | | | | | | | | | | * PageEditStash and UserGroupManager: remove the isRegistered check, which isn't necessary since UserEditTracker will just return null for users not in the `user` table. Instead handle a possible null return value. * LogFormatter: keep the check, to avoid instantiating the UserEditTracker if not necessary, but check getId instead of isRegistered, since the check is really for whether the user is in the `user` table, regardless of their registered status (e.g. they may be a temporary user). Change-Id: I62faf9d042a9297bcd662f7908d73d8469b26c98
* Merge "logging: Improve documentation of log parameter handling"jenkins-bot2023-07-124-24/+49
|\
| * logging: Improve documentation of log parameter handlingGergő Tisza2023-07-124-24/+49
| | | | | | | | Change-Id: Ib23a1afe2bc0b90fcf9291935b6ed019669494e8
* | Merge "Cleanup LogEventsList"jenkins-bot2023-07-042-57/+31
|\ \
| * | Cleanup LogEventsListFunc2023-06-302-57/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LogEventsList::showOptions() never supports multiple log type, only the frist one in array would be used, so changed to accept string and simplified related methods. Decoupled it with LogPager a bit by not setting allowed actions from LogPager. Change-Id: Iab3eb4f1606a5a41934a5569ebf1377ed7f0b362
* | | Merge "LogEventsList: Remove support of deprecated usage of hooks"jenkins-bot2023-07-042-32/+8
|\| |
| * | LogEventsList: Remove support of deprecated usage of hooksFunc2023-06-302-32/+8
| | | | | | | | | | | | | | | | | | | | | The third parameter of LogEventsListGetExtraInputs hook was deprecated since 1.32. Change-Id: I59cb8488c45c54ea6e2710ddaf0aca3a3656733b
* | | SpecialLog: Fix issues related to IP usersFunc2023-07-031-0/+3
|/ / | | | | | | | | | | | | | | Bug introduced in I370dcca6 and I7e9ad460, sorry. Bug: T338042 Bug: T340929 Change-Id: Ia9d74caa93eb03ea11fb22265ac7b47334689988
* | SpecialLog: Fix some interface issues (follow-up to commit 2ac0720)Func2023-06-191-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | 1. Using WebRequest::setVal() for subpage syntax and user namespace fallback, so HTMLForm can prefill inputs correctly. 2. Only set the title and log type description when the type is valid. Also, fixed a bug in subpage syntax parsing when having two parts but the first part is not a valid log type, e.g. Special:Log/foo/bar Bug: T338042 Change-Id: I7e9ad46060d2f2fe65af25c4bc0dd94c736647ce
* | SpecialLog: Enable built-in validation of HTMLFormFunc2023-06-142-96/+43
|/ | | | | | | | | | | | | | | | Enable built-in validation of HTMLForm by removing the `default` parameter of each field, HTMLForm now will prefill fields when we set the second param of setFormIdentifier() to true for GET form. Also removed unused params of getOption() since the only caller is SpecialLog. And inlined some very short private helpers. Note: User creation logs would not actually be filtered out if all checkboxes are unchecked even without this patch, I will have another fix for that. Bug: T338042 Change-Id: I370dcca6c2c21c62c67c204fbcb78a27ebc58117
* language: Annotate list() methods as preserving taintednessDaimona Eaytoy2023-05-201-15/+18
| | | | | | | | | | | | | The $list parameter to the various *list() methods is not escaped by these methods, so any taintedness in the argument is preserved by the method and kept in the return value. taint-check has troubles figuring this out on its own due to T274780, so annotate the parameters. Note: once this is merged, taint-check could start failing on some repos. Any errors would have a decent chance of being true positives. Bug: T253879 Change-Id: I6cf56aca9760370cbeae19879e6b170b1cbd273f
* Fix escaping in BlockLogFormatterDaimona Eaytoy2023-05-201-4/+4
| | | | | | | | | | The code uses rawParams, so we need to make sure that the value is already escaped. Escaping it before feeding it to listToText also ensures that there's no double escaping, as listToText escapes the separator. Bug: T332889 Change-Id: I832400bcce845ac98e36fa1cfb4a15bc94cdbf27
* Replace internal Hooks::runnerUmherirrender2023-05-113-5/+11
| | | | | | | | | The Hooks class contains deprecated functions and the whole class is going to get removed, so remove the convenience function and inline the code. Bug: T335536 Change-Id: I8ef3468a64a0199996f26ef293543fcacdf2797f
* api: Switch to use IConnectionProviderAmir Sarabadani2023-04-241-2/+1
| | | | | | | As much as possible Bug: T330641 Change-Id: Icb943d6d65b210760ba8966419327c9603e768e0
* Fix Phan suppressions related to Title::castFrom*() and friendsBartosz Dziewoński2023-04-221-2/+1
| | | | | | | | | | | | | | | | | | | | | There is no way to express that Title::castFromPageIdentity(), Title::castFromPageReference() and Title::castFromLinkTarget() can only return null when the parameter is null. We need to add Phan suppressions or explicit types almost everywhere that these methods are used with parameters that are known to not be null. Instead, introduce new methods Title::newFromPageIdentity() and Title::newFromPageReference() (Title::newFromLinkTarget() already exists), without the null-coalescing behavior, and use them when the parameter is not null. This lets static analysis tools, and humans, easily understand where nulls can't appear. Do the same with the corresponding TitleFactory methods. Change the obvious uses of castFrom*() to newFrom*() (if there is a Phan suppression, a type check, or a method call on the result). Change-Id: Ida4da75953cf3bca372a40dc88022443109ca0cb
* Specials: Mass switch everything to IConnectionProvider from LBAmir Sarabadani2023-04-192-4/+0
| | | | | Bug: T330641 Change-Id: Ie1772da59f92213fea598f02385c3e0ac6d200a7
* Show title for unknown log actionsBrandonXLF2023-04-111-15/+18
| | | | | | | | | Show the page title beside unknown log actions in the log. Also show the action's key instead of just the name of the action to better identify the action. Bug: T64722 Change-Id: Ie1643aab99b9217327075e0d2a38c109f63255a0
* Rename PHP classes to match filenamesFomafix2023-03-161-1/+1
| | | | | | | | | | | | | Also change the letter case in the file names to be consistent to other files in includes/specials. The PHPCS exclude-pattern for these files on MediaWiki.Files.ClassMatchesFilename.NotMatch can now removed. The old class names are still available as aliases and are deprecated now. Change-Id: Id71f5a5ce456caf522c95c477487e14f366c1b40