Commit graph

111965 commits

Author SHA1 Message Date
jenkins-bot
1c91a871f2 Merge "Customise error message for invalid JSON, add hook" 2022-08-29 04:16:54 +00:00
jenkins-bot
44e55a371c Merge "DeleteAction: Improve messaging on successful page deletion" 2022-08-29 02:32:09 +00:00
jenkins-bot
0672f671a8 Merge "mediawiki.storage: Update API guidance to mention new expiry feature" 2022-08-28 21:04:51 +00:00
jenkins-bot
2ded6a222d Merge "Revert "objectcache: avoid php 8.1 argument type warnings in genericKeyFromComponents()"" 2022-08-28 18:16:59 +00:00
Krinkle
453d7c5839 Revert "objectcache: avoid php 8.1 argument type warnings in genericKeyFromComponents()"
This reverts commit 9786c54e39.

Reason for revert: The function accepts both int and string.
If there were warnings for int, then silencing the warning would be
fair, but the PHP 8.1 deprecation warning is only for nulls, which are
are unsupported by makeKey() and would mask a likely source of genuine
mistakes.

Change-Id: I5c57d7721ed9ae51d617c2c125adb0bf8bf31f1d
2022-08-26 23:25:20 +00:00
jenkins-bot
94d71c83c1 Merge "Replace trivial usages of code in strings with concatenation" 2022-08-26 16:54:56 +00:00
jenkins-bot
e940d55cab Merge "docs: Fix syntax of markdown link in DEVELOPERS.md" 2022-08-26 16:54:44 +00:00
jenkins-bot
2014984d40 Merge "ResourceLoaderSkinModule: Document new interface styles" 2022-08-26 14:49:18 +00:00
jenkins-bot
192efd69d5 Merge "Add --dry-run flag to rebuildLocalisationCache.php" 2022-08-26 14:30:32 +00:00
Jon Robson
e8096656e7 ResourceLoaderSkinModule: Document new interface styles
Follow up to Ib5ae640bb260cee46e654228b785c776722c7003

Bug: T316027
Change-Id: Ia6af9fb213d8bd5b18ec95371489cfa0bdf7ed64
2022-08-26 14:19:20 +00:00
Thiemo Kreuz
67c56155c7 Replace trivial usages of code in strings with concatenation
This is really hard to read. What is code, what is string? These
places are so simple, they really don't need the "{$var}" syntax.

Change-Id: I589dedb8c0193eec4eef500bbb896b5b790b727b
2022-08-26 12:26:44 +00:00
Timo Tijhof
f2100f5413 docs: Fix syntax of markdown link in DEVELOPERS.md
On GitHub and Phabricator, backtics are not valid inside a link,
thus leading to a broken -unlinked- rendering of this text.

For example, https://github.com/wikimedia/mediawiki/blob/1.38.2/DEVELOPERS.md

Change-Id: Icc5fad9e6a747d0ccee52880597b861bcbc23a79
2022-08-26 12:22:13 +01:00
jenkins-bot
553c712378 Merge "HTMLTransform: add more tests" 2022-08-26 09:54:30 +00:00
daniel
cee1d08550 HTMLTransform: add more tests
This improves test coverage by testing the interaction of getters and
setters.

Change-Id: I90506d73e5571fda6c26eb72359e41951b3950c1
2022-08-26 11:33:39 +02:00
Translation updater bot
0c6f7dba49 Localisation updates from https://translatewiki.net.
Change-Id: I923ca16d60ab00e5d2117cb2e60ee6df19c745df
2022-08-26 08:04:29 +02:00
Subramanya Sastry
f26545ddbf Followup on 02d13afa: Unbreak Parsoid parser test runs
Change-Id: I226b145eb20440d068f92a0c99d11cbced4cf64d
2022-08-25 17:32:24 -05:00
Ahmon Dancy
94fd8ef132 Add --dry-run flag to rebuildLocalisationCache.php
Add a dry run mode to rebuildLocalisationCache.php to aid l10n cache
rebuild debugging.

Change-Id: Ibb5494c91d43c809e114f59ad9c178e62047b311
2022-08-25 14:45:30 -07:00
jenkins-bot
246b1f64e5 Merge "ParsoidHandlerTest: Add tests to cover tryToCreatePageConfig()" 2022-08-25 20:12:46 +00:00
Siddharth VP
3af9036b99 Customise error message for invalid JSON, add hook
When invalid JSON is being saved, change the error message from the
generic "invalid-content-data" to "invalid-json-data" with the specific
error passed as param.

Allow extensions to hook into JSON validation, enabling them to apply
additional validations for specific JSON files such as MediaWiki:*.json
config files. The page identity is passed to the hook.

Bug: T313254
Change-Id: If9590c29ed0b871b03a3db8f13e72ee9cfdd7e2b
2022-08-26 01:22:10 +05:30
jenkins-bot
2f3ef0be35 Merge "Linker: Omit default value '' on Html::rawElement" 2022-08-25 19:23:14 +00:00
Derick Alangi
0859331ba1 ParsoidHandlerTest: Add tests to cover tryToCreatePageConfig()
This patch creates a patch to cover the aforementioned code path for
when it works correctly and when it throws.

Change-Id: I4b3d9f280a0977d3811afb768824da302673e659
2022-08-25 19:42:48 +01:00
jenkins-bot
1c7adc8f8b Merge "Split setOriginalData( ... ) to more related setters for encapsulation" 2022-08-25 18:10:33 +00:00
jenkins-bot
592c25352f Merge "Replace usage of User::getOption" 2022-08-25 17:13:02 +00:00
daniel
df0744f402 Split setOriginalData( ... ) to more related setters for encapsulation
By splitting the setOriginalData methods into several setters, we remove
any knowledge about the structure of the request body from HTMLTransform.
It also allows us to be specific about which data to operate on.

This also removes the concept of page bundles from the public interface
of HTMLTransform. PageBundle objects are used only internally.

Change-Id: If97a74ce251f281b7d980928a01b764d6ec0d0a4
2022-08-25 18:40:26 +02:00
Sébastien Beyou
4d7d630411 Fix continuations on second use in ApiSandbox
Bug: T313517
Co-Authored-byː Anomie <bjorsch@wikimedia.org>
Change-Id: Ic96040f939d21894404814cc637649b173fcbe6a
2022-08-25 13:14:03 +02:00
Translation updater bot
09c52b93ad Localisation updates from https://translatewiki.net.
Change-Id: I8071bd010bc9c1f2bc7d0c41f569dc99d778bcf3
2022-08-25 07:38:11 +00:00
jenkins-bot
f02dfc6d99 Merge "DifferenceEngine: Should respect skin option for rendering table of contents" 2022-08-25 00:50:47 +00:00
jenkins-bot
25456a1756 Merge "rdbms: Remove synchronous pre-send waitForReplication fallback" 2022-08-24 21:37:43 +00:00
jenkins-bot
12ef8179ba Merge "Display page namespace with spaces instead of underscores when page doesn't exist" 2022-08-24 21:07:18 +00:00
Timo Tijhof
7e9650da18 rdbms: Remove synchronous pre-send waitForReplication fallback
The `$workCallback` passed from MediaWiki.php to LBFactory is an
optional callback that Rdbms may invoke whenever it expects to idle
for some time before waiting for something.

In practice, this never happens because the main reason it was
introduced was for use in ChronologyProtector, and it was removed from
there last year in commit bd7cf4dce9 (I0456f5d40a).

The code wrapping for it has remained in-place, because there was
still one theoretical caller in LBFactory for when Redis (or some
other ChronologyProtector store) is down.

I propose that if Redis is down, the fallback is that we let
replication happen normally, which we expect in most cases to suffice
by itself, since replication is generally faster than a full
server-client-server RTT. CP logs a warning when this happens, for
operational visibility.

In the past 90 days, there are exactly 2 entries in unsampled WMF
Logstash for `channel:DBReplication message:persistSessionReplicationPositions`
(not including labswiki/cloudweb which were having problems in this
timeframe, failing for related reasons).

Logs for the two matching reqId:

1. 2022-07-14 wikidata POST /w/api.php (referer: -)
   > - MediumSpecificBagOStuff::doLock failed due to timeout for
   >   global:Wikimedia\Rdbms\ChronologyProtector:87f2d18…:v2.
   > - …::persistSessionReplicationPositions: failed to save primary
       positions for DB cluster(s) s8, cluster27

2. 2022-07-27 enwiki POST /w/index.php (referer: Special:CreateAccount)
   > - MediumSpecificBagOStuff::doLock failed due to timeout for
   >   global:Wikimedia\Rdbms\ChronologyProtector:d19e340…:v2.
   > - …::persistSessionReplicationPositions: failed to save primary
       positions for DB cluster(s) extension2

Bug: T314434
Change-Id: Id60cf994c7a40c50b487e6281c6bd114ddf13690
2022-08-24 20:52:17 +00:00
Bartosz Dziewoński
17fe83456a Display page namespace with spaces instead of underscores when page doesn't exist
Follow-up to f7158c396d.

When the page exists, we use a different code path, calling
TrivialLanguageConverter::convertSplitTitle() or
LanguageConverter::convertSplitTitle() to format the namespace,
which already does this.

Bug: T316092
Change-Id: I7ff29ab7cd0999e364ec5521cc2097cbe6f1ed3d
2022-08-24 20:45:51 +00:00
jenkins-bot
2e54519207 Merge "rdbms: Remove obsolete cross-dc wait from ChronologyProtector" 2022-08-24 20:15:57 +00:00
jenkins-bot
109b396d3c Merge "ResourceLoaderSkinModule: Split up interface feature into multiple parts" 2022-08-24 17:16:34 +00:00
jenkins-bot
41183585b4 Merge "tests: Migrate away from setMwGlobals()" 2022-08-24 15:57:10 +00:00
Jon Robson
ac389cf0f0 ResourceLoaderSkinModule: Split up interface feature into multiple parts
While working on the site notice in Vector we've noticed these
styles are proving more problematic than helpful so splitting these
up allows us more granularity in the styles we ship.

The core interface styles are now enabled by default as they contain
important logic relating to empty portlets and the print footer

Bug: T316027
Change-Id: Ib5ae640bb260cee46e654228b785c776722c7003
2022-08-24 13:59:17 +00:00
Brian Wolff
4c432b6ad5 Add a null check VueComponentParser to prevent php8.1 issues
The third argument to VueComponentParser::element is null for
void elements. Trying to run preg_replace on a null string causes
a warning in php8.1. Add a check for null.

This fixes a unit failure test in php8.1:
RuntimeException: Error parsing file 'resources/skins.vector.search/App.vue'
in module 'skins.vector.search': preg_replace(): Passing null to parameter #3
($subject) of type array|string is deprecated

Bug: T313663
Change-Id: I6904b0279ecc7bada3f8203a165307c17e5ee795
2022-08-24 08:01:41 +00:00
jenkins-bot
3c78ffdde2 Merge "Do not compare byte-for-byte of serialized items in tests [php8.1]" 2022-08-24 08:00:24 +00:00
Michał Turek
1d87b8e7b3 Sanitizer: Don't consider inline var CSS insecure
Since (T208881) "CSS using var() to create exponential sized calc() on wiki page will crash visitor's browser" was fixed by disabling var in inline CSS, the issue with browser crashes appears to have been fixed in Firefox, Chrome, modern Edge, and Opera.
This change reverts T208881.

Bug: T288201
Change-Id: I387a0e9fdd02faa69616890c613462c83b91b789
2022-08-24 07:17:28 +00:00
jenkins-bot
72914c2b17 Merge "api: Deprecate ApiQuery::getNamedDB and ::selectNamedDB()" 2022-08-24 07:16:35 +00:00
Brian Wolff
e219728857 Do not compare byte-for-byte of serialized items in tests [php8.1]
PHP 8.1 changes the order of protected properties in the output
of serialize(). Previously they were at the end of the
serialized stream, now they are at the beginning.

Given that serialization formats have multiple equivalent encodings,
and there is no guarantee that they might not arbitrary change between
versions in backwards compatible ways, I think we should not do
byte for byte comparisons. Instead we should deserialize both
and compare the resulting objects for equality. This should test
what we want to know (That we can read serialized structures) well
also being safe against compatible format changes.

This fixes a number of failing ParserOutputTest::testSerialization
on php 8.1.

Bug: T313663
Change-Id: Ic7a08b436d65ab7492f343fa02281e245834aaea
2022-08-24 07:06:06 +00:00
Translation updater bot
7a64e989c9 Localisation updates from https://translatewiki.net.
Change-Id: I7b34a1b4e9b386e7b7e562607e0e52dfdf1412bd
2022-08-24 08:10:44 +02:00
jenkins-bot
5ac0ba83e1 Merge "ResourceLoader: Hoist and simplify @covers in test cases" 2022-08-24 03:24:04 +00:00
jenkins-bot
1eeda5810f Merge "filerepo: avoid PHP 8 warnings in File::splitMime() if $mime is null" 2022-08-24 03:20:12 +00:00
Aaron Schulz
888aa8104d filerepo: avoid PHP 8 warnings in File::splitMime() if $mime is null
The warnings were causing CI failures in some upload tests.

Bug: T253483
Change-Id: I5c4e0a4d9b154e590daea0fb9d9e04bd086d768b
2022-08-23 17:12:01 -07:00
Timo Tijhof
11f729301b ResourceLoader: Hoist and simplify @covers in test cases
I consider it busywork to maintain this, for no tangible benefit.
Limiting the credited coverage to a class is limiting enough to
exclude unintended coverage from reports. Especially as this
helps ensure tracking coverage correctly for implementation details
such as helper methods and internal methods that do not warrant
their own test as that would defeat the purpose of tests exercising
the contract and demonstrating good usage.

Change-Id: Icf865f15cbd86585bbc02fc4943a960efb40c0eb
2022-08-23 23:59:17 +00:00
jenkins-bot
f41a43ccc8 Merge "Deprecate use of wvui library" 2022-08-23 19:57:47 +00:00
jenkins-bot
08d8e1da19 Merge "UserClearNewTalkNotificationHook: Add a \ before class name" 2022-08-23 19:51:21 +00:00
Gergő Tisza
e83dcb3fb3 Fix and document AbstractBlock::getPermissionsError()
This method is supposed to return a single message in array form
(['key', 'param1', ...]), as can be seen e.g. in includes/Block.php
in MediaWiki 1.31 of the includes/block classes in 1.34.

Allow for the key to be a Message object, which means passing the
array contents as a functions parameter list will work with most
message-related functions, is already used by the GlobalBlocking
extension, and allows more complex messages not possible with plain
arrays.

Change-Id: Ic19dc1dde25794f9bb3b3b5d8abba8ddf8948886
2022-08-23 19:30:16 +00:00
Jon Robson
af9b17b660 DifferenceEngine: Should respect skin option for rendering table of contents
Bug: T311529
Change-Id: If6267f3389b166043fc94d7f952bc54122b1a378
2022-08-23 15:44:36 +00:00
Jon Robson
e0d4212db6 Deprecate use of wvui library
Bug: T310243
Change-Id: I09eab36c94190ae6d2a992f865f41bcf0239bbb0
2022-08-23 15:01:03 +01:00