Commit graph

2025 commits

Author SHA1 Message Date
Umherirrender e2c3b41026 Use LanguageNameUtils::AUTONYMS/DEFINED instead of hard coded value
Easier to spot the documentation what happen with this option

Change-Id: Ic053e8daf14a74306b7ca3052503a59a19d16743
2022-12-29 13:43:27 +01:00
Umherirrender a20054fa34 Replace deprecated Language::isValidCode/isSupportedLanguage
Bug: T325974
Change-Id: I0245ea66abeebd9ae9b6d1edce9e8e93a479fdc0
2022-12-29 03:04:32 +01:00
Umherirrender bf4bdddb41 Replace deprecated Language::getFallbacksFor
Bug: T325979
Change-Id: Ia9658d0ce5bcd0c322cca0ffcec6aee82fb20a62
2022-12-29 02:01:09 +00:00
Umherirrender 3b84d90eb7 Replace deprecated Language::factory
Bug: T325986
Change-Id: I27a8742eb4897104d9bdaef298ec97c471baf641
2022-12-29 01:42:41 +00:00
Jon Robson 5425626fda Fixes "Module not loadable on target mobile" warnings
These modules get silently removed on mobile. This seems
unnecessary and most likely unwanted behaviour.

Bug: T324723
Change-Id: Ie3473deb10d96df046963b0bcf1b00bea965e3b3
2022-12-29 01:39:53 +00:00
Umherirrender 6e313296c5 Replace use of deprecated Parser::$mOptions
Bug: T275160
Change-Id: Id17fc7c2db20975fb6fbb2b9bf63a45135f7f354
2022-12-28 00:56:41 +00:00
Umherirrender e76dff032d Replace deprecated Language::fetchLanguageName(s)
Bug: T325962
Change-Id: Iff57224d231480507f138f9ba51f385ed32bf5b1
2022-12-27 17:21:10 +01:00
Translation updater bot b0cbcfffbf Localisation updates from https://translatewiki.net.
Change-Id: Ifd7181cd42240b215b6b8730e5a132c261a242d0
2022-12-22 11:04:35 +01:00
Translation updater bot f7a0c5f88e Localisation updates from https://translatewiki.net.
Change-Id: I516f662b7fa96182128b12f8b82d9a0887f0508c
2022-12-21 09:17:48 +01:00
Translation updater bot 10c5ad416c Localisation updates from https://translatewiki.net.
Change-Id: I2be106a4973bc75b8ea2ea12b78d9161044ad4e3
2022-12-15 11:36:50 +01:00
Translation updater bot abb3a3a24f Localisation updates from https://translatewiki.net.
Change-Id: Ifeef1f7e25eaece71837af5c8a59a185005dfd52
2022-12-14 08:16:23 +01:00
Translation updater bot 258af23151 Localisation updates from https://translatewiki.net.
Change-Id: Ib1e7baafb25439b1cb407ae033a3c45c7f6e365d
2022-12-12 08:22:58 +01:00
Translation updater bot 2272901850 Localisation updates from https://translatewiki.net.
Change-Id: I085c3df7f48d6579c728023b703ff0ac4999531b
2022-12-09 08:47:26 +01:00
Translation updater bot be7f8f0ff9 Localisation updates from https://translatewiki.net.
Change-Id: I382211871e8deac6bae2fd2034f9c01748b22485
2022-12-05 08:34:21 +01:00
Amir E. Aharoni cf446a223c Add namespaces aliases for Moroccan Arabic (ary)
The names are copied from Standard Arabic (ar).

Change-Id: I2ed6e3cc61540e92c9e39ef356fc3ff5ff53ad14
2022-12-05 07:18:14 +02:00
Translation updater bot 7fdc28b76b Localisation updates from https://translatewiki.net.
Change-Id: Ifdff04b918c74acc65fb8344a475f2cc7ed45858
2022-11-29 08:59:16 +01:00
Umherirrender a0732c2db8 tests: Replace assertEmpty with assertCount
Change-Id: I0002bb228701a3a5184ac7f1e38321bf10b23064
2022-11-25 10:26:34 +00:00
Translation updater bot 64b010e9f7 Localisation updates from https://translatewiki.net.
Change-Id: Id81e3c335c5aba30d8637fb11bb3d6fb6992f39b
2022-11-24 08:18:10 +01:00
Ideophagous a871801160 Namespace translations for Moroccan Arabic (ary)
Bug: T291737

Change-Id: I343f2be70ecc50d0ef0400914bddd7adc334386c
2022-11-22 14:00:25 +00:00
Bartosz Dziewoński 46bb5b0ac4 Avoid try…catch where if…else will do when using LanguageFactory
Needed for I869af06896b9757af18488b916211c5a41a8c563, where I am
trying to change LanguageFactory in MediaWiki core not to use
MWException.

Language::isSupportedLanguage() does not actually throw,
so this sigh can be one of relief.

Change-Id: I3079d8e18d88a4a26c2f2b09dccd4beea06678ee
2022-11-18 19:56:45 +00:00
Translation updater bot e415ed564c Localisation updates from https://translatewiki.net.
Change-Id: I8345c5275f6a89a4042f2655ab19197762b6ff70
2022-11-17 08:27:54 +01:00
libraryupgrader 5ba4e6d14d build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 38.0.0 → 40.0.1
  The following sniffs are failing and were disabled:
  * MediaWiki.PHPUnit.AssertEmpty.AssertEmptyUsed

npm:
* stylelint-config-wikimedia: 0.11.1 → 0.13.1

Change-Id: I5c0a3179d60555a334000e4acddf1b5cb0ba0bfa
2022-11-16 15:03:55 +00:00
Translation updater bot 01799a5646 Localisation updates from https://translatewiki.net.
Change-Id: I54d6778fe282f71d43c86c4541f7f59720337af5
2022-11-14 08:11:12 +01:00
libraryupgrader fe04311e6e build: Updating grunt-stylelint to 0.18.0
Change-Id: Ic254bd62e6c05e4c44960ffa8a8cf665ad0008be
2022-11-13 08:52:04 +00:00
Kunal Mehta 66e9257feb Partially revert 912324993f, restore old line ending behavior
As explained in T322883, the switch to
TextContent::normalizeLineEndings() means that rtrim() is run over the
input, which is a breaking and unintentional change.

This partially reverts commit 912324993f.

Bug: T322883
Change-Id: I2ad47d46e05112f413af453d61eb3f13434b2774
2022-11-11 21:04:19 -08:00
Translation updater bot ac1a2fa914 Localisation updates from https://translatewiki.net.
Change-Id: Iab534bbfa2c68b15a5896aa3c0c9b2b0a96aa49a
2022-11-11 08:42:07 +01:00
libraryupgrader 7c682efbef build: Updating dependencies
composer:
* php-parallel-lint/php-console-highlighter: 0.5.0 → 1.0.0
* php-parallel-lint/php-parallel-lint: 1.3.1 → 1.3.2

npm:
* grunt: 1.4.0 → 1.5.3
* grunt-banana-checker: 0.9.0 → 0.10.0
* grunt-eslint: 23.0.0 → 24.0.0
* async: 3.2.0 → 3.2.4
  * https://github.com/advisories/GHSA-fwr7-v2mv-hh25
* minimatch: 3.0.4 → 3.0.8
  * https://github.com/advisories/GHSA-f8q6-p94x-37v3
* minimist: 1.2.5 → 1.2.7
  * https://github.com/advisories/GHSA-xvch-5gv4-984h
* nanoid: 3.1.25 → 3.3.4
  * https://github.com/advisories/GHSA-qrpm-p2h7-hrv2

Additional changes:
* Set `name` in package.json.

Change-Id: I5c6d1443eed4bdb1c0eebceaa06c10b249c59cff
2022-11-11 03:35:49 +00:00
Translation updater bot 3ef9b40ecd Localisation updates from https://translatewiki.net.
Change-Id: I336ce9777673b5ab259ee28267ddc3b6b436d50f
2022-11-07 08:35:24 +01:00
Translation updater bot 395db27aca Localisation updates from https://translatewiki.net.
Change-Id: Ie9129c3eb31fcc10031d5343845389cfa2102dc6
2022-11-04 09:03:47 +01:00
Translation updater bot 6ab7c3b6cf Localisation updates from https://translatewiki.net.
Change-Id: I6d38d9fe9c8ac78f355bd9ef95c61ae72acfa47b
2022-11-02 08:38:45 +01:00
Translation updater bot 771c551f02 Localisation updates from https://translatewiki.net.
Change-Id: I09f356d044e1ecead725d378d62c9df5a27121ff
2022-10-25 08:24:47 +02:00
Translation updater bot c3c71b6d8a Localisation updates from https://translatewiki.net.
Change-Id: I80684f92510f7cfb8647662d44b7da6e679c6c76
2022-10-24 08:23:32 +02:00
Translation updater bot 1b2788d3a5 Localisation updates from https://translatewiki.net.
Change-Id: I9375f1e4ed53ec22e416df80942f57c11c611e00
2022-10-20 08:32:14 +02:00
Jackmcbarn f032e847bf Include the bad timestamp string in the error when unable to parse it
Change-Id: I0a79c25baf829f755aa5d251a78e032a12168364
2022-10-17 03:13:05 +00:00
Kunal Mehta 1000d322e5 Add mw.loadJsonData()
mw.loadData() allows for optimizing the loading Lua tables by requiring
only one parse and lookup. However it's often easier for people to
write/maintain bulk data in JSON rather than Lua tables.

mw.loadJsonData() has roughly the same characteristics as mw.loadData()
and it can be used on JSON content model pages in any namespace.

As noted on the linked bug report, it's possible to already implement
this by writing a wrapper Lua module that loads and parses the JSON
content. But that requires a dummy module for each JSON page, which is
just annoying and inconvenient.

Test cases are copied from the mw.loadData() ones, with a few omissions
for syntax not supported in JSON (e.g. NaN, infinity, etc.).

Bug: T217500
Change-Id: I1b35ad27a37b94064707bb8c9b7108c7078ed4d1
2022-10-13 04:46:25 +00:00
Kunal Mehta 829c53ef05 Add strict.lua to replace "Module:No globals"
For the most part, it is a good idea to avoid global variables and use
`local` variables instead. Quoting from the ScopeTutorial[1], "The
general rule is to always use local variables, unless it's necessary for
every part of your program to be able to access the variable (which is
very rare)."

Wikimedia module authors have written "Module:No globals", which errors
on the use of any global variable. On the English Wikipedia, this is
used on 32% of pages (18 million). Wikidata[2] indicates that it's been
copied to 334 other wikis.

Lua itself distributes an extra named "strict.lua"[3], which is what
this is based off of. Similar to bit32.lua, this is a pure-Lua library
that can be imported/enabled with `require( "strict" )` at the top of a
module.

The two changes I made from Lua's strict is to exempt the `arg` key,
which is used internally by Scribunto, and remove `what()`, since we
don't enable access to `debug.getinfo()` for security reasons.

[1] https://lua-users.org/wiki/ScopeTutorial
[2] https://www.wikidata.org/wiki/Q16748603
[3] http://www.lua.org/extras/5.1/strict.lua

Bug: T209310
Change-Id: I46ee6f630ac6b26c68c31becd1f3b9d961bcab29
2022-10-13 04:39:21 +00:00
Translation updater bot 58a9707c8f Localisation updates from https://translatewiki.net.
Change-Id: I2c351c91e6a13ff3f9b6b39676208ae5c6f0b892
2022-10-10 10:21:09 +02:00
Kunal Mehta 9d94f11309 Hide mw.hash.setupInterface from users
Part of the standard library boilerplate that got missed.

Bug: T276138
Change-Id: I6d55d55405b57b18f3f413a108848f34620c15a6
2022-10-08 22:01:00 +00:00
Reedy 25d49b53c1 build: Update mediawiki/mediawiki-phan-config to 0.12.0
Change-Id: Ifa1a8c2225b6fc1498427f0f61538edc3058cbd8
2022-10-08 21:38:28 +00:00
Kunal Mehta 835631de27 Restore padding on #mw-scribunto-input to make cursor visible
In Chromium-based browsers the lack of padding means the cursor
isn't visible in the textarea when focused. In this case, it's
probably more important for the cursor to be visible than the
lack of padding to make it look more like a terminal.

Bug: T272678
Change-Id: I09ed2933bdac292ee9b9b98a2c8c48d96914d096
2022-10-08 21:35:30 +00:00
Kunal Mehta e8cfa46f87 Use OOUI instead of jquery.ui for error popup
Use OOUI's PopupWidget to display error tracebacks/details instead of a
deprecated jquery.ui dialog.

Bug: T319361
Change-Id: Ie7796c853782de9874595674fe250f6702db717e
2022-10-08 20:33:27 +00:00
Reedy 69ed697681 Add more @covers
Bug: T320330
Change-Id: I3456453226faa3ba68be4deca764839ea0f54539
2022-10-08 20:59:33 +01:00
Brian Wolff 047200c11e Make sure that lua stack trace is valid UTF-8.
This fixes a warning on php8.1 related to preg_match_all returning
null when given invalid UTF-8.

I made a separate patch to change the null into an exception Ic0c9083b

In a sense, this is a follow-up to ec103b6966.

Bug: T319218
Change-Id: Ia17fc2fa428ec35bdbd242f1127fcdff501fb741
2022-10-06 04:08:24 +00:00
Kunal Mehta 0f2585244c Require CSRF token for action=scribunto-console
This is basically unexploitable, given that Scribunto sessions are
"extremely ephemeral", protected by a 31-bit non-cryptographically
random token and generally contain very little useful data.

But, requiring a CSRF token is a best practice and since this module
is internal and only used in one place, it's also unlikely to break
anything. Because it needs a token, the module is POST-only now too.

Bug: T212071
Change-Id: I7fb6b4f856ee6194eb37c26e14f178fea6c0a3f6
2022-10-05 14:38:50 +00:00
Reedy 5f007a0c76 LuaError: Use ?: in more traditional way
Change-Id: I68011e1420ae95127ef284d5044f9f125cc656c3
2022-10-03 19:01:56 +01:00
Translation updater bot 70c21ea447 Localisation updates from https://translatewiki.net.
Change-Id: I23ce41756f6e94ef651814518e20ebe61c511b51
2022-09-30 08:54:46 +02:00
Kunal Mehta 94f1ee4cb3 Fix paths in COPYING after file moves
Change-Id: I92cfb3542d772167c4665710022352ee385dc9a2
2022-09-30 02:15:58 +00:00
Reedy 13e82702ab Add global alias for Scribunto_LuaEngine
Change-Id: I8a53a0583f25b397fec25ba77c8a061426c8a641
2022-09-30 02:07:29 +00:00
Thiemo Kreuz 912324993f Apply some minor PHP code modernizations
* Make use of the ?? syntax.
* Use an upstream function.
* Fix an incomplete type hint.

Change-Id: I7b1916418f4b1e65cc8396cfd646224f55c137a4
2022-09-29 21:45:09 -04:00
Reedy 408f4d0bc6 Namespace tests
Change-Id: I4977bf534400643f83ab3400c3dfd736c53f9705
2022-09-30 00:59:00 +00:00