Commit graph

14 commits

Author SHA1 Message Date
Siddharth VP 1f7b9d90df Support JSON files in gadgets
The parsed content of JSON files in the gadget is made available from the
gadget's JS files via require(). That is, MediaWiki:Gadget-data.json (or
Gadget:data.json) is available as `require('./data.json')`. This is
supported for both MediaWikiGadgetsDefinitionRepo and
GadgetDefinitionNamespaceRepo. The JSON parsing is done server-side.

JSON can only be used in "package" gadgets - in which the JS files can
also be invoked via require().

Also added a test for GadgetResourceLoaderModule.

Bug: T198758
Depends-On: Ib4556d09c4d393269e32771aab00f59a5f630e1b
Depends-On: Id4589a597ccfc4266b3e63d10f75b146aa7a287a
Change-Id: I21acb46cdd244a39b5cc6963aa763f0113bd1e38
2021-12-27 17:33:21 +00:00
libraryupgrader c3c98c1146 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: I5e0b9e78f0436355cc21dc356fb78e96e59cb536
2021-05-04 18:43:54 +00:00
Reedy 3ce0a0fb38 Fix PSR12.Properties.ConstantVisibility.NotFound
Bug: T253169
Change-Id: I17a7f0195dd0a419ae8afe46521dd8f061ba53c6
2020-05-20 00:13:16 +00:00
DannyS712 3f00fbb5aa Remove use of Revision::newFromTitle
Bug: T249183
Change-Id: Ibfcb8d7e56f559f3fb5179bac4dfeade8da22533
2020-04-08 12:44:29 +00:00
Kunal Mehta b28ad14b8c Upgrade to newer phan
Bug: T216919
Change-Id: I3a403891eafa703215a79526fcf9469b1fd6edc6
2019-03-17 16:39:02 -07:00
Umherirrender c8b50c30ee Fix caller name in GadgetDefinitionNamespaceRepo::getGadgetIds
Seeing {closure} in the logs as caller is not helpful

Change-Id: I1bfefd86aa0929ddafff3ccbdf50730a22fcdcb4
2018-09-30 13:47:56 +02:00
Kunal Mehta e99e181303 Add phan configuration
Depends-On: I09a0c0a786b687997e61344847f8af08b20cebf2
Change-Id: I9500232fb524e884d6cb15f2bdda10835df35ad4
2018-02-26 12:57:40 -08:00
Kunal Mehta a544c227f2 Avoid hardcoding specific GadgetRepo implementations for cache invalidations
Depending on GadgetRepo::singleton() to return a specific implementation
is fragile. Pass each created/updated/deleted page to
GadgetRepo::handlePageCreation/Update/Deletion() and let each specific
implementation deal with it.

Use LinkTarget to be TitleValue compatible for the future.

Change-Id: Ibe2e26d12369a897c53757adf621926f62af7f7b
2017-11-07 12:13:11 -08:00
libraryupgrader 969027392e build: Updating mediawiki/mediawiki-codesniffer to 13.0.0
Change-Id: I40598f8c34691bbe7b217aa38f24f150a210e2f3
2017-09-24 05:26:03 +00:00
Umherirrender 88d0b22359 Improve some parameter docs
Change-Id: I268aaa13d07985b0915774e83c487cd22568b161
2017-08-27 16:07:08 +02:00
Umherirrender f102194baf Add phpcs and make pass
Change-Id: I02b7f85f54ffaf8a1c9d5bed6fa20abb1627afe5
2017-05-31 16:36:45 +02:00
Aaron Schulz 5fd412b41d Code style/uniformity cleanups to GadgetDefinitionNamespaceRepo
Change-Id: Ic49383ac1ef99494050005c3641aa6a758fe3e8c
2017-03-02 21:32:54 -08:00
Fomafix 1a569b590b Convert PHP syntax from array() to []
Performed using:
find . -name \*.php -exec php ~/convert.php -w "{}" \;

Script from:
https://github.com/thomasbachem/php-short-array-syntax-converter

And convert syntax in comments manually.

Change-Id: I7ea9e57f9ab1250c8687885ad9e010771603bf78
2016-12-28 13:51:30 +01:00
Kunal Mehta 519f30355e Implement Gadgets definition namespace repo
Implements:
* Gadget definition content and content handler
* Basic validation for gadget definition content
* GadgetDefinitionNamespace implementation of GadgetRepo
* DataUpdates upon editing/deletion of Gadget definition pages
* EditFilterMerged hook for improved error messages
* 'GadgetsRepoClass' option to switch GadgetRepo implementation used
* Lazy-load the GadgetResourceLoaderModule class so we don't need to
load each individual gadget object unless its needed

Note that Special:Gadgets's export feature intentionally doesn't work
yet, and will be fixed in a follow up patch.

Bug: T106177
Change-Id: Ib11db5fb0f7b46793bfa956cf1367f1dc1059b1c
2015-11-20 12:01:21 -06:00