Commit graph

7722 commits

Author SHA1 Message Date
Daimona Eaytoy 2a89b3fb6d Skip CheckUserHandlerTest if CheckUser is not installed
The handler class uses hook interfaces from the CheckUser extension, so
it can't run if CheckUser is not installed.

Change-Id: I5f40366f27cc885e95e1bb93ec421b09c7caa9a6
2023-07-15 22:04:42 +02:00
jenkins-bot 1f930d3e16 Merge "Re-enable skipped tests with fixes" 2023-07-14 14:02:53 +00:00
jenkins-bot c0c344a2f9 Merge "Temporarily skip tests being broken in READ NEW of externallinks" 2023-07-14 12:17:19 +00:00
Translation updater bot e61b34eb69 Localisation updates from https://translatewiki.net.
Change-Id: I1aee313576eb42244316ae34241dde3ea4bca91a
2023-07-14 09:28:21 +02:00
Amir Sarabadani 85639c857a Re-enable skipped tests with fixes
Depends-On: Ia55cb6cbdb28484e820f9cf3d6aacac00a86ffab
Bug: T341828
Change-Id: Id0aad8aeb7b5380f4d934d9133abf0e12dee29fe
2023-07-13 23:01:22 +02:00
Amir Sarabadani 4eab548a02 Temporarily skip tests being broken in READ NEW of externallinks
Bug: T341828
Change-Id: I2d4ef8fc3bffa43bc611af3eab0494f4900df557
2023-07-13 22:42:47 +02:00
Translation updater bot 815288a211 Localisation updates from https://translatewiki.net.
Change-Id: I3adf1086384f63c530735a8ad1de1ec9cf030f7b
2023-07-13 10:48:07 +02:00
Daimona Eaytoy 080dadf78e Update selenium and related dependencies
These are the latest 7.x versions available. It looks like upgrading to
version 8 is a bigger task, so leaving that aside for now.

Change-Id: I5eb67f19d24b8e28dcd6ae80ef9e00db18ec2bda
2023-07-12 19:22:45 +00:00
jenkins-bot 9aa87e9234 Merge "Clean up AbuseFilterViewTestBatch" 2023-07-12 13:12:47 +00:00
jenkins-bot df73ddaed0 Merge "Translate Special:BlockedExternalDomains into Polish" 2023-07-11 12:25:26 +00:00
Translation updater bot a48db11e3b Localisation updates from https://translatewiki.net.
Change-Id: I8c3e2887d17af4c366fc2481803dc4307a0a0d08
2023-07-11 08:48:22 +02:00
Msz2001 a2d1422095 Translate Special:BlockedExternalDomains into Polish
Change-Id: I4ded6b4e85a4bb7a1fa0ad4560d5390d646c41cc
2023-07-10 15:43:36 +00:00
Translation updater bot ae71c24673 Localisation updates from https://translatewiki.net.
Change-Id: Ide37998e35f6827d2da165303da71a37f78d017f
2023-07-10 09:35:57 +02:00
Translation updater bot 72f8724e7b Localisation updates from https://translatewiki.net.
Change-Id: Iab27a709e3f925d0bc3f86c7745f31c992e223a0
2023-07-07 09:05:13 +02:00
Translation updater bot 9d1001c500 Localisation updates from https://translatewiki.net.
Change-Id: I6f443233a78983344e49b1e445f85f6c23b4dc97
2023-07-06 10:09:50 +02:00
Matěj Suchánek 49edc86a78 Split VariableGenerator::addEditVars
This method actually consists of two: add derived vars, and initialize
content vars. The former part depends on no parameters of this method.
On the other hand, the latter part combines multiple implementations
for some of the content variables using branching.

The branching is a dirty workaround and inferior to the GRASP principle:
"When related alternatives or behaviors vary by type, assign
responsibility for the behavior to the types for which the behavior
varies."
In other words, the callers (extensions) should be responsible for
choosing the initialization strategy themselves, instead of letting
VariableGenerator figure it out.

As the first step, split the former part to a separate method.
For now, it will be implicitly called by ::addEditVars.

Change-Id: I5ff00dbdbf29ec54eabfd95c44a4fd7f713969f5
2023-07-05 14:58:32 +00:00
Translation updater bot 865c6cce0a Localisation updates from https://translatewiki.net.
Change-Id: I31a6d8ab22453be11e2ae7c3cc8c7ccafd91e4de
2023-07-05 08:26:36 +02:00
jenkins-bot 8b3a0fe96d Merge "[i18n] Translate BlockedExternalDomains to Czech" 2023-07-04 13:21:00 +00:00
Translation updater bot a953a861fc Localisation updates from https://translatewiki.net.
Change-Id: If0e2ddbb82ba1b6da595234cb7a17d0a8af917c4
2023-07-03 10:13:26 +02:00
Martin Urbanec 2a9a743d4e [i18n] Translate BlockedExternalDomains to Czech
Change-Id: Ifa8fefaa2f907276fafba88bb7b2226b9c056442
2023-07-02 21:27:29 +02:00
Tim Starling fe592746b7 Use the new Wikimedia\Diff namespace
Bug: T339184
Change-Id: I381686678524868c85466bdafde3856a73a8cb1c
2023-06-29 11:56:13 +10:00
Translation updater bot d950306544 Localisation updates from https://translatewiki.net.
Change-Id: I49297dd94dd429020dd5eedf9c5dbcc349a7120d
2023-06-28 17:32:16 +02:00
Amir Sarabadani ec51620957 Restrict view of "abusefilterblockeddomainhit" logs to "*"
That is noop but at the same time prevents logs of hitting blocked domains
list from showing up in watchlists.

Change-Id: I56225f80bb7d87841fd991f5cde49e67bdb5823a
2023-06-27 20:16:00 +02:00
jenkins-bot 86af99622c Merge "ConsequencesFactory: Avoid creating Session object during service wiring" 2023-06-27 18:00:33 +00:00
Translation updater bot d74a25fac8 Localisation updates from https://translatewiki.net.
Change-Id: I60a87697f00f699ce06121e0af92d3bf281a72b2
2023-06-27 19:26:02 +02:00
Abijeet b1e404fc79 ConsequencesFactory: Avoid creating Session object during service wiring
Service wiring should only depend on config, not on request state.

Creating a session object during service wiring causes issues with entry
points such as opensearch_desc.php that disable the session.

Bug: T340113
Change-Id: I2450b0b6821ff0b097e283ff660a0b8aeea9590a
2023-06-27 20:11:38 +05:30
Matěj Suchánek c2a40fb0ff Clean up AbuseFilterViewTestBatch
Inject dependencies, use implicit form validation.

Change-Id: I74afeeceb39ada93cf3c20d5d3fc417ab4e3bf4b
2023-06-27 10:53:45 +02:00
Translation updater bot 683681eae6 Localisation updates from https://translatewiki.net.
Change-Id: I8288647998c99ee462ed36bbaab0a5f4135fcca3
2023-06-26 12:36:40 +02:00
Umherirrender 50446282c2 api: Remove old apihelp i18n description messages
No longer used since 1.33

Automatically removed message keys with "doc-apihelp-description" in qqq

Bug: T340253
Change-Id: I1ae9da8250b91bfe5439f6caf93db33cb508509c
2023-06-23 22:51:58 +02:00
jenkins-bot c897335bd7 Merge "Various code style clean-ups" 2023-06-23 18:43:58 +00:00
jenkins-bot 0c33716f5b Merge "Mark protected stuff in classes with no subclasses as private" 2023-06-23 18:35:48 +00:00
thiemowmde 9316a7d65f Mark some unused public class features as private
These are not used anywhere outside of these classes.

Change-Id: I0a0a5cf1e84133bae69b95da771c285ee27f926c
2023-06-23 12:32:38 +02:00
thiemowmde d9bca83ec6 Various code style clean-ups
For example:
* Use the more meaningful str_contains().
* Add missing type hints.
* Make use of early returns/guard clauses.

Change-Id: Id150d1b17a80ea637a0639a8f2fd7fd017ad23b1
2023-06-23 12:32:12 +02:00
thiemowmde 24888bea15 Mark protected stuff in classes with no subclasses as private
Protected effectively means "public to subclasses" and should be
avoided for the same reasons as marking everything as public should
be avoided.

Change-Id: Iba674b486ce53fd1f94f70163d47824e969abb77
2023-06-23 12:28:06 +02:00
thiemowmde 0bb3aa38ed Fix removing a domain when the page doesn't exist
This was an unfortunate mistake in the refactoring in I2ccb587,
caused by incomplete documentation and a confusing mixture of
possible return types.

I9166c2b fixed one of the two places already. The situation in this
patch here cannot really happen in reality (there is nothing to
remove when the page is empty). Still I think the code is easier to
read when the two places behave the same.

Change-Id: Iea51c3a7a8185cbc3771143353f4795dde712ec4
2023-06-22 11:54:53 +02:00
Amir Sarabadani 8f216a6030 Fix adding a domain when the page doesn't exist
It should fail on null but it should create the page if it doesn't
exist or doesn't have any content yet.
This is breaking the special page, see:
[[de:234828092#New_special_page_to_fight_spam_//_Neue_Spezialseite_zur_Spam-Bekämpfung]]

Change-Id: I9166c2bdcfacb4b19706d246fbf99b2f24ca4cc6
2023-06-22 08:36:49 +00:00
jenkins-bot 435d47e489 Merge "BlockedExternalDomains: De-duplicate validateDomain logic" 2023-06-21 20:40:55 +00:00
jenkins-bot f6d420a353 Merge "BlockedExternalDomains: Optimize host extraction by using parse_url" 2023-06-21 20:38:24 +00:00
jenkins-bot 2dc5c7991e Merge "BlockedExternalDomains: Minor code clean up and docs improvement" 2023-06-21 20:38:22 +00:00
Translation updater bot 2d490278cf Localisation updates from https://translatewiki.net.
Change-Id: I8d9f8200b4c1f9c752c96cffedfabc5ba337d35b
2023-06-20 09:50:03 +02:00
Timo Tijhof 110484b6a0 BlockedExternalDomains: De-duplicate validateDomain logic
Bug: T337431
Change-Id: Icbedf750f6ecaa9caf7bb900e8ad0bc2124e8743
2023-06-19 13:36:32 +00:00
Timo Tijhof 203d54be11 BlockedExternalDomains: Optimize host extraction by using parse_url
Unlike what the 20-year old source comments in UrlUtils.php would
have you believe, parse_url() works fine nowadays, including for
protocol-relative URLs and indeed lots of prod code uses it directly.

The class still has some convenience value for case where you need to
expand or manipulate URLs, but for the common case of extracting a part
of it, you really don't need it.

Test plan:
$ php phpunit.php ../../extensions/AbuseFilter/tests/phpunit/integration/FilteredActionsHandlerTest.php

Bug: T337431
Change-Id: I1e76d2f5aef65365743214530faba656325b965a
2023-06-19 13:36:27 +00:00
Timo Tijhof ee238e79b9 BlockedExternalDomains: Minor code clean up and docs improvement
* Remove stray `@ingroup` from file blocks, move to class block.

* Fix mention of "WAN" cache where actually APCU is used.

* Document that the storage class takes a local-server cache.
  This is an important requirement since the class has no
  coordination for purging or other invalidation. It expects
  an uncoordinated cache.

* Rename "load" to "loadConfig" as it's ambigious what it means among
  the half dozen other "load*" methods in this class. Also inline
  loadFromConfig and loadComputedUncached while at it to further
  reduce this.

* Rename "loadConfigContent" to "fetchLatestConfig" to match
  the existing fetchConfig, which does the same thing except it queries
  the primary db using READ_LATEST.

* Use Html.php when building HTML, instead of legacy Xml.php.
  While at it, also switch a few to Html::element instead of
  Html::rawElement (aka Xml::tags) by using Message->text() for
  messages that are not expected to contain rich wikitext.

Change-Id: Ic74d1597aa9201b371894e7a4bf9361752d9db21
2023-06-19 13:36:23 +00:00
Translation updater bot e1e85f9e62 Localisation updates from https://translatewiki.net.
Change-Id: I0a7fc93673a7c89c055158af4f76e4779961cd5f
2023-06-19 11:05:55 +02:00
Amir Sarabadani 9dc1a601ac Blocked domains: Fix removing a domain via the special page
Doing unset on array leads to the final array turning into associative array
and gets blocked by the validator.

You can check that it's broken in Persian Wikipedia, beta cluster or
localhost. Tested locally, fixes the issue.

Bug: T337431
Change-Id: Ib1be294bae1ae057dfb9a4445a8e13ac72b333b9
2023-06-18 00:35:21 +02:00
jenkins-bot a2524dd966 Merge "Make some non-static providers static" 2023-06-16 19:57:17 +00:00
Matěj Suchánek 1bcc28891f Make some non-static providers static
Or at least one step forward to better isolation.
Some providers were replaced with individual test cases.

Bug: T337144
Change-Id: I5cd8c5e79993260f18c3a17c40b8501a4da3c17f
2023-06-16 20:54:33 +02:00
Amir Sarabadani 8b67de5bc1 blocked domains: Make sure users can't bypass the list by using uppercase
Added tests too

Bug: T337431
Change-Id: Ie3406d0b3c7d82ba44c11865e493375453555664
2023-06-16 01:22:48 +02:00
jenkins-bot 596a36866b Merge "Add missing AbuseFilterServices::getHookRunner()" 2023-06-15 18:06:28 +00:00
jenkins-bot 12d6d204ce Merge "BlockedDomains: Add logging in case of hit" 2023-06-15 16:33:37 +00:00