Commit graph

10 commits

Author SHA1 Message Date
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
Fomafix 4bc230093f Remove check for shouldForceHeaders()
The CategoryTree::setHeaders() method adds modules to OutputPage.
It does not matter if setHeaders() gets called several times.

The previous code tried to avoid to call setHeaders() several times.
If wgCategoryTreeForceHeaders is set then the modules get loaded by the
hooks "BeforePageDisplay" or "BeforePageDisplayMobile" on every page.
In this case duplicate calls of setHeaders() are (partly) avoided by
not calling setHeaders() on other hooks.

This change removes this micro optimization and loads the modules
unconditionally if a category tree is added on a hook.
shouldForceHeaders() is now inlined.

Change-Id: Ic9219575a714886b4edd446efde2a330dff4dee6
2021-08-29 11:14:21 +00:00
daniel ece310d7be Re-apply: Convert to new hook system (Workshop)
This converts the CategtoryTree extension to the new (MW1.35) hook system.
The patch was written live during a hackathon workshop.
A recording of the workshop is available at
<https://www.youtube.com/watch?v=ZOj44Rbh0tM&t>.

Re-applying after fixing: premature access to $wgRequest
Restores change: Ie52c393af378a980a2dac4ae7076fd6c016a8e0e
Reverts revert: Ieee300c7b35b7069bd7e781610c915f2ecae1bf1

NOTE: the "mode" parameter for category pages seems to be broken,
as the mode is not proeprly propoagated to dynamic requests.
This was already the case before this change, and this change
does not try to fix that issue. I was tempted to just remove
the feature entirely, but T137812 inidcates that it may be useful to
some. I will comment there to see if this should be fiexed or removed.

Bug: T282110
Bug: T271011
Change-Id: Ic3ee05e9dc382f4ada5cfeb9ff5d9a69249cc60d
2021-06-11 11:20:38 +02:00
Reedy 03685efdba Namespace extension
Change-Id: Idf4fbb9ff0c11b9da0b48b3843b2c87c155a4c36
2021-04-08 01:28:21 +01:00
Umherirrender 63b9527d9c Use IContextSource::getConfig to access configs stored in globals
Change-Id: Id48a17ee63ea7d9629f103bd1cb6ca2f6489d484
2021-03-12 20:40:10 +01:00
Fomafix c993bb8353 Fix findings by phpcs
* Add @inheritDoc to functions that are inheritance.
* Move comments to a single line.

Remove the phpcs rule exceptions:
* MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected
* MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Change-Id: I742ee19f0a3d2d62e08b6f2e35cd9a6b3940cd22
2019-02-06 18:03:50 +00:00
Kunal Mehta 50c10d1fcb Use standard GPL file header
Change-Id: Ic49d45d0a0cb640d40486735c95f13cc6e29063f
2018-04-16 22:38:06 +00:00
Kunal Mehta d85ca412b7 Don't conditionally register any hooks
Register all hooks unconditionally in extension.json, and then in the
hook
itself, check whether they should be doing anything.

Change-Id: I5f0019fc444371a24a11a25ca2d980c0a9ab5a61
2018-04-16 18:05:06 +00:00
Kunal Mehta 1c60788059 Set visibility on all functions
Change-Id: I1ced553ac5c18eafa83e32516ddc463feece96ef
2018-04-10 20:48:37 -07:00
Kunal Mehta 8e51ea4e3a Move classes into includes/
Change-Id: I308523aa764594798d72974fb79e19aef6c3f342
2018-02-08 22:23:07 -08:00
Renamed from CategoryTreeCategoryViewer.php (Browse further)