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
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic
* MediaWiki.Usage.ExtendClassUsage.FunctionConfigUsage
Additional changes:
* Dropped .inc files from .phpcs.xml (T200956).
* Added the `wikimedia/mediawiki` profile in .eslintrc.json (T262222).
* Added the `wikimedia/jquery` profile in .eslintrc.json (T262222).
* Removed global `$`, included in the `wikimedia/jquery` profile (T262222).
* Removed global `mw`, included via `wikimedia/mediawiki` profile (T262222).
* Dropped the emtpy global definition in .eslintrc.json.
Change-Id: Ib5a3697712078a4ed22195c274eae9c82ddd7227
Special:CategoryTree shows wrong link to parent category that containing string that need percent-encoding.
Changed getPartialURL() to getDBkey() on CategoryTree.php. getPartialURL() returns a percent-encoded URL and getDBkey() returns no encoded URL.
Bug: T253621
Change-Id: Idffb8ffece88a1d726075ffee9d64e6e05ed4e52
This feature add an option `notranslations` that allows the category
tree only to show the default pages and not include their translations
equivalents on the tree. For example let's say we have a page (Test_page)
that was created in a default language "en" in a category TestCat, and has
translations listed: Test_page/es, Test_page/de, Test_page/ar etc.
Doing `<categorytree notranslations="on">TestCat</categorytree> will render
only the Test_page page with it's link to the page on the tree and nothing
more.
Note: If page "Foo/hu" exist but "Foo" doesn't, it should include "Foo/hu"
in the category tree. In most case though, a base page will exist.
Also, the feature is only available if Extension:Translate is made
available on that wiki.
TODO: If "notranslations" is used along side with "showcount", consider
subtracting the number of pages suppressed from the total page count
in the category tree for consistency.
Bug: T229265
Change-Id: Ib4e7ab6ad98c05857cda1cd98bbc19e0504677bb
Use LinkRenderer instead of manually re-implementing parts of it and
manually building the <a> tags to create links.
Aside from technical debt cleanup, this will cause "stub" and "mw-
redirect" classes to get added to the <categorytree> output.
Bug: T25771
Change-Id: I1c644ef364818c4202dc0e30602d557dbec46010
Using LinkRenderer.php instead of compiling links manually gives the
HtmlPageLinkRendererBegin hook a chance to be called. This enables
compatibility with the DisplayTitle extension.
Change-Id: I67633d1add6d1409eac6962a7bd854c3cc93d5ff
Deprecated methods that have been replaced are;
* ConfigFactory::getDefaultInstance()
* wfMemcKey()
This extension uses 1.33 of core and these replacements
are safe.
Change-Id: I1536ab2adecc79fd42b46e2c892dae4a536c9496
This was internal to CategoryTree JS code and only needed on very
few pages. Export it as part of the module that needs it, instead.
Given this is computed and not a plain config var, use callback
to generate the value.
Bug: T219342
Change-Id: I790a98128b0a3317e27ac0d5fda08d48aeb640dc
It has origins in times when this code was in an AJAX function, however
now that it's in an API module it's not needed and can be counter-productive
as headers issued might conflict with MW headers. Let the API take care of
this via its standard means.
Change-Id: I8ebf8e7b935d7d252ac010bc1b88202b87f43e20
This changes the title attribute on the link generated in the
CategoryTree. The only effect is additional information about the
link target that may be truncated by 'hideprefix' or CSS overflow,
will now still be accessible in another way.
Change-Id: I4f07fa88f0a528634e9bf3c504e84fb4bf55e3bf
* 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
This change adds the needed modules to the page in the same hook
that adds the category tree HTML.
This avoids loading the modules on skins without a sidebar, like
SkinApi, or on pages without categories.
A forced-loading of the modules from BeforePageDisplay hook is not
necessary anymore in those cases.
This change avoids getting the OutputPage object from the global $wgOut.
Bug: T212820
Change-Id: I2bd50c45aa201a06630af3d57c9bcfccf7b22b99