Commit graph

2408 commits

Author SHA1 Message Date
Siddharth VP 05cc93b9be Avoid persisting default gadget configs in definitions
Bug: T331222
Change-Id: I022a66267fd01efdfdc86cf0b21d3a0aaf7e5950
2023-12-16 14:31:09 +05:30
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
thiemowmde ba496f7f4a Remove meaningless trim() from MediaWikiGadgetsDefinitionRepo
This can't do anything for two reasons:
* There are no spaces in the string after the str_replace. There is
  nothing to trim.
* The regular expression above guarantees the string starts and ends
  with alphanumeric characters. There can't be anything to trim, not
  even underscores.

Change-Id: Iea40aafaa2457cdee9d05f105978627d38d9d5b8
2023-11-20 13:44:08 +01:00
Translation updater bot 2dda194930 Localisation updates from https://translatewiki.net.
Change-Id: I952087d038745e95ebcb52f932a827c073b25aa4
2023-11-13 08:40:55 +01:00
Translation updater bot a6bd9144ac Localisation updates from https://translatewiki.net.
Change-Id: Iee39d6c6330d81431ffc8216d59c7ac7bd8fb199
2023-11-08 13:07:36 +01:00
Translation updater bot b1413814c2 Localisation updates from https://translatewiki.net.
Change-Id: I79ef1b6113b7d037c989906e675b8127be4ab771
2023-11-06 08:56:19 +01:00
Translation updater bot 40d75e5ac5 Localisation updates from https://translatewiki.net.
Change-Id: I86361ee316a11cd3abf99c8a1da4bef67b59ba4b
2023-10-31 09:08:59 +01:00
Timo Tijhof d12bf68c25 docs: Make PHP file headers more consistent
* A fixed license header for the file.

* Move class descriptions, doc tags, author/copyright to the
  class block. Remove MW-core specific "ingroup" tags such as
  "SpecialPage" which has no meaning in an extension and are not
  used by Doxygen.
  Ref https://gerrit.wikimedia.org/r/q/message:ingroup

Change-Id: I13d9b0ff7a3150180196c9fa58f8a321b14edd22
2023-10-30 18:10:58 -04:00
jenkins-bot 1ebcbafc89 Merge "Namespace special page classes" 2023-10-30 18:42:37 +00:00
Translation updater bot b7dd0f13ef Localisation updates from https://translatewiki.net.
Change-Id: Ibb6418b354a7855c84f06295e850346364149e45
2023-10-30 17:59:19 +01:00
Siddharth VP a7309d2b1f Namespace special page classes
Change-Id: I005f6674c9cc80c5c9e26ae84acfbceebb43734e
2023-10-30 21:13:41 +05:30
Translation updater bot 319d422398 Localisation updates from https://translatewiki.net.
Change-Id: I6066ae836d62f1e775bb51a9812d16f1ba7d9e86
2023-10-23 09:50:38 +02:00
Translation updater bot 03086af912 Localisation updates from https://translatewiki.net.
Change-Id: I5728c9fcfef16a3dafc9454da7af0df14a2873c3
2023-10-19 08:42:03 +02:00
Translation updater bot a41504a35e Localisation updates from https://translatewiki.net.
Change-Id: I964d878120eb5c6322eaafa16b10fee211dd3764
2023-10-11 08:45:33 +02:00
Translation updater bot 01e10d087f Localisation updates from https://translatewiki.net.
Change-Id: I3138832673c480df0de80eabbc995d5b3d94ba2b
2023-10-10 08:52:13 +02:00
Translation updater bot 6419638558 Localisation updates from https://translatewiki.net.
Change-Id: I873f4d3a742895e56ec8bb7bf3eeea946049808a
2023-10-09 08:56:01 +02:00
Translation updater bot 6221493052 Localisation updates from https://translatewiki.net.
Change-Id: Ie5a41080ecc5ac1d4e16f830aa28b868591a2c80
2023-10-04 09:08:16 +02:00