aboutsummaryrefslogtreecommitdiffstats
path: root/includes/pager/IndexPager.php
Commit message (Collapse)AuthorAgeFilesLines
* Use explicit nullable type on parameter argumentsUmherirrender2024-10-161-2/+2
| | | | | | | | | | | 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
* pager: Use SelectQueryBuilder::rawTables in IndexPagerUmherirrender2024-05-071-1/+1
| | | | | | | | | UsersPager defines a "join group", which is not supported by SelectQueryBuilder::tables Bug: T364428 Follow-Up: I6490caae3984efaae81bd2583220a7dd1c3b371d Change-Id: I27e4de5d2d114fd8b0bfb86ca28278e16108c959
* Migrate to IReadableDatabase::newSelectQueryBuilderUmherirrender2024-05-051-1/+8
| | | | | | | | | 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
* Standardise all our class alias deprecation comments for ease of greppingJames D. Forrester2024-03-191-4/+1
| | | | Change-Id: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
* Namespace includes/contextJames D. Forrester2024-02-081-2/+2
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* Change uses of getDBLoadBalancerFactory() to getConnectionProvider()Bartosz Dziewoński2024-01-221-1/+1
| | | | | | | | | | | | 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
* Switch to ICP in some easy casesAmir Sarabadani2023-09-261-4/+4
| | | | | Bug: T330641 Change-Id: I84454d0e42a0faef1b17a79d2ba3cc96db8782ca
* Namespace core Pagers under \MediaWiki\PagerJames D. Forrester2023-09-181-0/+12
| | | | | Bug: T166010 Change-Id: Ibe12d1754709d48f71edd4cde1f13a542344a21e
* Reorg: Move WebRequest to includes\RequestAmir Sarabadani2023-09-111-0/+1
| | | | | | | This has been approved as part of RFC T166010 Bug: T321882 Change-Id: I6bbdbbe6ea48cc1f50bc568bb8780fc7c5361a6f
* Drop IndexPager::getHookContainer(), deprecated in 1.40James D. Forrester2023-08-231-11/+0
| | | | Change-Id: I79a431c7957cde45b1bfc17d72dcfb311e4e8462
* Fix DB usage in non-database testsDaimona Eaytoy2023-07-211-1/+3
| | | | | | | | | | | | | | | | | | | Some non-database tests are currently accessing the database. Fixing them means either avoiding the DB access if it's possible and makes sense for the test, or adding the `Database` group otherwise. In particular: - Replace global/static functions with services in a couple places to make testing easier. - RevisionRendererTest needs to be in the Database group due to heavy global state usage (including DB) by Parser - ActionFactoryIntegrationTest and SpecialPageFatalTest should be in the database group because they test many different classes, and some of which may use the database in the tested methods. - SpecialUserLogoutTest must be in the database group because of User. - Some pager tests are using wfGetDB directly. Change-Id: I96eb2acf9a2cbfd17e81225db2773d5e8e30260b
* IndexPager: Also protect against $offset being 0Taavi Väänänen2023-06-301-2/+2
| | | | | | | | | The parameter is takes ints too, and apparently $offset != '' does not guard well enough against offset being zero. The new `if ( $offset )` check should catch at least `null`, `''`, `'0'` and `0`. Bug: T313157 Change-Id: Ibf340fd9b4ffddb65cdb1ca4ec227b235906e310
* Remove left-over complexity in SpecialPage classes for query groupsTimo Tijhof2023-05-021-1/+1
| | | | | | | No longer used as of I7a31a07a8c3f1e265ac43ab59f23326590b407c3. Bug: T263127 Change-Id: Ie58c0bb2ed8ff5b0fc6d4e42256010eb825fd9dd
* Remove deprecated pager methods/classesBartosz Dziewoński2023-03-221-89/+0
| | | | | | | | | | | Deprecated in MW 1.39: * Ic75bd597b210e14612ca3aebb531b659897e8294 * I4e2f36b543462aa5d852733da650fb70d49ebf06 Hard-deprecated in MW 1.40: * I09e9203b19e3808af9348db8a889d5e118282230 Change-Id: I17bd8f80e87a04674e826d7966aa3ddb011fc7ba
* Hard-deprecate deprecated pager methods/classesBartosz Dziewoński2023-03-151-4/+4
| | | | | | | | | | Deprecated in MW 1.39 in commits: * Ic75bd597b210e14612ca3aebb531b659897e8294 * I4e2f36b543462aa5d852733da650fb70d49ebf06 Depends-On: I8b3adfe907ae16279ec3d480b7eedec5901884f2 Depends-On: I376361bc86a6085fe94a5439b04239ab123a515c Change-Id: I09e9203b19e3808af9348db8a889d5e118282230
* 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/+1
| | | | | Bug: T321882 Change-Id: I5dc1f7e9c303cd3f5b9dd7010d6bb470d8400a18
* pager: Remove ProtectedHookAccessorTrait from IndexPagerUmherirrender2022-12-161-2/+11
| | | | | | | No longer needed after injection of all services to the pagers The non-internal getHookContainer function is now deprecated. Change-Id: I2283c202aba669f42f6fa8c670142faf97c378af
* Revert "Reorg: Move some of request related classes to MediaWiki/Request"Zabe2022-10-271-2/+1
| | | | | | | | | This reverts commit 2bdc0b2b7209441a42a784157633a8a01b321922. Reason for revert: T166010#8349431 Bug: T166010 Change-Id: Idcd3025647aec99532f5d69b9c1718c531761283
* Reorg: Move some of request related classes to MediaWiki/RequestAmir Sarabadani2022-10-261-1/+2
| | | | | | | | | | | | | Moving: - DerivativeRequest - FauxRequest - FauxRequestUpload - PathRouter - WebRequest - WebRequestUpload Bug: T166010 Change-Id: I5ea70120d745f2876ae31d039f3f8a51e49e9ad8
* Use short array destructuring instead of list()Tim Starling2022-10-211-2/+2
| | | | | | | | Introduced in PHP 7.1. Because it's shorter and looks nice. I used regex replacement. Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
* build: Update mediawiki/mediawiki-phan-config to 0.12.0Daimona Eaytoy2022-10-081-0/+1
| | | | | | | | This patch only adds and removes suppressions, which must be done in the same patch as the version bump. Bug: T298571 Change-Id: I4044d4d9ce82b3dae7ba0af85bf04f22cb1dd347
* pager: Clean up file headers and `@ingroup`Timo Tijhof2022-09-291-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Follows similar commits to the objectcache, rdbms, filerepo, jobqueue components and other areas [1]. * Remove duplicate descriptions from file blocks in favour of class doc blocks. This reduces needless duplication and was often incorrect or outdated, and helps (ironically) to make the file header more consistently visually ignorable. * Remove `ingroup` from file blocks in class files as otherwise the file is indexed twice (e.g. in Doxygen) which makes navigation more messy. * Fix non-standard `@unstable for implementation` annotations in favour of `@stable to type` as per T257789 and <https://www.mediawiki.org/wiki/Stable_interface_policy>. While at it, fix the only other outstanding uses of `@stable for` in core as well in a handful of context/, logging/ and search/ files. [1] https://gerrit.wikimedia.org/r/q/message:ingroup+owner:Krinkle Bug: T257789 Change-Id: Ided3c5ab69e1b587b1b76a3c97a7cdb88f21e130
* IndexPager: $offsets may be shorter than $columnsBartosz Dziewoński2022-09-191-0/+3
| | | | | | | Follow-up to ec79aa394312d62b598ad29601e2c80eaaf0dd19. Bug: T318080 Change-Id: I87f6b0eee3de884226ff13f54a0638a4629ecf83
* Merge "SQLPlatform: Introduce buildComparison()"jenkins-bot2022-09-131-59/+2
|\
| * SQLPlatform: Introduce buildComparison()Bartosz Dziewoński2022-09-101-59/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Builds a condition comparing multiple values, for use with indexes that cover multiple fields, common when e.g. paging through results or doing batch operations. Can also be to generate a simple comparison without writing raw SQL (see T210206). Update a few manually constructed conditions to use this method. There are more maintenance scripts and API classes that use the same patterns, but this is a start. As you can see by the code I'm replacing, there are many ways to do this. I picked the one used by maintenance/TableCleanup.php, since I found it the easiest to understand. Change-Id: Ic368a87fb5ce4c13608b03206cd68518ec9732d4
* | Restore compatibility with overrides for IndexPager::makeLink()Bartosz Dziewoński2022-09-121-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extensions like CheckUser expect IndexPager::makeLink() to be used for displaying the navigation links of the pager, and it was marked as '@stable to override'. If IndexPager::makeLink() is overridden, it will be called instead of PagerNavigationBuilder::makeLink(). This behavior is considered deprecated. Also mark PagerNavigationBuilder::makeLink() as protected and '@stable to override', to provide a migration path. Users can now override IndexPager::getNavigationBuilder() to return a subclass of PagerNavigationBuilder, and override makeLink() on that subclass. Follow-Up: cfd6ffe7bbadf8177da34460930ca4780bd38524 Bug: T317477 Change-Id: I4e2f36b543462aa5d852733da650fb70d49ebf06
* | Merge "IndexPager: Fix paging with setIncludeOffset and multiple index fields"jenkins-bot2022-09-061-1/+7
|\|
| * IndexPager: Fix paging with setIncludeOffset and multiple index fieldsBartosz Dziewoński2022-09-041-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using `setIncludeOffset( true )`, queries generated by the pager use `>=` or '<=' for the index field instead of `>` or `<`, in order to include the specified offset in the results. However, when the index covers multiple fields (indicated by `getIndexField()` returning an array or arrays), this must be only done for the last field. Otherwise the conditions become redundant, and effectively only the first field of the index is compared. In short: (A, B) >= (1, 2) is equivalent to: ((A > 1) OR (A = 1 AND B >= 2)) and not: ((A >= 1) OR (A = 1 AND B >= 2)) Change-Id: I44f975cdd7b8bdd243b6d5968ee0b8d1cb953292
* | Introduce PagerNavigationBuilder for making pagination linksBartosz Dziewoński2022-09-051-8/+56
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We had several implementations of almost identical paging links: * PrevNextNavigationRenderer: The nicest one, somewhat recently added (4ca72763ec). Unfortunately it was also the least featureful: only supporting paging by numeric offset and not by index, and not able to generate "first"/"last" links. Also, I didn't realize that it exists when working on 94553a1bcb and b95d208340, so it was missing those changes too. * IndexPager/ReverseChronologicalPager/AlphabeticPager: These have been here forever. The most featureful, but not configurable, so a large part of the implementation was copy-pasted in two classes. * SpecialWhatLinksHere: Through some accident of history, this one special page ended up with its own implementation??? They are all replaced to use the new PagerNavigationBuilder. It may be slightly too much, but I had fun writing it. Notable changes compared to PrevNextNavigationRenderer: * Adds <div class="mw-pager-navigation-bar"> wrapper around the navigation and <span class="…"> wrappers on inactive links * The current limit link is made inactive (like the "prev" link when on first page, etc.) Notable changes compared to ...Pager/...Pager/...Pager: * Does not generate useless tooltips that contain only the title of the page, can use custom tooltips * The current limit link is made inactive (like the "prev" link when on first page, etc.) * All links have query parameters in a consistent order: ?title= &... &dir= &offset= &limit= (some of them are optional) These changes affect many special pages and actions. I tested on: * Special:Contributions (ReverseChronologicalPager) * action=history (ReverseChronologicalPager) * Special:Categories (AlphabeticPager) * Special:WantedPages (PrevNextNavigationRenderer) * Special:Search (PrevNextNavigationRenderer) * Special:WhatLinksHere Bug: T308364 Change-Id: Ic75bd597b210e14612ca3aebb531b659897e8294
* IndexPager: Wrap inactive paging links in <span class="…">Bartosz Dziewoński2022-05-231-22/+21
| | | | | Bug: T308364 Change-Id: Icf3597604ea100b2fce2f47fe5057cbfd12b96ed
* Push down date header code from IndexPager to ReverseChronologicalPagerBartosz Dziewoński2022-02-281-102/+1
| | | | | | | | | | | | | | | | Follow-up to ed63ede6575056e1 (Iaa55eab57f76), I didn't think of this in code review. In IndexPager, we're not necessarily paging by timestamp, and the things we're paging might not even *have* timestamps (e.g. consider CategoryPager used on Special:Categories), so it seems wrong to have this code there. (Maybe some kind of headers could be useful, but there's currently no such use case, and the could would need to be made a bit more abstract anyway.) Change-Id: I5263375f0d9dd98fd37c40a1333f4154c2b41e98
* ReverseChronologicalPager: Fix displaying date headers for non-revisionsBartosz Dziewoński2022-02-221-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | * Instead of hardcoding rev_timestamp, use the field name from 'mIndexField'. In ReverseChronologicalPager, this should always be some kind of a timestamp. Flow rows on Special:Contributions don't actually represent revisions from a database query, and don't have a rev_timestamp field; but they have a field with the name defined by 'mIndexField', because it was needed for compatibility with other core code. It is set here: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/Flow/+/c120ce4ec18941b931505d4a896682fb8e388395/includes/Formatter/AbstractQuery.php#221 * Add a way to disable grouping by dates. Previously they only appeared for pagers that paged by rev_timestamp, but now any subclasses of IndexPager could have date headers, and most of them don't expect that. Change the only three pagers that worked before to explicitly opt-in. * Fix an issue where some pagers had a stray `</ul>` tag at the beginning due to mismatched getStartGroup() and getEndGroup() calls. Follow-up to ed63ede6575056e1d8ec3b28d4704152b8366f48. Bug: T302343 Change-Id: I18822d249b2e04a7408f2cdc5375e84e411ffa26
* ReverseChronologicalPager pages have list headers grouping by datejdlrobson2022-02-151-3/+117
| | | | | | | | | | | | | | These list headers are added to the HTML but hidden by default. They are needed for the mobile version which displays headers for better scannability. However the change will only display on: * Special:Contributions * history page * Special:MergeHistory Bug: T298638 Change-Id: Iaa55eab57f761c9be780aba79cf2b9b212d91657
* Styles should be added to all IndexPagersJon Robson2022-01-111-0/+1
| | | | | | | | | | | TablePager extends IndexPager to add styles to the page However, these styles need to be added to the history page too which uses the HistoryPager where extends IndexPager. Follow up to I0cba011f0ab8cb8fd59962b5eafb7650deefe841 Bug: T298636 Change-Id: I9648308b1c1eb1a544f138c1fcf5e7cd155d172f
* Deprecate `mediawiki.pager.tablePager` module for more generic modulejdlrobson2022-01-071-0/+11
| | | | | | | All pagers sthould share `mediawiki.pager.styles` module Bug: T298636 Change-Id: Idb0c7017407cee5c6b625d39c12219d6ddc9e2db
* IndexPager: Add @since notation to getDatabase()Reedy2021-09-291-0/+2
| | | | | | | | Because I looked it up, I might aswell commit it. Moved in 84ce626df616029f1c0b4c24c4b5ee42ff5ca38f Change-Id: I646aa8a4272a5d93c628c2282b0b4d5a13b68ed9
* Introduce CommentFormatterTim Starling2021-09-281-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CommentParser: * Move comment formatting backend from Linker to a CommentParser service. Allow link existence and file existence to be batched. * Rename $local to $samePage since I think that is clearer. * Rename $title to $selfLinkTarget since it was unclear what the title was used for. * Rename the "autocomment" concept to "section link" in public interfaces, although the old term remains in CSS classes. * Keep unsafe HTML pass-through in separate "unsafe" methods, for easier static analysis and code review. CommentFormatter: * Add CommentFormatter and RowCommentFormatter services as a usable frontend for comment batches, and to replace the Linker static methods. * Provide fluent and parametric interfaces. Linker: * Remove Linker::makeCommentLink() without deprecation -- nothing calls it and it is obviously an internal helper. * Soft-deprecate Linker methods formatComment(), formatLinksInComment(), commentBlock() and revComment(). Caller migration: * CommentFormatter single: Linker, RollbackAction, ApiComparePages, ApiParse * CommentFormatter parametric batch: ImageHistoryPseudoPager * CommentFormatter fluent batch: ApiQueryFilearchive * RowCommentFormatter sequential: History feed, BlocklistPager, ProtectedPagesPager, ApiQueryProtectedTitles * RowCommentFormatter with index: ChangesFeed, ChangesList, ApiQueryDeletedrevs, ApiQueryLogEvents, ApiQueryRecentChanges * RevisionCommentBatch: HistoryPager, ContribsPager Bug: T285917 Change-Id: Ia3fd50a4a13138ba5003d884962da24746d562d0
* Cleanup mixed space/tab line indentUmherirrender2021-09-041-1/+1
| | | | Change-Id: I833052a656b1ce419c0929f6f0514f2a33c2c4cc
* Hard deprecate User::getIntOption()Alexander Vorwerk2021-08-111-1/+3
| | | | | | | deprecated since 1.35 and unused Bug: T274211 Change-Id: If739492953ee53a39c81894c48f16be81c845542
* Use more neutral or alternative languageReedy2021-03-201-2/+2
| | | | | Bug: T277987 Change-Id: Iafc4b3e3137936046487119b7e17635f4e560277
* Use static closures where safe to useUmherirrender2021-02-111-1/+1
| | | | | | | | | This is micro-optimization of closure code to avoid binding the closure to $this where it is not needed. Created by I25a17fb22b6b669e817317a0f45051ae9c608208 Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
* IndexPager - document getLinkRendererDannyS7122020-12-141-0/+4
| | | | | | | | | Had to look through git blame to find when it was added (1.34) for a recent review, would be helpful for others if it was easily available in a doc block; since I'm adding a doc block, also add @return Change-Id: I07c4cdda176f309204fa3c2cfe6c165d1df850af
* Merge "Replace "@stable for subclassing" with "@stable to extend""jenkins-bot2020-07-131-1/+1
|\
| * Replace "@stable for subclassing" with "@stable to extend"daniel2020-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | For compliance with the new version of the table interface policy (T255803). This patch was created by an automated search & replace operation on the includes/ directory. Bug: T257789 Change-Id: Ie32c1b11b3d16ddfc0c83a757327d449ff80b2e4
* | Merge "Replace "@stable for calling" by "@stable to call""jenkins-bot2020-07-131-1/+1
|\ \
| * | Replace "@stable for calling" by "@stable to call"daniel2020-07-131-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | For compliance with the new version of the table interface policy (T255803). This patch was created by an automated search & replace operation on the includes/ directory. Bug: T257789 Change-Id: If560596f5e1e0a3da91afc36e656e7c27f040968
* / Replace "@stable for overriding" with "@stable to override"daniel2020-07-131-17/+17
|/ | | | | | | | | | | For compliance with the new version of the table interface policy (T255803). This patch was created by an automated search & replace operation on the includes/ directory. Bug: T257789 Change-Id: I5ffbb91882ecce2019ab644839eab5e8fb8a1c5f
* Mark pager base classes as stable for subclassing.daniel2020-07-081-0/+40
| | | | | | | | | This makrs Pager baseclasses as stable for subclassing per the Stable Interface Policy. This also indicates which of the methods defined by the base classes can safely be overwritten by extensions. Bug: T247862 Change-Id: If1e0a35427b55d72c86f8f2530bd47aa4130fa92
* Whitespace cleanup: Use tabs for indentation, avoid double spacesDannyS7122020-06-271-3/+7
| | | | Change-Id: I346073b59d283029bd6666356c62c81e687ea5e6