This makes way for "MediaWiki:Gadgets/<id>.json" to be used free of
any confusion or misinterpretation about the subpage being a
translation of "MediaWiki:Gadgets".
Change-Id: Icb68ce6c26a83d7201a97a5406f8752b3c5b0855
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
* 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
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
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
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