Commit graph

71 commits

Author SHA1 Message Date
daniel 734e2af35c Put onMediaWikiServices into a separate handler class.
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
2021-06-24 15:17:34 +00:00
jdlrobson 46d2de89da Restore category link to sidebar
Bug: T272705
Change-Id: I2911562a902aab82783d696282bbbdd2a287e962
2021-06-15 11:55:22 -07: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
libraryupgrader e2ee5bff3c build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

Change-Id: I6daf5f05db0a1db2c3089dc1be047b752d52c4ec
2021-05-04 01:18:21 +00:00
Reedy 03685efdba Namespace extension
Change-Id: Idf4fbb9ff0c11b9da0b48b3843b2c87c155a4c36
2021-04-08 01:28:21 +01:00
Reedy 7dbedfde4d CategoryTreeHooks: Move call that is independent of a loop
Change-Id: I0901aad1581a2b679bcb68b3c7a733f9db9be81c
2021-04-07 22:34:36 +00:00
Arlo Breault c08dc34b1d Return an extension tag when preprocessing a parser function
Help out Parsoid since it doesn't have support for the "isHTML" flag.

Bug: T257344
Bug: T279094
Change-Id: Ia3295e74628bb45912e208c38da8c85cdb736d0b
2021-04-01 17:54:49 -04:00
Umherirrender bf876f5c19 Inject services into SpecialCategoryTree
Bug: T259960
Change-Id: Ie2a3156f1be52074f28b24507815aef7a746f083
2021-03-12 21:34:50 +01:00
Umherirrender 63b9527d9c Use IContextSource::getConfig to access configs stored in globals
Change-Id: Id48a17ee63ea7d9629f103bd1cb6ca2f6489d484
2021-03-12 20:40:10 +01:00
Daimona Eaytoy 7acc45f672 Stop using deprecated Language methods
Change-Id: Ibcb9cf30dd6e7a496a6cbe6ceab871a4405e0642
2021-02-27 13:59:57 +00:00
jenkins-bot 1cf89c5bb1 Merge "Fix category tree headers not being set" 2021-01-04 17:19:02 +00:00
Petr Pchelko 7659fe8b89 Remove fallback for ParserOutput dynamic property
Bug: T269235
Change-Id: Ief11ffc919d01f45179612fe072950ee279eaab0
2021-01-04 10:24:04 -06:00
Taavi Väänänen 7e6fb72e60 Fix category tree headers not being set
Bug: T270360
Change-Id: I01c81b3cc5ce3ddfd4de5b9524a5402805a46f9a
2021-01-01 20:17:49 +02:00
libraryupgrader 44c2059ac3 build: Updating mediawiki/mediawiki-phan-config to 0.10.5
Change-Id: I839cd5acfdd3022551f77a4f432bdce7920150dd
2020-12-09 21:47:40 -08:00
Petr Pchelko 32d1bf0c1f Use ParserOutput::extensionData instead of dynamic properties.
Bug: T269235
Change-Id: Iecae25e3210d043e895d8d6dd62138910e0d6b14
2020-12-02 08:50:14 -06:00
libraryupgrader 8e493d1ee8 build: Updating mediawiki/mediawiki-phan-config to 0.10.4
Change-Id: Iae62c679581802b471dc005b3004d2965e0d96e8
2020-11-19 21:11:16 -08:00
libraryupgrader 44998a759a build: Updating mediawiki/mediawiki-codesniffer to 32.0.0
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
2020-10-29 07:51:57 +00:00
libraryupgrader 31161f5fff build: Updating mediawiki/mediawiki-phan-config to 0.10.3
Additional changes:
* Dropped .php5 files from .phpcs.xml (T200956).

Change-Id: I7b48e4e6f67e8b8d2f885b6d6f39861d9d6a0cf4
2020-09-25 00:16:38 +00:00
jenkins-bot a27b54d610 Merge "Fixed a bug that double percent-encoding on Special:CategoryTree" 2020-07-23 09:23:25 +00:00
Umherirrender c1ff28f077 Update signature of CategoryTreeHooks::parserHook
Parser.php gives 4 argument and that includes a PPFrame
That is overridden the $allowMissing arg

Change-Id: Ibf69be346e5f6abbf113ad51155d94d14510ef95
2020-05-31 14:48:37 +00:00
Umherirrender 0625a871d5 build: Bump phan to 0.10.2, remove taint-check
Phan failure fixed in follow up

Change-Id: I980a39b4446b25be90e1774cc6385aad8d6318d5
2020-05-31 16:46:45 +02:00
Yuukin256 b3fa4441a0 Fixed a bug that double percent-encoding on Special:CategoryTree
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
2020-05-27 22:36:50 +09:00
Aaron Schulz f7233850e4 Convert $wgMemc use to WANObjectCache
Bug: T160813
Change-Id: Icacecf5ecc4260385a95b99f5a491a58175c14de
2020-03-30 14:11:50 -07:00
libraryupgrader 4180323699 build: Updating mediawiki/mediawiki-codesniffer to 29.0.0
Additional changes:
* Also sorted "composer fix" command to run phpcbf last.

Change-Id: I5f4050a13d1ac8db56adebe8d4bf13b84da5545a
2020-01-14 03:58:43 +00:00
libraryupgrader cdb24f697e build: Updating mediawiki/mediawiki-phan-config to 0.9.0
Additional changes:
* Added .eslintcache to .gitignore.

Change-Id: I74187354a1cbb7703e446752d7ab4500e993e3e8
2019-12-27 15:08:47 +00:00
Umherirrender 0365b1bdea Fix doc of CategoryTree::getOptionsAsCacheKey
The depth is a number and provided as int

Change-Id: I884279bf69fc3661ad8279965a02d38867a85868
2019-12-08 22:11:08 +01:00
jenkins-bot e60b968434 Merge "Suppress page translations and render only the default page(s)" 2019-11-08 14:04:52 +00:00
Derick Alangi 87ddb7f735 Suppress page translations and render only the default page(s)
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
2019-11-03 14:03:27 +01:00
Umherirrender 88893ed005 build: Updating mediawiki/mediawiki-phan-config to 0.8.0
Bug: T235049
Change-Id: I40fd8ddf278a716171a05a30215fdef6fcf123be
2019-11-01 21:38:00 +01:00
Umherirrender e801fb1e3b Define visibility on class constant
Change-Id: I140d4cbf7bf1397138fef1f1396057fc19c1cbb2
2019-10-25 19:14:46 +02:00
Umherirrender 414c62f19b phan: Remove PhanParamReqAfterOpt suppression
Change-Id: I326165c7cdb98dabc2aa9a3fd73d637f2e5bceec
2019-10-12 22:14:41 +02:00
Kunal Mehta 1c779bee3a Use LinkRenderer instead of manually building links
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
2019-09-07 11:49:53 +02:00
Derick Alangi 5b342c51ab Avoid usage of deprecated $wgContLang global (dep in 1.32)
Change-Id: Ic70ac2bc7eeba6af9a69bb1eb839a87cd06c01f8
2019-09-01 19:01:45 +00:00
Sharptrick d78fc9add9 Altered renderNodeInfo() to use LinkRenderer.php.
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
2019-07-31 05:52:00 +00:00
DannyS712 8256a6dbae Add help links to special pages
Bug: T228071
Change-Id: I5326bb73da952b16c685e80afc51615fee84784a
2019-07-17 19:55:00 +00:00
Derick Alangi 0bebd426d8 ApiCategoryTree: Replace use of deprecated methods
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
2019-05-16 20:49:39 +01:00
Derick Alangi f9f6ac6348 Avoid use of deprecated ->disableCache() in Parser
This method was deprecated in mediawiki 1.27.

Change-Id: Icdeeb41bbc66bcf6df25e42769bdb4e8140c058a
2019-04-30 12:06:25 +00:00
jenkins-bot ece3dc2629 Merge "Remove 'wgCategoryTreePageCategoryOptions' export from pageview HTML" 2019-04-05 23:07:10 +00:00
Timo Tijhof c839756b32 Remove 'wgCategoryTreePageCategoryOptions' export from pageview HTML
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
2019-04-05 11:31:03 -07:00
Umherirrender f9a591aa3e Replace deprecated TitlePrefixSearch
Deprecated since 1.27, this extension requires 1.29

Change-Id: I12c56c2b37c4dc5c5be99a0628289449b9a85f92
2019-03-27 21:44:37 +01:00
Matěj Suchánek 89c61833c2 Migrate to new phan
Bug: T216908
Change-Id: I28faf3638dfbc20b84ba78d476b02f7bbc8cbd6a
2019-03-17 21:25:03 +01:00
Kunal Mehta 71ee586108 Avoid use of func_get_args()
Change-Id: I7854d2005aefd581959c2cd292928900c047203c
2019-03-08 13:03:38 -08:00
Max Semenik 60884c60e7 Stop manually messing with caching HTTP headers
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
2019-03-05 20:55:22 +00:00
jenkins-bot c4d39389a8 Merge "Change 'title' attributes to links to use full page name" 2019-02-14 00:53:10 +00:00
Peter Boehm 1dfe6ca618 Change 'title' attributes to links to use full page name
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
2019-02-14 00:46:35 +00:00
Fomafix 0a3f30b8d7 Simplify code by using Xml::element()
Change-Id: I8b0d1c35d8d7cc310769d586a1716ef5ffbd46b3
2019-02-12 02:47:13 +00: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
Fomafix 9f12acd962 Remove "return true" on hook handler functions
Before MediaWiki 1.23, returning true was required. Since 1.23 this not
needed anymore.

Change-Id: Iae9bcf416d851af2a8703fd76dc13d0b1d2db8bc
2019-02-06 18:03:15 +00:00
Fomafix b3ac7f5404 Add typehints to function parameters
* Add "= null" when null is supported and used.
* Also fix Doxygen tags.

Change-Id: I209b23eee54b5e8e0f4091f3d4cd7c5e44dbaff0
2019-02-05 15:30:31 +01:00
Fomafix 27289b479d Change hooks to explicitly load the modules
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
2019-01-22 15:31:47 -08:00