Commit graph

2223 commits

Author SHA1 Message Date
anterdc99 1e67ba9c77
Add aliases for Simplified & Traditional Chinese
What:
* Added aliases of Special:GadgetUsage

Change-Id: Ia3d8fe5b1d5f9993a33ec624975cda0a61f618b9
2024-01-07 17:08:00 +08:00
Umherirrender 1afd0a6e02 Use namespaced classes
This requires 1.42 for some new names

Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: Iacbea33299995c537a7ef77b524614ad02c6a559
2024-01-06 17:45:07 +01:00
jenkins-bot 95e524ffe7 Merge "Fix parsing logic when comments or hidden characters are present" 2024-01-06 16:22:33 +00:00
Siddharth VP 18204a4b0d Fix parsing logic when comments or hidden characters are present
0c61a5a468 subtly affected the
gadget definition parsing, causing issues with definitions containing
HTML comments or certain kinds of whitespace characters. They would get
saved to the pages array with a trailing whitespace but
Gadget::getScripts() would only return pages strictly ending in `.js`.

Trimming the title before in MediaWikiGadgetsDefinitionRepo fixes the
issue.

Bug: T354385
Change-Id: Iacee432756006060217981a534434fd455285793
2024-01-06 11:09:29 +05:30
Timo Tijhof 3e871f2015 tests: Improve validateScriptFile coverage and tolerate valid ES6
Remove the test that expects ES6 to fail by default, instead assert
that invalid syntax fails (as it should). Also add various other
test cases, including a commented-out test for valid ES6 by default,
to be enabled after Ie309e761f8b20640f7c0 in MediaWiki core.

Change-Id: If45856c563518255189687e3b1f620973349fb27
2024-01-05 21:48:58 +00:00
Translation updater bot 5113f84909 Localisation updates from https://translatewiki.net.
Change-Id: I150186d14cd4effbfbbe1a288f3510302b3fbf54
2024-01-05 09:12:47 +01:00
Translation updater bot 5bb872b640 Localisation updates from https://translatewiki.net.
Change-Id: Ibb61b7d05587ca6993d567b31c8837688814379d
2024-01-04 09:55:42 +01:00
Translation updater bot 9ae31dd878 Localisation updates from https://translatewiki.net.
Change-Id: I4fe085bcb3d32515b902adf22baf5c697b756fab
2024-01-03 08:34:32 +01:00
Translation updater bot 3c604b0e50 Localisation updates from https://translatewiki.net.
Change-Id: I489196645460bd1b38e526653f44b485c8d9f23b
2024-01-02 10:16:15 +01:00
Translation updater bot 4165d56e90 Localisation updates from https://translatewiki.net.
Change-Id: I34a1d42e89c0e937580887836f763ceb9b9afeeb
2023-12-29 19:22:06 +01:00
jenkins-bot be19375262 Merge "Specify all source pages in a single array in JSON definitions" 2023-12-29 11:08:02 +00:00
Translation updater bot 128047eb5e Localisation updates from https://translatewiki.net.
Change-Id: I164176f96fec8c61e0a2cc94156ce4ebace721b4
2023-12-28 14:49:50 +01:00
Translation updater bot 904aba6ee0 Localisation updates from https://translatewiki.net.
Change-Id: I02457f67ace2c90dddb08cdbb57fa9f23fe28aed
2023-12-26 14:42:51 +01:00
Translation updater bot 586135a91a Localisation updates from https://translatewiki.net.
Change-Id: I76284e1b683b2a7ee912fc34d522c538dbc4da06
2023-12-22 17:45:57 +01:00
Translation updater bot fd3846eb04 Localisation updates from https://translatewiki.net.
Change-Id: I2ac655dd36eae2b29b91bd5c238c5af3911c4a04
2023-12-20 14:04:49 +01:00
Translation updater bot 8282ce3e0d Localisation updates from https://translatewiki.net.
Change-Id: I38f711aa72902a921bc3296736f233dc4a3082ba
2023-12-18 18:17:26 +01:00
Siddharth VP 0c61a5a468 Specify all source pages in a single array in JSON definitions
As this repo is not used anywhere in production, there is no backward
compatibility. Any scripts, styles, datas specified in existing
definition pages will get ignored.

Gadget::getJSON() no longer checks isPackaged() – that is now left
for callers - only relevant one is in GadgetRLModule. That was done
because validationWarnings() method needs the JSON page list even for
non-package gadgets.

Bug: T353174
Change-Id: Ic820bc4632981369c72f822fb8b9b7195930eaa6
2023-12-16 14:31:09 +05:30
Novem Linguae 868c3c10d5 Special:GadgetUsage "Gadget" column now wikilinks to Special:Gadgets
A little efficiency to make getting from Special:GadgetUsage
to the relevant gadget files easier.

Bug: T344255
Change-Id: I0e26d10992bc3f8073bcdc8dbac86726ee6f7c36
2023-12-15 05:29:06 -08:00
jenkins-bot a3a1ea918e Merge "Remove redundant data updates for GadgetDefinitionNamespaceRepo" 2023-12-14 02:23:23 +00:00
Siddharth VP 8695a4ee1a Remove redundant data updates for GadgetDefinitionNamespaceRepo
Remove DefinitionDeletionUpdate and DefinitionSecondaryDataUpdate –
both call $repo->handlePageUpdate() which is already being called from
onPageSaveComplete/onPageDeleteComplete hooks.

The chain that made this redundant:

1. Ibe2e26d123, change hooks from hardcoded to GadgetRepo singleton.
2. Ieccc1cae8c, migrate from create-only onPageContentInsertComplete
   hook to create-and-edit onPageSaveComplete hook.
3. Ib27fd34fbf, further consolidate handling of create and edit
   events with handlePageUpdate, and remove any hook-level
   conditionals. At this point, the DateUpdate classes became redundant.

Bug: T31272
Change-Id: I20c2759b219c80571237a73e8422f3128047eb87
2023-12-14 02:03:44 +00:00
Translation updater bot db306eeebd Localisation updates from https://translatewiki.net.
Change-Id: Ib088ea45147d3859654dc41443918d936f30bb83
2023-12-13 08:41:04 +01:00
jenkins-bot 0e02d036d5 Merge "build: Add --allow-polyfill-parser to phan command" 2023-12-13 05:52:46 +00:00
jenkins-bot 6a3dbf6095 Merge "Make repo configuration independent of ObjectFactory specs" 2023-12-13 05:51:32 +00:00
Timo Tijhof a631066d62 tests: Switch test from newEmpty to new HashBagOStuff
Follows-up I24af0c2fa75. I forgot that newEmpty uses the "always empty"
EmptyBag, as opposed to an "initially empty" HashBag.

Change-Id: I62075bf685223b31c161508f99f95ee46280450b
2023-12-13 03:08:38 +00:00
Timo Tijhof 4197a00409 build: Add --allow-polyfill-parser to phan command
This way it works out of the box during minimal local dev environments
without requiring additional native extensions. The repo is small enough
that it's fast enough either way.

Change-Id: I0c789f266cb01f31bb42cb9f960cae0bb4c293df
2023-12-13 03:06:33 +00:00
Siddharth VP 34a1a297c2 Make repo configuration independent of ObjectFactory specs
Replace $wgGadgetsRepoClass with $wgGadgetsRepo.

Change-Id: I3dc1e29d1c3c65a18c206e7aa50e5bf31a55cc21
2023-12-12 13:15:31 +00:00
jenkins-bot 561254697d Merge "Add tests for cache invalidations in MWGadgetDefinitionRepo" 2023-12-12 07:57:22 +00:00
Siddharth VP c665a90423 Add tests for cache invalidations in MWGadgetDefinitionRepo
Change-Id: I24af0c2fa7524b5d6b5cd2cb151d3617c99a6ab0
2023-12-12 07:35:47 +00:00
Translation updater bot 3927ca48db Localisation updates from https://translatewiki.net.
Change-Id: Icaceda1608a1648d49a847c56bf6b3e01bb5d3d6
2023-12-11 10:43:16 +01:00
jenkins-bot 6f9f46b510 Merge "Further expand test coverage" 2023-12-09 06:17:45 +00:00
Siddharth VP ce486be160 Further expand test coverage
* Separate out tests for MediaWikiGadgetsDefinitionRepo and
Hooks::onGetPreferences. Removed hack in fetchStructuredList() for
overriding page content for tests.
* Add tests for ES6 gadgets. For this, ResourceLoaderModuleTest is
converted back to an integration test.
* Removed createGadgetDefinitionPage() test helper method. Now using
MediaWikiIntegrationTestCase::editPage().
* Fixed GDNamespaceRepoTest failure when GDNamespaceRepo is the active
repo, by clearing WAN process cache.

Change-Id: I26b84576a91f6cb0ebae64c5fc1408666d767911
2023-12-09 09:29:15 +05:30
Translation updater bot cd4b5fcc3e Localisation updates from https://translatewiki.net.
Change-Id: I13aafcaadf909a7e671d6c1d48559e12d340be9c
2023-12-08 14:45:36 +01:00
jenkins-bot 1b2b942fb8 Merge "Change "package gadgets" to "packaged gadgets"" 2023-12-07 11:12:05 +00:00
Translation updater bot 1ea4bc8376 Localisation updates from https://translatewiki.net.
Change-Id: Ib15e99ea7695d7216c3b7199412e9e1501f84cbb
2023-12-07 10:01:47 +01:00
Siddharth VP d12f0f366a Expand test coverage
* Add tests for onBeforePageDisplay hook. A simple gadget repo
  implementation, StaticGadgetRepo, is introduced for this.
* Add integrations tests for various gadget load conditions.
* Add test for onUserGetDefaultOptions hook.
* Add tests for GadgetDefinitionNamespaceRepo.
* Convert ResourceLoaderModuleTest to a unit test.

Change-Id: I275380c2bfcaa44770b3946a0a468eaaabef70c0
2023-12-06 09:18:09 +05:30
Siddharth VP 9d11216d4b Inject services into Hooks
Change-Id: I042d6f33f9ecd2573f25e737bb0ee9a43869eeac
2023-12-06 09:18:09 +05:30
jenkins-bot 9ad0cf1a5a Merge "Make GadgetRepo a service" 2023-12-06 00:48:51 +00:00
Siddharth VP 22752225a1 Make GadgetRepo a service
Turn GadgetRepo into a service, deprecate GadgetRepo::singleton()

Change-Id: I0ab14ca936eec1eead91d4eb0970f898628c8388
2023-12-05 17:38:41 -06:00
jenkins-bot 79f93059cb Merge "Add missing definite articles in messages" 2023-12-05 23:33:00 +00:00
Siddharth VP bf1d6b3e93 Remove gadgets-edit right, use core editsite{css,js,json} rights instead
With GadgetDefinitionNamespaceRepo, there should be separate rights for
editing gadget json as opposed to editing gadget css/js, so that admins
can be granted the former, while the latter remains restricted to
int-admins.

Reusing the MW core rights for site CSS/JS/JSON seems to make the most
sense here. Protection is now applied via GetUserPermissionsErrors hook
rather than as namespace protection.

For editing any non-CSS/JS/JSON pages in the namespace, editsitejs right
is required.

Bug: T298834
Change-Id: I6ffd5e9467774f1e79ccdce8b6b4739f07be2da8
2023-12-05 20:37:59 +05:30
Translation updater bot 493a7a5dd3 Localisation updates from https://translatewiki.net.
Change-Id: I11b4ef8d7146ea5b8a634636ae6d611183b12441
2023-12-05 09:14:46 +01:00
Translation updater bot 00c22e468d Localisation updates from https://translatewiki.net.
Change-Id: I62f3cfadb62019b716f5c9f51a9010c577b48507
2023-12-04 09:04:15 +01:00
Amir E. Aharoni e2d4e351ad Add missing definite articles in messages
Change-Id: I2c43f1a4a4bc8c98438c0bf8b343efbabb540cd6
2023-12-01 10:44:26 -05:00
Amir E. Aharoni 16b5ee866c Change "package gadgets" to "packaged gadgets"
For consistency between the new message gadgets-validate-json
and the older message gadgets-packaged.

Change-Id: I84f2f11e033ed3a3b6fe855452b34f751e9970b9
2023-12-01 10:05:56 -05:00
Translation updater bot a79ae63c8a Localisation updates from https://translatewiki.net.
Change-Id: I5916d03bd6b986c3eb75146e0f388d06e8f0bd38
2023-12-01 09:39:34 +01:00
Siddharth VP adda8a6649 Show gadget definition validation warnings in Special:Gadgets
Bug: T298334
Change-Id: Id241125b9b8abfb971dfa600ab0df9c6047f2b32
2023-11-30 21:59:04 +00:00
Translation updater bot ceb5a9174a Localisation updates from https://translatewiki.net.
Change-Id: I5190cb31a7028bbfbdd94c5d7993eff06ed071e1
2023-11-30 09:37:59 +01:00
Translation updater bot 9fd869c7a2 Localisation updates from https://translatewiki.net.
Change-Id: I07ccb4abc4772ee8be8ed84c6b256917e1a5cbcf
2023-11-29 08:31:03 +01:00
Translation updater bot 49a12c47e0 Localisation updates from https://translatewiki.net.
Change-Id: Iae953cfe01b3deb01787ee62658352bacc6ae47f
2023-11-27 08:32:21 +01:00
thiemowmde c4680366ac Various PHP code cleanups
… e.g. using modern syntax, or avoiding unnecessarily complex
language features. For example, we don't need to call count() when
all we care about is the boolean "is empty/not empty" information.

Change-Id: I13ae802f64627a79b29d1e57ad71486cb2fb977f
2023-11-22 09:53:48 +01:00