Commit graph

1904 commits

Author SHA1 Message Date
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
Reedy 1eecdac6de Capitalise Engines folder
Change-Id: I6d730d67decc859fd130fee5ec92b1cfb8d9ef64
2022-09-30 00:58:27 +00:00
Reedy 073a365759 "Namespace LuaCommon" take 2
Revert "Revert "Namespace LuaCommon""

This reverts commit 18d122b60d.

Change-Id: I74fd43f7920c8772e9078f745ac6062d5461a7f1
2022-09-30 00:52:27 +00:00
Translation updater bot 640f6106a8 Localisation updates from https://translatewiki.net.
Change-Id: Ice83d56751fff0b283fc175f518c98eef7d4a7d3
2022-09-28 08:22:41 +02:00
Translation updater bot b2e69c4f68 Localisation updates from https://translatewiki.net.
Change-Id: Idb3cad1b568dbb3ca1d3ce4580ed22f738eea0d5
2022-09-26 08:16:16 +02:00
Translation updater bot 97f5f5c5c0 Localisation updates from https://translatewiki.net.
Change-Id: Idb5d1d5f94914491c1f37e299f5b95baf19ee540
2022-09-23 08:30:05 +02:00
Kunal Mehta 4ccebcdf4b Simplify creating JSON pages in the Module namespace
Pages ending with a ".json" suffix in the Module namespace will use the
built-in JSON content model by default. Previously editors had to use
Special:ChangeContentModel to get a JSON page, which requires the
"editcontentmodel" userright that is not granted to a wide set of users
by default.

Bug: T144475
Change-Id: I1546fcad823a55a8c5a93177df8715844de1e87c
2022-09-22 19:48:52 -07:00
Translation updater bot f40379a310 Localisation updates from https://translatewiki.net.
Change-Id: I065c696986112ea6843a0bac382c94d021602b24
2022-09-19 08:25:52 +02:00
Subramanya Sastry 23ac31e746 Add Parsoid-specific support for handling preprocessed nowikis
* This patch builds on core functionality provided in
  Ied0295feab06027a8df885b3215435e596f0353b.

* This removes any nowiki wrappers present in unstripped text
  (which there would be for preprocssed nowiki tags) which mimics
  the effect of procssing nowikis in core when generating HTML.

* Updated lua tests to verify the new expectation.

* A previously failing parser test added to test T272507 now passes
  and has been re-enabled.

Bug: T272507
Depends-On: Ied0295feab06027a8df885b3215435e596f0353b
Change-Id: I1613ac7bd60cf3ef4a3308b08ea3705b3cf2dee0
2022-09-08 23:17:46 +00:00
Translation updater bot 55820ed10f Localisation updates from https://translatewiki.net.
Change-Id: I00953a9209306e631cb361a039d9635339157135
2022-09-06 09:39:49 +02:00
Subramanya Sastry 3aa6ad45db Temporarily disable the newly added test in f230419b
* This test fails with a core patch and will only pass in a
  subsequent patch in this repo.

Needed-By: Ied0295feab06027a8df885b3215435e596f0353b
Change-Id: Id6ea611549e98893f53094116a3851e9c42b8dc8
2022-09-01 21:24:25 +00:00
Arlo Breault 7778a6eef3 Revert "Disable Parsoid testing tempoarily"
This reverts commit 2c3a363cdc.

Depends-On: I7c419e1d508c337328db1d5132454fb805bfb1b5
Change-Id: I1770656d450ee0ba0ca115993812c06116eb5928
2022-09-01 21:08:20 +00:00
Translation updater bot 8c6653960a Localisation updates from https://translatewiki.net.
Change-Id: I0dcaf9e9be58b3db5adbed7b82ba2dcf25428453
2022-08-31 09:35:40 +02:00
Subramanya Sastry 7170021941 Update failing language tests
* Ia3cc8f95833cd0e9ae985528f8e72396111c4504 in core changed
  localizations for kaa language

Followup-To: Ia3cc8f95833cd0e9ae985528f8e72396111c4504
Change-Id: Ie1b686b65f008c0cd5f4017102699e51f6960b39
2022-08-29 16:20:59 -05:00
Subramanya Sastry 2c3a363cdc Disable Parsoid testing tempoarily
* Running into a missing module error in CI but cannot reproduce
  locally.

* Let us unbreak CI for other dependent repos and investigate this
  in the followup patch that reverts this.

Bug: T316331
Change-Id: Ic5983e503203f132fff521e422f0c7143f91d779
2022-08-26 14:57:48 +00:00
Subramanya Sastry f230419baf Enable testing with Parsoid + add failing test for T272507
* Turned on wt2html and wt2wt Parsoid modes for all tests with
  aggressive normalization to eliminate the need to add html/parsoid
  sections.

  We expect these modes to pass.

* The failing wt2wt tests is because the input wikitext duplicates
  arguments and Parsoid's wt2html doesn't capture duplicate template
  args which cause the wt2wt output to be normalized.

  This explains the two failing wt2wt tests and the corresponding
  selser "failures".

* The failing wt2html safesubst test might be a real failure and
  something we will have to look into. Will file a phab task for this.

* Added a new test for T272507 that fails with Parsoid right now,
  but will pass in a subsequent patch.

Change-Id: I96fba68dda7524d2fe562eb60ced64e5e0518f65
2022-08-22 13:27:20 -05:00
Tim Starling 6f437487b8 Fix incorrect param type, causing phan error
Change-Id: I3a87b0c58fd897ea83dbb44c51a01d206d1cd024
2022-08-22 17:26:57 +00:00
Alexander Vorwerk 738ca8d72d Bump scribunto-stats cache version
The addition of PSquare::__serialize() in wikimedia/running-stat is
having the same cache implication as the issue this was meant to fix.

The legacy PHP serialized form is not compatible with the stable
serialize form that we're switching to.

Bug: T313341
Change-Id: Iec4c1c958e10560abcbd4184a0ca4e1a0c19183a
2022-08-16 19:09:36 +00:00
Subramanya Sastry 8adcc1668f Update failing language tests
* Core changed these kaa localizations in
  Ie0ce427238412d3badb247d2e2fae9bc9f57fbeb

Followup-To: Ie0ce427238412d3badb247d2e2fae9bc9f57fbeb
Change-Id: I7fc0334bf78222f2d7c1b636a70b3c60f899363c
2022-08-12 17:57:21 +00:00
Translation updater bot fc5e20a651 Localisation updates from https://translatewiki.net.
Change-Id: If14a2d08e9094621344736bf0ad84fbe6e75d40a
2022-08-08 08:59:26 +02:00
Lucas Werkmeister (WMDE) 18d122b60d Revert "Namespace LuaCommon"
This reverts commit 62e1fb0b5f.

Reason for revert: caused several errors:
* unnamespaced HooksTest collides with core’s class of the same name
* Scribunto_LuaError renamed without class alias despite being used in Wikibase

Bug: T314464
Change-Id: I8b151327236bf86945e59823fba155497e4b3fc6
2022-08-03 10:03:12 +00:00
Reedy 62e1fb0b5f Namespace LuaCommon
Change-Id: Ib6e912e71fb797942aca4b4f22eb0ff9e005a662
2022-08-03 06:03:57 +00:00