Commit graph

137 commits

Author SHA1 Message Date
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
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
Umherirrender 9d98cc1ae6 Add a CategoryCache service for use on Special:TrackingCategories
Replace the dynamic property on SpecialTrackingCategories object,
this was used to store preloaded Category objects.
Dynamic properties are deprecated in php8.2
The preload and storage is now done with the service.

Adjust doc to LinkTarget (Id0cc2ca)

Bug: T324897
Change-Id: I891ad79bc357d32585ef4d9206d398c5a75222aa
2023-01-13 23:05:36 +01:00
Fomafix ed2ec6459b Add modules to ParserOutput
This change adds the modules to the ParserOutput object.

The hack with the flag for the OutputPageParserOutput hook is not
needed anymore. But this will removed in the separate change
If9427bbf114870ec9747670367915e11750c6525 to avoid a caching problem.

This change loads the modules on Special:ExpandTemplates if a
<categorytree> is in the content.

Bug: T212059
Change-Id: I8d2a6d92f45f30495263eea716adb4eeaf7ebfbb
2023-01-12 21:33:16 +00:00
Fomafix 9acd8edf62 Support short link with target in URL path
With this change the following URLs select the target Category:Foo_Bar:
* Special:CategoryTree/Category:Foo_bar
* Special:CategoryTree/Foo_bar
in the UI selector for the category.

Bug: T290070
Change-Id: I169c7c50adb5f6b279c34e44e7fdcf5b1b26c882
2023-01-12 21:08:46 +00:00
Umherirrender 8b4ab1fd43 Use LinkBatchFactory to create LinkBatch objects
Bug: T325591
Change-Id: I3c529e62e45a38e6752f37b6bf36a1e727511e46
2022-12-19 21:37:43 +01:00
Fomafix 828566ef60 Optimize PHP code semantic
* Mark $mOptions as private. There is no external reference.
* CategoryTree::makeTitle don't return false. A check for false is not
  needed.
* A class attribute should not start with a space.
* $title->isExternal() is equivalent to $title->getInterwiki() !== ''.
* Use $title->inNamespace( NS_CATEGORY ) instead of
  $title->getNamespace() === NS_CATEGORY.

Change-Id: Iddad84ff5a18080d1216346ec2a906c955a644a4
2022-11-12 19:08:16 +00:00
jenkins-bot ba6e585427 Merge "Check for null after Title::newFromText" 2022-11-12 17:31:19 +00:00
Fomafix c5b34028e3 Remove phpcs exclude rules and update PHP code
Consistently use single line @var declararation.

Change-Id: I02210ddcc1c523bda6e26adb17e7b6bd38db752d
2022-11-10 20:15:44 +00:00
Fomafix cf8538086c Check for null after Title::newFromText
Title::newFromText returns null on invalid title.

Change-Id: Iaef69584eff33b1b13669f8d0a3b8eeeba3755cc
2022-11-10 19:27:54 +00:00
gerritbot a42526cc2e Fix usage of ApiBase::PARAM_* deprecated constants
The ones that are replaced with ParamValidator

Bug: T275455
Change-Id: Ib1ad9e3837bb5030918e84c12c63f570bc67bd3b
2022-04-04 01:24:23 +02:00
Func be3c21741d Follow-up e20262bc: Strip subpage name in action
Thanks to comments on Iaec81a2f, I realized the function of removed code.
Use the native setTitle() method to strip subpage name.

Change-Id: I4b1f48e0b705fb4aa7262454614d90dc1653a4fe
2022-03-27 13:25:57 +08:00
Func e20262bc86 CategoryTreePage: Avoid setting internal fields of HTMLForm
HTMLForm would handle title itself, don't need to set manually here.

Change-Id: Ifff538f48f5578cca5fc7b3a2724e79a851958c3
2022-03-20 21:43:31 +08:00
Ammarpad de9a92c7a3 CategoryTree: Use Category::getMemberCount from core
Core now provides all-member count separately with type guarantee.

Also bump core requirement to >= 1.38.0

Change-Id: I2b489e690ad05462a553e424bd9495593a8d2b1b
2022-02-21 23:15:47 +01:00
Fomafix aec8d75570 Replace WebRequest::getVal by ::getRawVal or ::getText
The UTF-8 normalization of getVal is not needed at all places.

Change-Id: If8fef794ff75671e32f965c7a780681d9cbd9a4a
2021-11-14 18:35:54 +00:00
jenkins-bot 3d8e911979 Merge "ApiCategoryTree: Inject services" 2021-11-11 21:14:53 +00:00
Fomafix 4a3f1aadc5 ApiCategoryTree: Inject services
Change-Id: Id22dbb344307322247c75cde6cf56cccdf012203
2021-11-02 20:13:55 +00:00
Fomafix 06dcae70b4 Get config values from Config instead of from global variables
Change-Id: I316b892ed01472fac75f72f50c820676fb3ce58a
2021-11-01 20:20:35 +00:00
Fomafix 49453bbfde Avoid default value style="display:block" in HTML
This change makes the HTML smaller.

Change-Id: Ie90eb8c85bb530de634bd190290e9aa303018073
2021-09-17 08:55:50 +00:00