In 8e51ea4e3a CategoryTreeFunctions.php
was renamed to includes/CategoryTree.php. The class name was already
CategoryTree.
Change-Id: I2734c92810df0f653ae1ea402a149e42e7be08cb
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
Implicitly marking parameter $... as nullable is deprecated in PHP
8.4. The explicit nullable type must be used instead.
Bug: T376276
Change-Id: I40bb7a0a02aaa467cbf0ae182adf5601ccbcb58e
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
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
* 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
Changes to the use statements done automatically via script
Addition of missing use statement done manually
Change-Id: I51931c3aab6aa1e5bc77b3cc83b8014cf557ff75
The parameter onlyroot is deprecated since July 2008.
Generate a tracking category for tracking the deprecation.
Bug: T290062
Change-Id: I8eb58fa7831e11e6a6719f11fb1ff310666cdc4e
This avoids loading the modules if they are not needed.
Multiple calls of CategoryTree::setHeaders doesn't matter.
Change-Id: I96f8ffa7cf1d5274a6853403c0f2422b684db61f
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
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
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
* 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
* Use ' instead of ".
* Use === instead of ==.
* Use !== instead of !=.
* Use explicit type cast.
* Combine array assignment.
* Use null coalescing operator.
Change-Id: Ic2fe4f62556df77262915b5bcbe1b11a1d907e6d
The configuration variable "CategoryTreeForceHeaders" allowed to force
the loading of the modules on every page by the hooks
"BeforePageDisplay" and "BeforePageDisplayMobile".
This is not needed anymore because the modules are now already loaded
if the category tree is used some on the other hooks.
Change-Id: I9fde894977463ecd1c4b07da449d98c39b3665ea
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
The MediaWikiServices hook runs before the service container is fully initialized, so it cannot have services injected. For this reason, it needs to be separate from the handlers for other hooks.
Change-Id: I1519aea8bca2f3977fcf15ee8776a1b3319687b5
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