Commit graph

2335 commits

Author SHA1 Message Date
sbassett f2bc65a518 SECURITY: Improve regular expression performance
* This patch improves the performance of an
  ext:Gadgets regular expression which helps parse
  out sections of the gadgets definition page.

Bug: T363773
Change-Id: Ic9e1a181b261ae4d25e9ce2f91ad12f92e9855d9
2024-05-14 16:07:36 -05:00
Translation updater bot 5dbf7bce92 Localisation updates from https://translatewiki.net.
Change-Id: I141f19d34711478ad58a6902fd6cca51f2d9be9b
2024-05-14 09:26:14 +02:00
Translation updater bot 117d0d126b Localisation updates from https://translatewiki.net.
Change-Id: Icf29794812cddbcd618195c55ba5e16cec812a78
2024-05-13 09:27:11 +02:00
libraryupgrader 33718e050f build: Updating grunt-banana-checker to 0.12.0
Change-Id: I8f0204829bb943ffd97cc36146089bd9c2458cde
2024-05-10 06:43:06 +00:00
Translation updater bot 945ac06676 Localisation updates from https://translatewiki.net.
Change-Id: I729bc7a4982ba1926160a268d4333d1ba78e4aaa
2024-05-08 09:23:47 +02:00
Translation updater bot bf14373996 Localisation updates from https://translatewiki.net.
Change-Id: I11a37b0cb81e89dc4bafcfc6456bca6d16749fda
2024-05-07 09:22:46 +02:00
Translation updater bot 03dbb1f9f3 Localisation updates from https://translatewiki.net.
Change-Id: I59ca62114402eaf785be8d3878b4a0075d39df09
2024-05-06 09:25:48 +02:00
libraryupgrader a7a136d000 build: Updating composer dependencies
* mediawiki/minus-x: 1.1.1 → 1.1.3
* php-parallel-lint/php-parallel-lint: 1.3.2 → 1.4.0

Change-Id: Ic0d197aa227c3dc45c258c552a368bfeb7628706
2024-05-05 17:34:28 +00:00
jenkins-bot 16d3a0f75d Merge "Replace EditFilterMergedContent hook with ContentHandler override" 2024-05-03 19:50:52 +00:00
Translation updater bot 7a14b2081c Localisation updates from https://translatewiki.net.
Change-Id: I2004a251a222ef881bfe8b4803a8e9c962309bb6
2024-05-03 09:28:41 +02:00
jenkins-bot 848a226189 Merge "Drop a few easy to avoid Html::open/closeElement" 2024-04-29 14:07:52 +00:00
thiemowmde 7d1c8336e3 Drop a few easy to avoid Html::open/closeElement
The singular Html::rawElement call does the same but is more robust.

Change-Id: I0dda45dff8b49ce877b57bb88b88f08f6b26ac8b
2024-04-29 12:53:07 +02:00
thiemowmde 65f6500730 Stop using the Xml class in this codebase
Bug: T341779
Change-Id: I40760d002b7075be762fbf0713fdefe73a6e266e
2024-04-29 12:51:42 +02:00
Translation updater bot 7f3f575768 Localisation updates from https://translatewiki.net.
Change-Id: Ie7550f0743c4d0867d96f187988ca0ae2e15e9e5
2024-04-29 09:23:20 +02:00
Timo Tijhof d2a37f5f69 Replace EditFilterMergedContent hook with ContentHandler override
The reason for this hook is not the validation itself, because that
is already done by `GadgetDefinitionContent->isValid` which is part
of the core Content interface, already enforced by ContentHandler.

Instead, the hook was here to provide the custom interface message
GadgetDefinitionValidator, because the core Content interface is
limited to boolean isValid(), which provides a very generic error
message.

However, nowadays ContentHandler exposes this mechanism directly
such that we can directly attach a custom message to it without
needing to wait for the stack to reach the EditPage and then override
it after the fact from a global hook.

Also:

* Simplify validation logic towards "is" checks with only an
  expected description.

* Move schema.json file to top-level file.
  It has been unused for as long as it has been in the repo, despite
  appearing (due to its placement) to be used as part of the source.
  It was added, I believe, with the intent to be used by the validator,
  but it isn't. It also isn't validated or checked for correctness
  by anything right now.
  For now, keep it as informal schema in the top-level location for
  easy discovery where perhaps others can find a use for it.
  SD0001 mentions gadget developers may want to start using it for
  Git-maintained gadgets to help with validation in their IDE, after
  Gadgets 2.0 is launched.

Test Plan:
* Set `$wgGadgetsRepo = 'json+definition';`
* Create `MediaWiki:Gadgets/example.json`
* Attempt to save "x" in settings.namespaces item.
* Attempt to save "x.zip" in module.pages item.
* Fails with this patch, similar as on master.

Bug: T31272
Change-Id: I61bc3e40348a0aeb3bd3fa9ca86ccb7b93304095
2024-04-24 19:31:14 +00:00
Translation updater bot 8c7369c93e Localisation updates from https://translatewiki.net.
Change-Id: Ida3eb38fde424dcc74c24a7710b3ee675d40fbd7
2024-04-22 09:28:22 +02:00
Umherirrender 1f186a0f2b Change type-hints to IReadableDatabase
Change-Id: Ib77f8f409b48115684396bf920428adb075c2820
2024-04-21 20:48:58 +02:00
libraryupgrader 004ca95b90 build: Updating eslint-config-wikimedia to 0.27.0
Change-Id: I08b0508d2f1a759be1d02d55a52b5f9f5a1e0132
2024-04-17 11:19:19 +00:00
Translation updater bot 72ca1f7d20 Localisation updates from https://translatewiki.net.
Change-Id: I838abba4cbdc6d53a9ea8cfb4ede74e5f3710d3d
2024-04-15 09:27:59 +02:00
Translation updater bot 02009d6acc Localisation updates from https://translatewiki.net.
Change-Id: I7e90da6a54328a29e8314e86f81cfa921fd407c5
2024-04-09 09:26:45 +02:00
Translation updater bot 27534fffe1 Localisation updates from https://translatewiki.net.
Change-Id: I43115797159b01aa1a8445f25c4fbd119731efe4
2024-04-08 09:25:50 +02:00
Translation updater bot 2467e0e0cf Localisation updates from https://translatewiki.net.
Change-Id: I2eb63eb838ea70b70c4f58766eafcd3bea4de7bb
2024-04-05 09:38:12 +02:00
Translation updater bot fd58ef286d Localisation updates from https://translatewiki.net.
Change-Id: If416686c14cd3bc901b650ebd82b97234b6d25f1
2024-04-04 09:38:12 +02:00
Translation updater bot 6aa40e3926 Localisation updates from https://translatewiki.net.
Change-Id: I533be48420a6a1839942a3066fef1a27c844789c
2024-04-03 09:23:44 +02:00
Translation updater bot 110dbf5703 Localisation updates from https://translatewiki.net.
Change-Id: Ie27417dc357b0205b096cb0e93500e63a81ff64a
2024-04-01 09:22:41 +02:00
Translation updater bot 85383fc410 Localisation updates from https://translatewiki.net.
Change-Id: I69ce979e86b5e6904d350882c0103b7262600840
2024-03-29 08:46:48 +01:00
Translation updater bot 96872806b9 Localisation updates from https://translatewiki.net.
Change-Id: I6b93b691b9cbd5fb06ff3d1dd530a730f172540d
2024-03-28 08:31:58 +01:00
jenkins-bot cd23624011 Merge "Replace 'hash' with CACHE_HASH to improve discovery" 2024-03-27 20:46:22 +00:00
Timo Tijhof 6e6f21b385 Replace 'hash' with CACHE_HASH to improve discovery
Bug: T139216
Change-Id: Ifac0701050ca4ca25f1d3e103ce6db8734a2ec77
2024-03-27 12:05:15 -07:00
Translation updater bot 23957f5093 Localisation updates from https://translatewiki.net.
Change-Id: I2dfcf9ef6718991a6a118108d595dd0cdc8c0fef
2024-03-27 08:17:35 +01:00
jenkins-bot fd261440ca Merge "Improve localisation on Special:Gadgets, minor code cleanups" 2024-03-26 15:43:31 +00:00
Translation updater bot a9ba1efc51 Localisation updates from https://translatewiki.net.
Change-Id: I6312851de326ba4325a16070e51c25da9dbaacdd
2024-03-26 08:19:41 +01:00
Timo Tijhof 9c5b7cef9e Improve localisation on Special:Gadgets, minor code cleanups
For each item, either display human-readable and translated text,
or display a technical non-translatable identifier as `<code>`,
with optional localised text in the title attribute.

* Re-format "rights" as a sentence instead of a bullet list. It was
  the only one using a bullet list, which made it feel a bit long.

* Re-format "actions" as `<code>` since they are not localised.

* Re-format "contentModels" as `<code>`, and add the localised display
  name in a title attribute, same as we do with "rights" already.
  ContentHandler::getLocalizedName() is also used already on
  Special:ChangeContentModel.

* Fix "contentModels" to set `needLineBreakAfter = true`, otherwise
  if a gadget also sets "supportsUrlLoad", then that sentence is
  appended to the previous line.

Update phrasing and sorting to be consistent everywhere, and adopt
native PHP types where possible.

In most cases, I made things alphabetical, with the exception of
Special:Gadgets user interface output, and Gadget class methods,
which both follow the order of most recently added feature last
(rights, skins, actions, namespaces, contentmodels, categories).

Highlights:

* Fix namespace IDs type. These can be strings when they are parsed
  from the gadget definition text, not always integers.

* Add explicit default for 'category'. In theory not needed because
  MediaWikiGadgetsDefinitionRepo has a `$section = '';` default, and
  MediaWikiGadgetsJsonRepo uses GadgetDefinitionContentHandler where
  `category: ''` is part of both the initial page content, as well
  as merged via getDefaultMetadata.

  This default benefits simpler test cases, and static analysis,
  since the Gadget class constructor does not (yet) require it.
  Without this, getCategory() could TypeError due to returning null.

Bug: T63007
Change-Id: I3b2c72a6424d520431d03761d23a5a222518ce3d
2024-03-25 15:37:40 -07:00
Translation updater bot 0daef7e54b Localisation updates from https://translatewiki.net.
Change-Id: I680e123bc3d75d2238603fc94f6083f5f457c1f5
2024-03-25 08:35:57 +01:00
Translation updater bot e3ea7d97b2 Localisation updates from https://translatewiki.net.
Change-Id: Iad57fc6d1d1f048f02144445bdf9398c020429b7
2024-03-21 08:55:15 +01:00
Translation updater bot 4711609d13 Localisation updates from https://translatewiki.net.
Change-Id: Ie3b9db92189bd19e39486907de051dca4adf4942
2024-03-19 08:25:05 +01:00
Translation updater bot 0170bfc967 Localisation updates from https://translatewiki.net.
Change-Id: Ia1f36a8f95130ebca2e91db5ac4f43df01ff9531
2024-03-18 08:31:00 +01:00
jenkins-bot 8c5a03862a Merge "hooks: Migrate buildLike to expression builder" 2024-03-17 21:58:35 +00:00
jenkins-bot d6e1510af0 Merge "Add support for categories in definitions" 2024-03-16 22:54:42 +00:00
Sophivorus e2cb01ddcd Add support for categories in definitions
Adds a "categories" option to the gadget definition, which takes a
list of category names. Enabled gadgets will only load when the
viewed page is in one of the required categories.

Bug: T204201
Bug: T63007
Change-Id: I0ced9507bdab6cacd0baf2a331859099f35b73e5
2024-03-16 22:31:03 +00:00
Translation updater bot 33ff6adb15 Localisation updates from https://translatewiki.net.
Change-Id: Ifd3abf64b68860a8128c7611acb24294fb81049e
2024-03-13 08:25:37 +01:00
Atieno cd585ee7b3 hooks: Migrate buildLike to expression builder
Bug: T350963
Change-Id: I50303841351fdfe37ee50f25d8f8de38d799d9e0
2024-03-11 13:04:13 +03:00
Translation updater bot 4b9f6f2a09 Localisation updates from https://translatewiki.net.
Change-Id: I54a6dbf16486187909ae2d0be68938e67ba82e0a
2024-03-11 08:27:01 +01:00
Umherirrender c5ce0b1a7c build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0
Change-Id: I36974f572bbf3e7fcd504496769ee7b6b28651b1
2024-03-10 19:23:46 +01:00
Translation updater bot 2c99c24a15 Localisation updates from https://translatewiki.net.
Change-Id: Ie8db699049f5519c01347a5a1e7278455ab02571
2024-03-08 08:23:04 +01:00
Translation updater bot b09872b79d Localisation updates from https://translatewiki.net.
Change-Id: I763caede8eca0546a5d1b4775cc99e0c7027baa1
2024-03-07 08:48:37 +01:00
thiemowmde 32aa712323 Add missing type hints to untyped …->getService() calls
IDEs can't discover this without the extra type hints.

Bug: T359290
Change-Id: Ibb4462911d04397beabf1884c4f7c90eaa740d3b
2024-03-06 14:50:16 +01:00
thiemowmde ac5db23b17 Add missing function argument to titleWithoutPrefix call
This is the most minimal patch possible to fix the regression. More
can be done in later patches.

Bug: T359290
Change-Id: I9351bdbc2f985e72fb253e424cd7523b73820dcd
2024-03-06 10:25:40 +00:00
Translation updater bot 76cfeb1ebb Localisation updates from https://translatewiki.net.
Change-Id: I40ba4d233b44100aea3e13b66cdf566e2c55019d
2024-03-05 08:27:39 +01:00
Siddharth VP 9d05af9df8 Replace uses of deprecated wfGetDB()
Bug: T357642
Change-Id: I868133bca622ad2af851e874b450fe0be53017d2
2024-03-04 18:39:15 +05:30