aboutsummaryrefslogtreecommitdiffstats
path: root/includes/pager
Commit message (Collapse)AuthorAgeFilesLines
...
* | Drop IndexPager::getHookContainer(), deprecated in 1.40James D. Forrester2023-08-231-11/+0
|/ | | | Change-Id: I79a431c7957cde45b1bfc17d72dcfb311e4e8462
* Reorg: Move MWTimestamp to MediaWiki\UtilsAmir Sarabadani2023-08-192-0/+3
| | | | | Bug: T321882 Change-Id: I48c10343295c4eb3d9ef8037343b0070e928f040
* 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
* Merge "Fix some typos"jenkins-bot2023-03-231-1/+1
|\
| * Fix some typosMatěj Suchánek2023-03-211-1/+1
| | | | | | | | | | Bug: T201491 Change-Id: I5c9408c262f09c936525f35abfacfa92a193b791
* | 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
* Merge "htmlform: Skip array query parameter on HtmlForm::addHiddenField"jenkins-bot2023-03-101-0/+5
|\
| * htmlform: Skip array query parameter on HtmlForm::addHiddenFieldUmherirrender2023-02-101-0/+5
| | | | | | | | | | | | | | Also exclude them in TablePager::getHiddenFields Bug: T321471 Change-Id: Iedcb9071e6543d08d14336a2e96711675b6f5811
* | 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-163-0/+4
| | | | | | | | | | Bug: T321882 Change-Id: I5dc1f7e9c303cd3f5b9dd7010d6bb470d8400a18
* | Merge "pager: Provide a method to override the timestamp field"jenkins-bot2023-02-142-9/+19
|\ \
| * | pager: Provide a method to override the timestamp fieldFunc2023-02-132-9/+19
| |/ | | | | | | | | | | | | | | Subclass can override it to provide the timestamp field if they are using a aliased field for getIndexField() Bug: T325943 Change-Id: I239b771888437f9016102e4da64747d956cfbf23
* / pager: Allow getting range offsets outside the subclass contextFunc2023-02-122-0/+21
|/ | | | | | | | Extensions implemented the onContribsPager__reallyDoQuery() hook can use these new methods to limit the query range. Bug: T167577 Change-Id: Ieda822f9ccffea179796f48929f02a75ee01fb95
* 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
* RangeChronologicalPager: Restore the compatibility with derived classesFunc2022-12-131-5/+14
| | | | | | | | | Derived classes may expect that $rangeConds is defined and would read from or write to it. Bug: T228431 Bug: T325034 Change-Id: I49f1001a8675323ce4f2fe4b30dff66b4680712c
* pager: Fix navigations when date range is setFunc2022-12-102-57/+51
| | | | | | | | | | | The main idea here is to make ReverseChronologicalPager not mess up mOffset which IndexPager uses, store the offset in another variable and add separate query conditions. Also, make RangeChronologicalPager more cooperative with its parent class, avoid unnecessary inconsistency. Bug: T228431 Change-Id: Icf76c946770aacee5b038522c066fca33ed1546f
* Merge "pager: Remove unused AlphabeticPager::getOrderTypeMessages() support"jenkins-bot2022-11-021-36/+0
|\
| * pager: Remove unused AlphabeticPager::getOrderTypeMessages() supportTimo Tijhof2022-10-291-36/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was introduced in March 2008 with r32228 (ad178edb80) for use in the CategoryPager of Special:Categories, but almost immediately removed again from there, on the same day, in r32259 (bdf9431795) because it wasn't actually supported by the underlying DB index. There has been no other use of it to my knowledge. Removing without deprecation as such. Note that (theoretical) use will not result in visible breakage as the public stability is limited to implementing (not calling) the method. Calling is private and the only caller is removed in this commit. The call to setExtra() is removed as well as it is now always empty, which is identical to the default in PagerNavigationBuilder, and there are no other calls to setExtra before this point that this was removing or replacing data for. Bug: T321551 Change-Id: I161dc0159e4372e3478341ee3fbea13b723d9fc1
* | Merge "pager: Fix null used for foreach in Pager::getNavigationBar"jenkins-bot2022-10-291-14/+15
|\|
| * pager: Fix null used for foreach in Pager::getNavigationBarUmherirrender2022-10-251-14/+15
| | | | | | | | | | | | | | | | | | Pager::getOrderTypeMessages can return null, when not needed. In this case for Special:ProtectedTitles the array from getIndexField has only one element, where no order type messages are provided/needed. Bug: T321551 Change-Id: I45ab06e1eb83d292ff82a64af8734db22d91198c
* | Merge "Revert "Reorg: Move some of request related classes to ↵jenkins-bot2022-10-271-2/+1
|\ \ | | | | | | | | | MediaWiki/Request""
| * | 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
* | | Merge "Reorg: Move some of request related classes to MediaWiki/Request"jenkins-bot2022-10-271-1/+2
|\| |
| * | 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
* / specials: RangeChronologicalPager has to use first index columnUmherirrender2022-10-261-2/+4
|/ | | | | | | | A array to string conversion is done at the moment and the colum "Array" is showing up in the sql. Bug: T321679 Change-Id: Idc87b0e329ee386ebf0c154bbaed23c46c117a44
* Use short array destructuring instead of list()Tim Starling2022-10-212-3/+3
| | | | | | | | 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-296-24/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-053-59/+71
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Migrate use of ${var}-style string interpolationMáté Szabó2022-07-291-1/+1
| | | | | | | | The "${var}" and "${expr}" style string interpolations are deprecated in PHP 8.2. Migrate usages in core to "{$var}" as appropriate. Bug: T314096 Change-Id: I269bad3d4a68c2b251b3e71a066289d4ad9fd496
* IndexPager: Wrap inactive paging links in <span class="…">Bartosz Dziewoński2022-05-231-22/+21
| | | | | Bug: T308364 Change-Id: Icf3597604ea100b2fce2f47fe5057cbfd12b96ed
* Wrap navigation in <div class="mw-pager-navigation-bar"> in all pagersBartosz Dziewoński2022-05-212-20/+25
| | | | | Bug: T308364 Change-Id: Ia0253e2553ff58c852f189e052344cf2f9fe1957
* pager: Improve Y2K38 check to keep leading zero in 3-digit yearsUmherirrender2022-04-131-3/+3
| | | | | | | | | | (int) removes the leading zero from '0720-01-05', just check it as string. Add test for the Y2K38 check Bug: T287621 Change-Id: I83400066ee4ab58c1c27ca1041c495dc0e16531f
* ReverseChronologicalPager: Group by dates in the user's timezoneBartosz Dziewoński2022-02-281-31/+11
| | | | | Bug: T298638 Change-Id: I00fd9765ca0a27d5295bfd0337df951f47d8c8c1
* Merge "Push down date header code from IndexPager to ReverseChronologicalPager"jenkins-bot2022-02-282-103/+91
|\
| * Push down date header code from IndexPager to ReverseChronologicalPagerBartosz Dziewoński2022-02-282-103/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Fix various documentation related to null typesUmherirrender2022-02-261-1/+1
|/ | | | | | | | The functions returning null or the class property is set explict null Found by phan strict checks Change-Id: I4a271093fb6526564d8083a08249c64cb21f2453
* ReverseChronologicalPager: Fix displaying date headers for non-revisionsBartosz Dziewoński2022-02-222-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | * 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-152-3/+157
| | | | | | | | | | | | | | 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-112-1/+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-072-7/+15
| | | | | | | All pagers sthould share `mediawiki.pager.styles` module Bug: T298636 Change-Id: Idb0c7017407cee5c6b625d39c12219d6ddc9e2db