Commit graph

2248 commits

Author SHA1 Message Date
jenkins-bot 4ca73e1556 Merge "SpecialGadgets: convert Xml class to Html class" 2024-01-17 18:08:04 +00:00
Novem Linguae e62314d4ba SpecialGadgets: fix docblock type mistake
Change-Id: I1716c0c4b74ec34d6b8b69316fb397aa1de3b8bc
2024-01-17 08:02:14 -08:00
Novem Linguae eeb4740fbc SpecialGadgets: convert Xml class to Html class
Change-Id: I8a24789a11ad5f494dc0f9a87642b1b79b40fd3b
2024-01-17 07:50:21 -08:00
Translation updater bot baff83d550 Localisation updates from https://translatewiki.net.
Change-Id: I58d3aefa499ab19d0f7a70b4c7e0469abf608563
2024-01-17 08:37:18 +01:00
Translation updater bot 4b656f781d Localisation updates from https://translatewiki.net.
Change-Id: Icabbb59cf05b0eb64854a0a3ad3eec35032a2570
2024-01-16 08:25:44 +01:00
Translation updater bot 474e6d7d55 Localisation updates from https://translatewiki.net.
Change-Id: I629f7a203e613030587c43c8d5ca7f794d6fe41b
2024-01-15 08:24:27 +01:00
Translation updater bot 549e9c015d Localisation updates from https://translatewiki.net.
Change-Id: I8bdfa3981c37668489f8ad700943edb06a100a17
2024-01-12 09:00:18 +01:00
jenkins-bot 50d2405a43 Merge "Add validations for skins and rights" 2024-01-11 17:03:15 +00:00
Translation updater bot 2687909023 Localisation updates from https://translatewiki.net.
Change-Id: I51cef8c72f460501026f9c064d0fe34b24e59e9f
2024-01-11 10:04:15 +01:00
Siddharth VP b944152d3a Add validations for skins and rights
Bug: T298334
Change-Id: If32b334f331845eab6c115f40f8dcf4534028c9c
2024-01-11 10:02:40 +05:30
jenkins-bot f55a46c3f1 Merge "Avoid global RequestContext in GadgetRep::validationWarnings()" 2024-01-10 07:59:12 +00:00
Translation updater bot 7a9cf54022 Localisation updates from https://translatewiki.net.
Change-Id: I7cee8d0a9599b714042a924f9bb5a0035f61c6bb
2024-01-10 08:32:55 +01:00
Timo Tijhof 1448500c2a Avoid global RequestContext in GadgetRep::validationWarnings()
This already returns safe Message objects, which allow Special:Gadgets
to localise it accordingly.

Avoid formatting the list ahead of time with a hardcoded user language,
and instead use Message::listParam() so that the caller controls
the Language object. This makes it safe to use in jobs, CLI, tests,
load.php and elsewhere instead of previously where RequestContext would
cause an exception or use something the caller doesn't control.

Bug: T298334
Change-Id: I77dd3c7fef86b4c8c41837bfb276b019f30baeb0
2024-01-09 21:05:18 +00:00
jenkins-bot cc4efec689 Merge "Avoid persisting default gadget configs in definitions" 2024-01-09 17:27:16 +00:00
Translation updater bot 738e9a84c8 Localisation updates from https://translatewiki.net.
Change-Id: Ic040b5c8700e0974aa4a56872e258ab640d28aea
2024-01-09 08:59:35 +01:00
jenkins-bot 47c360c47a Merge "Expand pre-save validations for JSON definition pages" 2024-01-09 06:07:27 +00:00
jenkins-bot add8361fd1 Merge "SpecialGadgetUsage: Fix query for postgres (and improve for mariadb)" 2024-01-09 00:32:37 +00:00
Siddharth VP 41af49e9b5 Expand pre-save validations for JSON definition pages
* Validate that pages have .js, .css or .json suffixes.
* Validate that namespaces are integers, disallowing doubles.
* Validate that type is either general or styles.
* Validate that targets are either desktop or mobile.
* Fix validation of skins: stop allowing `true` as it isn't actually
allowed - it causes an exception in Gadget::isSkinSupported().

Bug: T298334
Change-Id: Ic59c20172f496d281acd59419f5c760ad29ce317
2024-01-08 20:04:12 +00:00
Umherirrender dc84f149bc SpecialGadgetUsage: Fix query for postgres (and improve for mariadb)
The column user_properties.up_value is a text based type in all rdbms.
postgres does not autoconvert strings to numbers, so SUM( up_value )
gives an error when running on postgres.
The use of SUM( up_value ) is also problematic on mariadb/sqlite, as
up_value can be set to any number via the Action API's options module.
This value goes into the sum and produce a wrong result. Using a
non-number value allows to remove the value from the sum and that also
produce a wrong result.

Change the query to exclude the rows which disables a gadget and just
count the "active" ones. Typically there are only rows to disable a
gadget, when the gadget is marked as default, but default gadget are
displayed with the message 'gadgetusage-default' and does not needs to
be counted. In case a gadget was default in the past, there could always
such rows, so be safe and exclude them. That means it is safe to only
count for "active" gadget option usage.
This also allows to remove the up_value condition on the join to
querycachetwo as only rows to enable a gadget are now selected and get
joined to find the active users.

For the join condition use an assoc array, as for database condition the
database class is quoting the value of that array, if that is a string.
In postgres the " is used to quote columns or tables, but not values,
that gives a query error on postgres about the condition.
fixed when using the array style and not "raw" sql.

Define the condition only once as it should be the same for both
queries. Use the new IDatabase::expr function to write that sql piece.

Change-Id: I8dfc3fd5adc4c4bdabceaab20c4b37ffd48e6bee
2024-01-08 18:59:45 +01:00
jenkins-bot 791a330bca Merge "tests: Add test case to assert ES6 is valid by default" 2024-01-08 15:07:47 +00:00
jenkins-bot 08de291eef Merge "tests: Avoid matching source in validateScriptFile error message" 2024-01-08 15:06:54 +00:00
Translation updater bot 2e8d5bd762 Localisation updates from https://translatewiki.net.
Change-Id: Ib5a18070efef5c45fe075d1bb5856428530b2bbb
2024-01-08 09:15:33 +01:00
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
Timo Tijhof 9828552389 tests: Avoid matching source in validateScriptFile error message
Follows-up 3e871f2015 (If45856c563), which was meant to make
change Ie309e761f8b20640f7c0 in MediaWiki core pass, but didn't, and
I failed to realize this before the change landed.

The current error message is quite generic, and does not mention
"quux". The new validator (Peast) gives a better error message, and
thus would contain the word quux:

> Parse error: Unexpected: quux on line 1

My previous change was loosely checking this as a proxy for whether
the source code is included (valid) or stripped (invalid), but this
was a poor proxy. I did that because I assumed, incorrectly, that
this code would become minified. Since that's not true, we can simply
assert the code in its entirety for the valid case, and for the
invalid case only check for the presence of a warning, and leave it to
core to be responsible for omitting the invalid code in that case.

Change-Id: If3b2b4a75013baeaa0d9b92cd10dfb06e5534153
2024-01-06 22:22:25 +00: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 a516fa48c3 tests: Add test case to assert ES6 is valid by default
Bug: T75714
Depends-On: Ie309e761f8b20640f7c0e85def0a3d1ccc8a658e
Change-Id: I1b3518ae4599bae93e36aa2bd1c216fc7cde1d90
2024-01-05 21:51:33 +00:00
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 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