Commit graph

154 commits

Author SHA1 Message Date
Fomafix a62550b687 Get mode from data-ct-options instead of data-ct-mode
The attribute data-ct-options already contains the mode and attribute
data-ct-mode is just redundant. The attribute data-ct-mode is now not
needed anymore and removed from the rendered HTML.

Change-Id: If261f3cdab6c55243e80dc2ef3caa884538b02bc
2024-11-04 12:08:22 +00:00
Ammarpad a925bb10cd Fix handling of self-closing tag
self closing tag <categorytree/> is invalid, but where encountered
the content of the tag is null.

Convert the null to empty string since CategoryTree::getTag require one

Bug: T378765
Change-Id: Iede4499952295b75a19bd05a5963caab00a9cadd
2024-11-01 12:41:17 +01:00
Andre Klapper 63688178e9 Use explicit nullable type on parameter arguments (for PHP 8.4)
Implicitly marking parameter $... as nullable is deprecated in PHP
8.4. The explicit nullable type must be used instead.

Bug: T376276
Change-Id: I40bb7a0a02aaa467cbf0ae182adf5601ccbcb58e
2024-10-26 14:43:49 +02:00
Umherirrender 113ece0e54 Use namespaced PPFrame class
Change-Id: I5fff88a0c944cfbda33ffcab1bb6a01e5440a52a
2024-10-19 23:22:14 +02:00
jenkins-bot bcdc686cac Merge "Stay on mode=categories after the first submit with all namespaces" 2024-10-10 16:45:11 +00:00
jenkins-bot 9399909bf3 Merge "Trigger CategoryTree::setHeaders only if subcategories available" 2024-10-10 16:45:10 +00:00
jenkins-bot fbc82558e8 Merge "Remove duplicate/unnecessary trim" 2024-10-10 16:45:07 +00:00
jenkins-bot 4d2836760f Merge "Move all Parser handling to Hooks::parserHook" 2024-10-10 16:45:06 +00:00
jenkins-bot ee0a3f1aab Merge "Remove $allowMissing and make the check directly on the hook" 2024-10-10 16:01:18 +00:00
Fomafix 7f52cbc5b7 Stay on mode=categories after the first submit with all namespaces
After the first submit the URL contains &namespaces= with empty value.
This must be handled like a missing URL parameter.

Restore the default value '' removed in aec8d755.

Bug: T334289
Change-Id: I22d0eb334365472d411252f805d0d78a3cc265ab
2024-10-10 14:20:23 +00:00
jenkins-bot 7aaf9f42be Merge "Replace use of getDirMark with HTML markup" 2024-10-05 17:32:34 +00:00
Ebrahim Byagowi fcc3334125 Make category links arrow link to actual categories
I believe having arrows linked to the actual pages can
be much more useful than linking to '#' of the same
page. Linking to the correct page makes user to notice
if the page is already visited also using color of
the arrow.

If we didn't like link visited logic to be not used we
could've used a different link rather than color of links
and going makes us able to :visited logic of
If8b2b45b24351ee5c8fc9ee1380563f5d5b88678 also.

Personally however I'm in believe that having a useful
link that can be opened on a different tab using
Ctrl (or long click on phones) is always more useful.

Change-Id: Ib56fad0b711853d67b2d55617b36deff56141c74
2024-10-05 00:48:31 +03:30
Fomafix 092797b0e2 Remove duplicate/unnecessary trim
CategoryTree::makeTitle also makes a trim and an early return.

A trim on the return value of renderChildren() is not needed.

Change-Id: I1fc2705277491797eb6c0d0900152b63913ca875
2024-10-04 19:55:50 +00:00
Fomafix 921e6fe3f9 Move all Parser handling to Hooks::parserHook
Change-Id: I5d35c6d87b610ffb566588a3d0c75067c1d06962
2024-10-04 19:55:24 +00:00
Fomafix a918bdea16 Remove $allowMissing and make the check directly on the hook
This change avoids a super category expand button on not existing
categories.

This change even avoids loading the modules if there are no valid
categories.

Change-Id: I38a2b49aaef7cf46d9f89e1cc9fd65e2382155f5
2024-10-04 19:53:37 +00:00
Ebrahim Byagowi fe71840c56 Replace use of getDirMark with HTML markup
Bug: T375975
Depends-On: I2ee6d8fb9161a5434eacad819c6d7784aee8aac3
Change-Id: Ia1ab65222c486ea89e6b916fd1d5a6860439205e
2024-10-04 22:06:26 +03:30
Fomafix b1e3b5f06d Update namespaces of PHP classes
Change-Id: I8c4e81631b4c3f7321837e12713a8a33762a8fcc
2024-10-03 19:55:44 +00:00
jenkins-bot b0d8410812 Merge "Use IConnectionProvider instead of ILoadBalancer" 2024-09-10 16:41:38 +00:00
Fomafix 58afeaf93c Use IConnectionProvider instead of ILoadBalancer
Change-Id: Id1071e0a61030c2ddd01fecebf6bf8a99c5948e0
2024-09-04 13:28:31 +00:00
Fomafix f5f1f7de39 Use new hook OutputPageRenderCategoryLink
The new hook OutputPageRenderCategoryLink gets triggered on rendering a
single category.

This change prevents wgCategories = [] on
$wgCategoryTreeHijackPageCategories = true.

Bug: T372155
Depends-On: Id82a77a57d1f12233d974ea4c1b093f50c5ab74f
Change-Id: Ic86f210474cbc0e2dcebf664cf2309a4a4408f60
2024-09-03 09:50:34 +00:00
Fomafix 033b9cc159 Use namespaced FormatJson class
This change requires MediaWiki 1.43+.

Change-Id: I5a9a0eb10372b6464985e5a9cd564ff12536fea1
2024-08-22 12:53:23 +00:00
Fomafix 6b65422769 ApiCategoryTree: Use config from $this->getConfig().
An injection of ConfigFactory/Config and the ConfigRegistry are not
needed anymore.

Change-Id: Ie20675981a019fe300cf84e7a16a191c0431b922
2024-08-21 18:09:26 +00:00
Fomafix 42e31c3054 Use MainConfigNames
Change-Id: I81eb011f303dbaacc30ee3d8ac27c4a7bf10615a
2024-08-20 20:14:05 +00:00
Fomafix 8fe224cd60 Use PHP types
* Add PHP type hints where possible.
* Remove @var, @param and @return if redundant to type declaration
* Remove redundant type conversions which are now enforced by type
  hints.
* Enforce that decodeBoolean returns only a bool.

Change-Id: I8da84ed4dc778dd9d84f8d9eec0a399f5ed26405
2024-08-20 08:16:37 +00:00
Umherirrender 3e2ce8c6f4 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I51931c3aab6aa1e5bc77b3cc83b8014cf557ff75
2024-06-08 23:29:21 +02:00
jenkins-bot b42252b37b Merge "Show a deprecation warning if parameter onlyroot is used" 2024-06-03 16:25:59 +00:00
Fomafix e6c9eab90f Use namespaced PHP classes
These namespaces are available since MediaWiki 1.42 which is already
required in extension.json.

Change-Id: If72d77a5440516beeac637b4baf06e9b4c672e8a
2024-05-22 20:11:23 +00:00
Fomafix 15a2d717d5 Show a deprecation warning if parameter onlyroot is used
The parameter onlyroot is deprecated since July 2008.

Generate a tracking category for tracking the deprecation.

Bug: T290062
Change-Id: I8eb58fa7831e11e6a6719f11fb1ff310666cdc4e
2024-05-20 07:49:47 +00:00
Umherirrender d8f77953a1 Migrate to IReadableDatabase::newSelectQueryBuilder
RIGHT JOIN is unsupported by SelectQueryBuilder, swapped to LEFT JOIN

Bug: T312395
Change-Id: Idd646422dc6c984d7ceab23743e53e64bccb987c
2024-04-25 20:21:57 +02:00
Fomafix 40f3638412 Trigger CategoryTree::setHeaders only if subcategories available
This avoids loading the modules if they are not needed.
Multiple calls of CategoryTree::setHeaders doesn't matter.

Change-Id: I96f8ffa7cf1d5274a6853403c0f2422b684db61f
2024-04-08 18:43:19 +00:00
libraryupgrader b779ae7026 build: Updating dependencies
composer:
* mediawiki/mediawiki-phan-config: 0.12.1 → 0.14.0

npm:
* grunt-banana-checker: 0.11.0 → 0.11.1

Change-Id: Ib661c3c07825d151bb817a219f3104afbf30ec4b
2024-02-10 10:23:34 +00:00
jenkins-bot b63356e087 Merge "Make the toggle reachable by keyboard" 2024-02-07 14:38:32 +00:00
Nardog 08a23b5c26 Make the toggle reachable by keyboard
Bug: T355636
Change-Id: Ie765cddd664933fa07638c661874bef80782dd45
2024-02-05 06:53:05 +00:00
Umherirrender 1f16baa471 Add return type hint to function in ServiceWiring.php
This is a common pattern for service wiring functions

Change-Id: Ia63bd9a5397b0ea4563f5bb426ed925fc0c40efc
2024-01-31 20:55:00 +01:00
Fomafix 9206c5368b Inject service DBLoadBalancerFactory
Change-Id: I50195f98c2ea130f9dba73e357977653c2fc1a37
2023-11-14 13:40:30 -05:00
Fomafix c63d5da014 Replace global variables by injected Config
Convert some functions to non-static function to access the Config
object.

Change-Id: Iac3d6a6c00eef169aec91b8c367cbbb7359a9b02
2023-11-14 07:15:35 +00:00
Fomafix e492044e44 Inject service LinkRenderer into CategoryTree
Change-Id: Id70e9b26229332889de009b55837dbab6ecbb163
2023-10-29 09:28:03 +00:00
Fomafix e81f6fe15e Move option handling from CategorieTree into new class OptionManager
Change-Id: I0327f7ea6751cdb714308f1ffaf0ab7ac44a3aac
2023-10-29 09:26:56 +00:00
Fomafix 292f21fc38 Get parameters from config instead of global variable in getDataForJs()
Change-Id: Ie01fa1181f6c0878686f056e0a70f89766c090e6
2023-10-05 09:56:03 +00:00
Fomafix 75c2c5580a Simplify PHP code
Change-Id: Ia1bd08cd972b2f5792d24d5fbc383c3c63b000db
2023-10-03 19:38:03 +00:00
Fomafix 8bd82c12f6 Use namespaced classes
Change-Id: I9fabf791aae691dfa7d071a1d99d17f4f7379682
2023-10-03 09:36:31 +00:00
Fomafix b2ef67d9c8 Replace deprecated wfGetDB( DB_REPLICA )
Bug: T330641
Change-Id: Ic2dc694bbb29c3ff315f2be32c24ee6995f9b964
2023-09-20 20:42:06 +00:00
gerritbot 6d296c41ce Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I004e02c6b719be1bbfa1fa19f53e4fab2a7aeca1
2023-08-16 01:54:29 +00:00
gerritbot 0cf8b3dfe5 Update moved class Category
See T321882. Moved in I0b86acfdea

Bug: T321681
Change-Id: If48e9163bcfcfe03098f61b7cc52137e4ecaae82
2023-05-12 14:33:05 +00:00
Umherirrender 3252ddc115 Simplify ApiCategoryTree::extractOptions
Change-Id: I98605b2580a995e37a8da1b88693b38bbd5b8013
2023-04-25 20:06:08 +02:00
Ammarpad 277b547d21 ApiCategoryTree: Harden validation of JSON values in options parameter
* All option values are not expected be object themselves.
* Allow 'namespace' option to take scalar or array value.
* All other options take scalar values only.

Bug: T335145
Change-Id: I3bdb284f26d0c9ee8230f2197b168a7e83c145c3
2023-04-24 23:59:33 +01:00
Umherirrender 6e911fba75 Replace CategoryTreeCategoryViewer with hooks of CategoryViewer
Change-Id: I34a47c4f2f4b08cd3ed8ce5c4a585cc42d44372d
2023-02-28 23:20:56 +01:00
Umherirrender cca06d7656 Remove unused CategoryTreeCategoryViewer::$child_cats
Usage removed in 2009 with r47049 (23187e510a).

Change-Id: Id40904a286de73b0f057243d3f70178b77186d81
2023-02-24 01:09:03 +00:00
Fomafix c1edee1aea Remove flag for ParserOutput
The modules are already in the ParserOutput by change
I8d2a6d92f45f30495263eea716adb4eeaf7ebfbb.
The hack with the flag for the OutputPageParserOutput hook is not
needed anymore.

Do not deploy this change before the caches has been purged or expired.

Bug: T212059
Change-Id: If9427bbf114870ec9747670367915e11750c6525
2023-02-10 12:14:26 +00:00
jenkins-bot 4ead6a9e89 Merge "Add a CategoryCache service for use on Special:TrackingCategories" 2023-01-21 22:33:08 +00:00