aboutsummaryrefslogtreecommitdiffstats
path: root/includes/specials/pagers/ContribsPager.php
Commit message (Collapse)AuthorAgeFilesLines
* specials: Remove constructor PHPdoc blockUmherirrender2025-02-201-10/+0
| | | | | | The doc block is identical to the type declaration for each argument. Change-Id: I8281b94351fe2be30344f1425a60f31fbf205100
* Introduce ContributionsRangeTrait for handling IP range limitsThalia2024-11-081-27/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * Some contributions special pages and APIs accept an IP range target, with a configured limit, RangeContributionsCIDRLimit. * ContribsPager::isQueryableRange is a static utility method for checking an IP range against the limit. This is an awkward place to have the utility, which is needed in other places, e.g. ContributionsSpecialPage. * Now that contributions pages in the CheckUser extension also need to use it, it is a good time to move it to an includable trait. What: * Introduce ContributionsRangeTrait, with methods for checking the validity of an IP (range) target against the configured limit. * Use the trait in ContribsPager and ContributionsSpecialPage, and remove the static method ContribsPager::isQueryableRange, which was marked internal. * Don't yet use it in APIs, to contain the scope of this commit. Bug: T378111 Change-Id: I77cf1873f681b426523f62f2806ecde35fc5cc45
* Use explicit nullable type on parameter argumentsUmherirrender2024-10-161-8/+8
| | | | | | | | | | | 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
* Revert "Revert "Add ContributionsPager, an abstract parent for ContribsPager""Thalia2024-05-131-712/+17
| | | | | | | | | This reverts commit e6fb3df2a639ca95afdec2255f1da63187ba71c6. This re-instates I08a5d39036047484e3b44fcd83989072006b88e2. Bug: T363358 Change-Id: I847c60a493d9973554ceb1232f3799c42321ee2b
* Revert "Revert "ContribsPager: Refactor getQueryInfo for extending""Thalia2024-05-131-24/+32
| | | | | | | | | This reverts commit c973e8d5191c3f7a3577aed6c1455b8846625cfc. This re-instates Icdbbb3523de6479f5645c4c9988147290c839c50. Bug: T363358 Change-Id: I72f0bb23f6469fe5aef44a7bfaf7370d16ff6fb4
* Revert "ContribsPager: Refactor getQueryInfo for extending"DannyS7122024-05-091-32/+24
| | | | | | | | | | | This reverts commit 67eedd7833a6cb9423ed5df7887ebfe0da5b8c8c. Reason for revert: needed to revert parent breaking change, which caused T364569 Bug: T364569 Bug: T363358 Change-Id: I1a2885cfcca3594aa97c5222622b8277149570a7
* Revert "Add ContributionsPager, an abstract parent for ContribsPager"DannyS7122024-05-091-17/+712
| | | | | | | | | | This reverts commit e1ffed0af6937576e2bb267786d0608a201e7531. Reason for revert: breaking change, caused T364569 Bug: T364569 Bug: T363358 Change-Id: I08a5d39036047484e3b44fcd83989072006b88e2
* Add ContributionsPager, an abstract parent for ContribsPagerThalia2024-05-091-712/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * For the temporary accounts project, we will make some changes to how user contributions can be viewed, including showing global contributions (T337089) and showing contributions from temporary accounts using the same IP (T358852). * We will create new pagers that re-use logic from ContribsPager. These will behave similarly to ContribsPager, but will get the revisions using a different query. What: * Make ContribsPager extend a new abstract parent class, ContributionsPager. * ContributionsPager: - handles filtering on edit type (minor, etc), namespace, tag, date and user permissions (e.g. hiding suppressed revisions) - runs the hooks that ContribsPager used to run, and keeps the same names for backwards compatability - handles displaying results - provides an abstract method getRevisionQuery for a subclass to specify where the revision comes from. (Examples are the `revision` table or the `cu_changes` table, but in the future this could also include archive.) * ContribsPager: - handles an IP range target by using the ip_changes table - includes some public static functions that are kept for backwards compatability. (Future work could put them somewhere more appropriate.) Scope: * ContributionsPager is designed to select (existing) revisions. It could be abstracted out further to handle deleted revisions from the archive table, to help bring feature parity to Special:DeletedContributions. This is left out of scope for this patch. * To keep the scope limited and the commit history clean, this patch doesn't attempt to fix the various TODOs in ContribsPager, or update old styles that are used. Bug: T363358 Change-Id: I85bb28c9d85426ecc82c533a0cdd3f010c247b02
* ContribsPager: Refactor getQueryInfo for extendingThalia2024-05-071-24/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | Why: * For the temporary accounts project, we will make some changes to how user contributions can be viewed, including showing global contributions (T337089) and showing contributions from temporary accounts using the same IP (T358852). * We will create new pagers that re-use logic from ContribsPager. These will do almost the same as ContribsPager, but will get the revision from a different table. What: * This patch prepares for separating out a parent class that will do most of the work that ContribsPager currently does. * Split out getRevisionQuery from getQueryInfo, so that a subclass can fetch revisions using a different table. Scope: * ContrbsPager hasn't been updated to use a SelectQueryBuilder. Updating this is kept out of scope for this work, since this is a high traffic page with a complicated query that has a history of becoming slow when changed (see existing comments inline). Bug: T363358 Change-Id: Icdbbb3523de6479f5645c4c9988147290c839c50
* Migrate to IReadableDatabase::newSelectQueryBuilderUmherirrender2024-05-051-5/+9
| | | | | | | | | This cases cannot benefit from the SelectQueryBuilder as each argument get processed by hooks with fix signature or coming from abstract functions providing the arguments separate. Bug: T344971 Change-Id: I6490caae3984efaae81bd2583220a7dd1c3b371d
* Use expression builder to avoid raw sql via BETWEEN operatorUmherirrender2024-04-211-2/+3
| | | | | | Replace BETWEEN with >= and <= operator Change-Id: Ic21b6f4cc11c773c967d9d4c5f20e762c2ff9629
* ContribsPager: Add getTagInvert public methodThalia2024-04-161-0/+7
| | | | | | | | | | getTagFilter is already a public method, but it's not that useful without getTagInvert, which returns whether the tags should be included or excluded. This is done now because it is needed for If6747a5134d6553647. Change-Id: I87bc57dbc193aa42293fcda66092dff40d533b33
* ContribsPager: Display user links if the author is not the targetThalia2024-04-081-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Why: * ContribsPager accepts an IP range as a target. In this case, the author of each revision is different from the target (the author is an IP within the range, not the whole range). ContribsPager therefore adds user links to the revision line, so the user can see the author of each revision. * Currently, ContribsPager only does this for an IP range, since that is the only example known to core of an author not matching the target. However, extensions can modify the query conditions, so may return results where the author isn't the target. Instead ContribsPager should just add the user links whenever the author is different from the target. * For an example of an extension changing the query, see T361866. What: * Add the user links to a revision line if the author is different from the target, instead of checking for an IP range target. Bug: T361869 Change-Id: I80b9c944f73cd8fe27cd54fd27cd9f6c33c92744
* Namespace includes/contextJames D. Forrester2024-02-081-1/+1
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* Change more uses of getDBLoadBalancerFactory() to getConnectionProvider()Bartosz Dziewoński2024-01-231-1/+1
| | | | | | | | | | | Some less trivial cases. Also update variable names. 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: I6657d783375fac5c7fa856b884ff1fb09285e94c
* Bump codesniffer to 42.0.0Amir Sarabadani2023-09-271-1/+1
| | | | | | Most noisily, this enables MediaWiki.Arrays.OneSpaceInlineArray. Change-Id: I8ab11399c67ce7e3ab1b6249b591452774393428
* Namespace Config-related classes under \MediaWiki\ConfigJames D. Forrester2023-09-211-1/+1
| | | | | Bug: T166010 Change-Id: I4066885a7ea071d22497abcdb3f95e73e154d08c
* Namespace Sanitizer under \MediaWiki\ParserJames D. Forrester2023-09-211-1/+1
| | | | | Bug: T166010 Change-Id: Id13dcbf7a0372017495958dbc4f601f40c122508
* Namespace NamespaceInfo under \MediaWiki\TitleJames D. Forrester2023-09-191-1/+1
| | | | | | | One of the big ones, so doing this alone. Bug: T166010 Change-Id: Ibe103cd362535d3cb94cb8931e95fc74099d1497
* Namespace 'special' Pagers under \MediaWiki\PagerJames D. Forrester2023-09-181-2/+19
| | | | | | | | | | 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/+2
| | | | | Bug: T166010 Change-Id: Ibe12d1754709d48f71edd4cde1f13a542344a21e
* Use real type hints for services etc. in pagersUmherirrender2023-09-111-19/+6
| | | | Change-Id: I6d2fba4aed30d7767474ec6ffc58ac728e6e67d5
* Cleanup SpecialContributions and ContribsPagerFunc2023-08-291-5/+7
| | | | | | | | Also, make ContribsPager::isQueryableRange() static to avoid premature access to SpecialContributions::getPager() when its $opts property is not fully populated. Change-Id: I80145fb71ed205b0ae52955e48739ac4bcbc0a83
* Remove deprecated ActorMigration usages around ContribsPagerFunc2023-08-251-14/+2
| | | | Change-Id: I1a4224eac8bad47f7228faf68ea7f9c7d44a44ad
* Merge "Cache some more repeated messages in changes lists"jenkins-bot2023-08-191-2/+3
|\
| * Cache some more repeated messages in changes listsMatěj Suchánek2023-08-191-2/+3
| | | | | | | | Change-Id: I635eaf947280fd1071e308b19715d581e1c1cb15
* | ContribsPager: Put tag parsing behind an in-process cacheMatěj Suchánek2023-08-171-5/+16
|/ | | | | | | | | | | | | | | | Apply the idea promoted in a468534 to Special:Contributions. If a user uses an external tool (or just the visual editor), they are likely to do it repeatedly during a period of time. In turn, their edits will be tagged with the same set of tags. Instead of parsing the tags from scratch again and again, memoize the result for use by subsequent calls. Thanks to WikimediaDebug, I could reproduce a request to Special:Contributions?limit=500 where 28% (1.6s) of request time was spent in ChangeTags::formatSummaryRow. This change should reduce it to less than 0.1s. Change-Id: If81d7b5359f798f0b630ab1ad5b6282d0d9d9a55
* pagers: Make some pagers operate on IReadableDatabasesTaavi Väänänen2023-06-081-2/+2
| | | | Change-Id: I3714e05b64d73a5cd87b3b052d8cb036cdc8ca64
* Remove left-over complexity in SpecialPage classes for query groupsTimo Tijhof2023-05-021-1/+0
| | | | | | | No longer used as of I7a31a07a8c3f1e265ac43ab59f23326590b407c3. Bug: T263127 Change-Id: Ie58c0bb2ed8ff5b0fc6d4e42256010eb825fd9dd
* Specials: Mass switch everything to IConnectionProvider from LBAmir Sarabadani2023-04-191-5/+5
| | | | | Bug: T330641 Change-Id: Ie1772da59f92213fea598f02385c3e0ac6d200a7
* Reorg: Namespace the Title classJames D. Forrester2023-03-021-0/+1
| | | | | | | | | | | | | | | | | | | This is moderately messy. Process was principally: * xargs rg --files-with-matches '^use Title;' | grep 'php$' | \ xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1' * rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \ xargs rg --files-with-matches 'Title\b' | \ xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1' * composer fix Then manual fix-ups for a few files that don't have any use statements. Bug: T166010 Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
* Reorg: Move HTML-related classes out of includes/ to Html/Amir Sarabadani2023-02-161-0/+2
| | | | | Bug: T321882 Change-Id: I5dc1f7e9c303cd3f5b9dd7010d6bb470d8400a18
* Remove obsolete Rdbms query groups from getConnection callsTimo Tijhof2023-02-151-5/+2
| | | | | | | | | | | | | | | The currently supported groups are documented in database.md. While at it, prefer the string form of the $groups parameter where possible, since the complexity of an array is never utilized, as the groups either can't overlap, or are decided on by the caller instead. This also helps with the simpler LBFactory::getConnection() proposed in T326274. Bug: T263127 Bug: T326274 Change-Id: I7a31a07a8c3f1e265ac43ab59f23326590b407c3
* pager: Allow getting range offsets outside the subclass contextFunc2023-02-121-0/+3
| | | | | | | | Extensions implemented the onContribsPager__reallyDoQuery() hook can use these new methods to limit the query range. Bug: T167577 Change-Id: Ieda822f9ccffea179796f48929f02a75ee01fb95
* Fix history pager toolsGergő Tisza2022-12-221-13/+7
| | | | | | | | | | | | | | | | | | | | | | Follows up Ia03038e86c6a607c8b75eefedbf0285ca1a2f8c8. * Only generate a rollback link for the latest revisions in ContribsPager. * Gate the entire ChangesList::insertPageTools beind the RC attribs check, not just the rollback link generation. * In ContribsPager::formatRow, check for the existence of $page in a more reasonable place. This was already broken before Ia03038e so I suspect $page is never null in practice (in theory, a ContribsPager__reallyDoQuery hook handler could somehow produce a $row with no title information), but it can't hurt. * Add some documentation and FIXMEs. * Remove a comment from ChangesList - part of it is not true anymore after Ia03038e, part of it already didn't make sense before that. Bug: T51541 Bug: T325753 Change-Id: If848e38b568492579382a2c920cb865fb0326d99
* Merge "pager: Remove ProtectedHookAccessorTrait from IndexPager"jenkins-bot2022-12-161-1/+1
|\
| * pager: Remove ProtectedHookAccessorTrait from IndexPagerUmherirrender2022-12-161-1/+1
| | | | | | | | | | | | | | No longer needed after injection of all services to the pagers The non-internal getHookContainer function is now deprecated. Change-Id: I2283c202aba669f42f6fa8c670142faf97c378af
* | Reorg: Move ActorMigration and ActorMigrationBase to user/Amir Sarabadani2022-12-161-0/+1
|/ | | | | | | | | This may seem a bit weird but anything else related to actor is already under user/ including ActorCache, ActorNormalization, ActorStore and ActorStoreFactory. Bug: T321882 Change-Id: I7072b374bba7a0cd9d905e399c822bf30bd5c0d8
* Generalize History pager tools for use in other contextsJon Robson2022-12-151-12/+13
| | | | | | | | | | | | | | | | | | | The history page renders an extensible list of tools for each change list row. I've factored this code out so that it can also be used on other pages that use the Pager class. This generalizes the logic for the rollback link and makes sure the control is standardized across pages. It also allows the onHistoryTools hook run. I suggest we rename this to something more generic in a follow up. Right now usages of onHistoryTools are low but there should be no issues with running it on more than the history page. One of the benefits of this is the thanks link will now show on the contributions page, watchlist and recent changes. Bug: T51541 Change-Id: Ia03038e86c6a607c8b75eefedbf0285ca1a2f8c8
* Special:Contributions: Let the tag filter be inverteddvrandecic2022-12-121-1/+8
| | | | | | | | | | | This adds a check box to Special:Contributions to expose the feature to 'invert' the existing tag filter and passes this inversion through as an exclusion to the back end, so that a tag can be excluded from the results. Bug: T119072 Bug: T174349 Change-Id: I34c864f25dfc199f6b32feb3025cb53e4ea050ce
* Reorg: Move DummyLinker and Linker to linker/Amir Sarabadani2022-12-081-0/+1
| | | | | | | This feels like a no-brainer unless I'm missing something obvious Bug: T321882 Change-Id: Id49c3d0dd6ea4593211048850856b5b8e05a8fb3
* Merge "Use short array destructuring instead of list()"jenkins-bot2022-10-211-3/+3
|\
| * Use short array destructuring instead of list()Tim Starling2022-10-211-3/+3
| | | | | | | | | | | | | | | | Introduced in PHP 7.1. Because it's shorter and looks nice. I used regex replacement. Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
* | Use the null coalescing assignment operatorTim Starling2022-10-211-1/+1
|/ | | | | | | | Available since PHP 7.4. Automated search, manual replacement. Change-Id: Ibb163141526e799bff08cfeb4037b52144bb39fa
* Remove references to revision_actor_temp, aliased as temp_rev_userUmherirrender2022-09-061-4/+1
| | | | | | | | The alias temp_rev_user was used by RevisionStore::getQuryInfo Bug: T215466 Follow-Up: I66b2cb8653252e720c897351065978119f040ba7 Change-Id: I4b4c2afbe942ad36fd96f3d9c604c836ffc6d8f7
* Call IContextSource::getAuthority instead of IContextSource::getUserUmherirrender2022-06-291-3/+3
| | | | | | | Change to use Authority object where possible to use the interface instead of implementation Change-Id: Ia7e9ce2a2f05ef2ae1cf981bf96faf48b04cf58d
* Merge "Start clean up of revision_actor_temp table"jenkins-bot2022-05-231-9/+0
|\
| * Start clean up of revision_actor_temp tableAmir Sarabadani2022-05-231-9/+0
| | | | | | | | | | | | | | It is being dropped in production Bug: T215466 Change-Id: I66b2cb8653252e720c897351065978119f040ba7
* | Wrap navigation in <div class="mw-pager-navigation-bar"> in all pagersBartosz Dziewoński2022-05-211-13/+0
|/ | | | | Bug: T308364 Change-Id: Ia0253e2553ff58c852f189e052344cf2f9fe1957
* ContribsPager: Update index hint to use revision table in READ NEWAmir Sarabadani2022-05-161-1/+4
| | | | | | | | We finished migration and now it should hint on the correct index on revision table. Bug: T307295 Change-Id: Ie2fa9f7be158b88cb8ea063735224de716852e52