Commit graph

2260 commits

Author SHA1 Message Date
Reedy 1b2a84aaff Gadget: Bump GADGET_CLASS_VERSION
Bug: T356322
Follows-Up: If6d742ea719e4c8db9d915e8297d915d2150ef50
Change-Id: Id5f60e054304e6a715f0f54d11fd2f467fe4c5c7
2024-01-31 19:37:07 +00:00
Translation updater bot 5ec56bef7d Localisation updates from https://translatewiki.net.
Change-Id: I82f87498d700c4be85ef94bd0dd03c273aa8fae0
2024-01-31 08:29:04 +01:00
Translation updater bot 11fa3db4a4 Localisation updates from https://translatewiki.net.
Change-Id: I7c634517cd4dfbf7bbcf967ce726d239870fae6a
2024-01-30 09:39:04 +01:00
Translation updater bot e87235edaf Localisation updates from https://translatewiki.net.
Change-Id: Icb93c28cc7e06f137617865c45da70b6b405ced1
2024-01-28 16:06:41 +01:00
James D. Forrester 27f913cc96 Drop RL targets definitions from module class, and validation / error code
Bug: T328497
Change-Id: If6d742ea719e4c8db9d915e8297d915d2150ef50
2024-01-24 12:11:20 -05:00
jenkins-bot 677e3a86ff Merge "Make Special:Gadgets [Edit description] link smaller" 2024-01-24 00:51:15 +00:00
jenkins-bot 705c01a7ca Merge "SpecialGadgets: refactor" 2024-01-19 09:26:20 +00:00
Translation updater bot b0cb91e055 Localisation updates from https://translatewiki.net.
Change-Id: I5a33f2fa139b25e0139e7b02ed8025ad31799c65
2024-01-19 09:17:01 +01:00
Novem Linguae cc22098a48 Make Special:Gadgets [Edit description] link smaller
To match the style of section [edit] links in articles.

Bug: T344489
Change-Id: Ic3fd864a7b2889ba246418d4a781fd8db29f5ce9
2024-01-18 16:49:16 -08:00
Novem Linguae 5b656b1ee9 SpecialGadgets: refactor
Improve code grouping and comments.

Change-Id: I67fd8081fb5e47bd5a13c85b68433d9a90b67c05
2024-01-18 16:44:43 -08:00
jenkins-bot da62832dde Merge "SpecialGadgets: better variable names" 2024-01-18 23:21:01 +00:00
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 209c626d66 SpecialGadgets: better variable names
Change-Id: I515d4016a3cb4a9eeb2488a39afa2b5d48a2dc48
2024-01-17 07:59:17 -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