Commit graph

7712 commits

Author SHA1 Message Date
Translation updater bot 31d58fb5cb Localisation updates from https://translatewiki.net.
Change-Id: I9c305d3a9daaf0898ffd0b51cd154376bda25f2c
2024-04-17 09:27:21 +02:00
Timo Tijhof 4743f9d267 tests: Widen @covers tags in phpunit tests
Follows-up I5a5420df13893386.

> We lose useful coverage and waste valuable time on keeping tags
> accurate through refactors (or worse, forget to do so).
>
> Tracking tiny per-method details wastes time in realizing (and
> fixing) when people inevitably don't keep them in sync, and time
> lost in finding uncovered code to write tests to realize it was
> already covered but "not yet claimed".
>
> Given all used methods are de-facto and liberally claimed, and
> that we keep the coverage limited to the subject class, this
> maintains the spirit and intent. PHPUnit offers a more precise
> tool when you need it (i.e. when testing legacy monster classes),
> but for well-written code, the class-wide tag suffices.

Ref https://gerrit.wikimedia.org/r/q/owner:Krinkle+is:merged+message:Widen

Change-Id: If7304d8b5b43ab8a051fbcecced331a787bab960
2024-04-17 01:44:40 +01:00
Umherirrender 0a601acd6f Replace SELECT * with real list of used fields
It is a common pattern to avoid SELECT * and use the fields used by
the application to avoid loading to much data into memory and maybe use
performance benefits when fields are covered by index.

Change-Id: I08a399f1b6a66442317b151be5386c9d2485f1fb
2024-04-16 21:14:10 +02:00
Translation updater bot d654cdf804 Localisation updates from https://translatewiki.net.
Change-Id: I75d4c6fd3e5db58956d44327313bfd9e943214d6
2024-04-16 09:26:41 +02:00
Umherirrender 3691d773d3 Migrate to IDatabase::newUpdateQueryBuilder
Change-Id: I0b3fd864e5227068114ca7aa9e98361046f393c1
2024-04-15 23:07:44 +02:00
jenkins-bot f17f231a70 Merge "tests: Widen @covers tags in SpecsTest" 2024-04-15 16:56:57 +00:00
jenkins-bot 1807a07755 Merge "Remove small pieces of unused code from SpecsFormatterTest" 2024-04-15 16:02:31 +00:00
Timo Tijhof 56c0f6313e tests: Widen @covers tags in SpecsTest
> We lose useful coverage and waste valuable time on keeping tags
> accurate through refactors (or worse, forget to do so).
>
> Tracking tiny per-method details wastes time in realizing (and
> fixing) when people inevitably don't keep them in sync, and time
> lost in finding uncovered code to write tests to realize it was
> already covered but "not yet claimed".
>
> Given all used methods are de-facto and liberally claimed, and
> that we keep the coverage limited to the subject class, this
> maintains the spirit and intent. PHPUnit offers a more precise
> tool when you need it (i.e. when testing legacy monster classes),
> but for well-written code, the class-wide tag suffices.

Ref https://gerrit.wikimedia.org/r/q/owner:Krinkle+is:merged+message:Widen

Change-Id: I5a5420df1389338644a099ebfd072063653e6849
2024-04-15 16:36:36 +01:00
Translation updater bot 9d66ffb4ba Localisation updates from https://translatewiki.net.
Change-Id: I4213f0519b69b98ea79d73924e6bd342274debf3
2024-04-15 09:27:06 +02:00
jenkins-bot be54bef5d8 Merge "Clean up injection of DatabaseBlockStore" 2024-04-15 04:01:23 +00:00
jenkins-bot e673b1e585 Merge "BlockedDomainFilter: Always return Status from filter()" 2024-04-14 21:15:31 +00:00
jenkins-bot 5c61521cbb Merge "Migrate to IDatabase::newInsertQueryBuilder/newDeleteQueryBuilder" 2024-04-14 18:28:13 +00:00
Bartosz Dziewoński c458651370 Fix Status combining MessageSpecifier and parameters array
Constructing a Status like this does not make sense (and I want
to deprecate it in I0675e557bb93a1c990fa923c50b9f6ee8a9836c8),
because the parameters are ignored by most Status methods:

  $error = Message::newFromSpecifier( 'abusefilter-blocked-domains-attempted' );
  $status = Status::newFatal( $error, 'blockeddomain', 'blockeddomain' );

But it worked here, because FilteredActionsHandler::getApiStatus()
used a deprecated method that allowed inspecting them.

I feel like this code in BlockedDomainFilter has been added to make
the tests pass without thinking about what it actually does, which is
to output a bunch of useless incorrect data in API errors.

I'm not sure if we can remove that now without breaking API
compatibility, so add the useless data in FilteredActionsHandler
instead, closer to where it's output.

Change-Id: Ic12241bd3029bc1b0e7a0023689a2be35ccd30a8
2024-04-14 00:02:32 +00:00
Bartosz Dziewoński a5e0851dc0 BlockedDomainFilter: Always return Status from filter()
From Status class documentation:
> The recommended pattern for Status objects is to return a Status object
> unconditionally, i.e. both on success and on failure -- so that the
> developer of the calling code is reminded that the function can fail, and
> so that a lack of error-handling will be explicit.

Change-Id: Ie6a55e297a35374fbdef880dd40e65f5cd00b6bf
2024-04-13 01:05:01 +02:00
jenkins-bot bd2e33e3e5 Merge "Replace array_merge in tests with the [ ... ] syntax" 2024-04-12 09:32:57 +00:00
jenkins-bot bce13e31a7 Merge "Fix wrong getMockMessage() calls in tests" 2024-04-12 09:32:55 +00:00
jenkins-bot 098ff0b880 Merge "Use modern str_starts_with() and [ ... ] syntax" 2024-04-12 09:32:53 +00:00
Matěj Suchánek ad2600b6c0 Clean up injection of DatabaseBlockStore
The static method has already been migrated.

Also rewrite the test cases to avoid non-static provider (T337144).

Change-Id: Ibf98539f442e1ba8a9e9eb510784d40778123f17
2024-04-12 11:01:00 +02:00
thiemowmde 07a04b74d7 Remove small pieces of unused code from SpecsFormatterTest
Change-Id: Ifbef4f3c73b5744dd1ead9df1743631753bd306a
2024-04-12 08:37:00 +00:00
Translation updater bot 7560067181 Localisation updates from https://translatewiki.net.
Change-Id: Ie11f736705eb077feba1f13878600b87ef186b47
2024-04-12 09:41:03 +02:00
thiemowmde 0b0fab9d1b Fix wrong getMockMessage() calls in tests
MessageLocalizer::msg( $key, ...$params ) accepts a variable number
of arguments, but getMockMessage does not. Passing only the first
argument as a string to getMockMessage is not supported.

Required for I86ff2d6.

Change-Id: I30ab799ceab36b80c330d1233f3009814d7f6c98
2024-04-11 15:32:17 +00:00
thiemowmde c9f8343173 Use modern str_starts_with() and [ ... ] syntax
Change-Id: I2f2182e1e0850d7ebf832b7b8e0630ce56aad88b
2024-04-11 14:07:43 +02:00
thiemowmde 7f214ec15c Replace array_merge in tests with the [ ... ] syntax
It does the same and is well supported in the PHP versions we
currently use, at least when the arrays contain integer keys.

Change-Id: Id038142621dab47bfc03db48ce676ed0b2cdc28b
2024-04-11 14:01:25 +02:00
jenkins-bot 09db8e6bb9 Merge "Add new variable for last edit time" 2024-04-11 11:57:33 +00:00
jenkins-bot 6bdde6553b Merge "Fix new Phan errors" 2024-04-11 11:34:03 +00:00
Translation updater bot d51d4a014d Localisation updates from https://translatewiki.net.
Change-Id: I15d4293c9d3e0c49e57a34333505214b979570d0
2024-04-11 09:19:58 +02:00
Matěj Suchánek 68ff668543 Add new variable for last edit time
Bug: T269769
Change-Id: Ia41ecc2f8e6921ef3d5a16fec58202d584ad0727
2024-04-10 23:12:45 +00:00
Bartosz Dziewoński ac777ee88a Fix new Phan errors
MediaWiki core change Icb8822def9ce56f42ff52a8e469bb08d61d576c6
improved the type hints for OutputPage::addWikiMsg(), resulting in
two new errors:

* AbuseFilterViewEdit.php: False positive, update suppression
  to include new error code.

* SpecialAbuseLog.php: Genuine bug, the return value of
  Status::getErrors() can't be used directly as a message key.
  I have another change pending that introduces a nicer way
  to do this: Ibc4ce11594cf36ce7b2495d2636ee080d3443b04,
  but in the meantime, make do with the available getters.

Change-Id: Iee0e87496e27a5261adccb977361b3ccf4c9ee2c
2024-04-10 23:12:28 +00:00
Translation updater bot 5142ff49c4 Localisation updates from https://translatewiki.net.
Change-Id: Iff8a27e64cefb11a9d9b37d8face7ae8413fff2c
2024-04-10 09:20:07 +02:00
Translation updater bot 1aaec637b5 Localisation updates from https://translatewiki.net.
Change-Id: I5d2130b2405eb1456f1a672ff6c8fa74dbb158a1
2024-04-08 09:24:33 +02:00
Translation updater bot 3ee87ba924 Localisation updates from https://translatewiki.net.
Change-Id: I995884938d6c2348e73b74e1b94764bbb0736a93
2024-04-05 09:37:01 +02:00
Translation updater bot 47c5dfe417 Localisation updates from https://translatewiki.net.
Change-Id: Iac890b6e97650634baeb622474ebcb12b7160662
2024-04-04 09:36:19 +02:00
Translation updater bot 0574f7a75c Localisation updates from https://translatewiki.net.
Change-Id: Ibbeb6a21cc275f897e9c92ea40a685b95ef10a8f
2024-04-03 09:22:45 +02:00
Umherirrender 2df93d2b0f Migrate to IDatabase::newInsertQueryBuilder/newDeleteQueryBuilder
InsertQueryBuilder does not ignore insert of no rows,
adding some conditions to avoid calling the query builder

Change-Id: I1752b90cc3a7ec3a7f9ee32a1873bf8c82b6e02e
2024-04-02 21:15:40 +02:00
Translation updater bot c689f4c61b Localisation updates from https://translatewiki.net.
Change-Id: Ib3bbc54e6056087f2f50c782f0eed9a04ec1f59b
2024-04-02 09:20:47 +02:00
Translation updater bot b7e4f17ff5 Localisation updates from https://translatewiki.net.
Change-Id: I84f42d4af5221d5e585176208ae0ecef9c5ff390
2024-04-01 09:22:01 +02:00
libraryupgrader 29bc5928a9 build: Updating dependencies
composer:
* php-parallel-lint/php-parallel-lint: 1.3.2 → 1.4.0

npm:
* eslint-config-wikimedia: 0.26.0 → 0.27.0

Change-Id: I49f3e6f619c6f3ba13f5167bc1c946c7fe601d27
2024-03-30 13:14:05 +00:00
jenkins-bot 5ece43538f Merge "logging: Inject services into AbuseLogHitFormatter" 2024-03-30 01:51:25 +00:00
Timo Tijhof 473b4b1ec4 tests: Remove redundant wgMainCacheType=hash
Introduced in 2019 with 4c8dac4dc6. Redundant since 2020 with
commit c6c62e2c8f in MediaWiki core.

Bug: T139216
Change-Id: I51e9fc3899cf5505917d7899a395350dd86f5c0b
2024-03-29 15:37:58 -07:00
Umherirrender 13cf3eb20a logging: Inject services into AbuseLogHitFormatter
Bug: T356468
Change-Id: I42023b7dcdaf80aeb3367d82068e1de47f8ae424
2024-03-29 21:53:34 +01:00
jenkins-bot ddf9864d21 Merge "Replace deprecated ChangeTags method calls with ChangeTagStore" 2024-03-29 18:58:32 +00:00
Matěj Suchánek 4c2b09fa4e Replace deprecated ChangeTags method calls with ChangeTagStore
Bug: T360664
Change-Id: Icd7c38be9a8b54c29da7d33dfa9691e1c94feeb1
2024-03-29 11:08:41 +01:00
Translation updater bot 09d6a0cc79 Localisation updates from https://translatewiki.net.
Change-Id: Ic78b451772a8be20c96416427987821e00355f8f
2024-03-28 08:30:47 +01:00
Translation updater bot b5e0cd9de8 Localisation updates from https://translatewiki.net.
Change-Id: I74652c6db936dedd25e03c5837cb818734efe553
2024-03-27 08:16:45 +01:00
jenkins-bot 8727b7a7b9 Merge "Reorder messages that describe operators" 2024-03-26 17:18:10 +00:00
Amir E. Aharoni f6eca362e5 Reorder messages that describe operators
Make the order of the messages that describe
operators and functions in the en.json file
identical to their order in
KeywordManager::BUILDER_VALUES, which is also
their order in the actual UI of the filter editor.

This only reorders the mesages in the en.json file.
It's not supposed to change anything in
the end users' experience, but it will change
the order in which translators on translatewiki.net
see them.

This is a cleanup step towards removing
the explicit operators from the messages,
as suggested in T360909, and this reordering
is hopefully useful even without that change,
for general consistency.

Comments about particular messages:
* abusefilter-edit-builder-vars-timestamp-expanded
  is moved to the very end because, despite its key,
  it's not actually used in the filter builder.
* old-text, old-html, and minor-edit are moved towards
  the end because they are outdated. They are listed
  separately from BUILDER_VALUES and they are not used
  in the filter builder UI, but they are used in the logs
  of previous actions. This patch adds a code comment
  for the benefit of developers who touch that code
  in the future.

Bug: T360909
Change-Id: I86ecdca5a6173b9068d5e968e69c57c74a379888
2024-03-26 11:22:46 -04:00
Translation updater bot 6a16b77475 Localisation updates from https://translatewiki.net.
Change-Id: Ic76660cafbdeec8e76b55e93e2f0b7f80e2fd627
2024-03-26 08:18:19 +01:00
jenkins-bot 430b7f81ad Merge "FilterLookup: Stop using DBAccessObjectUtils::getDBOptions()" 2024-03-25 18:20:52 +00:00
Translation updater bot bea46722c7 Localisation updates from https://translatewiki.net.
Change-Id: Id16b4e1173cee09287dbbe2bf160952f873b9cc9
2024-03-25 08:34:36 +01:00
Translation updater bot 082a6a63dd Localisation updates from https://translatewiki.net.
Change-Id: I3496e9f444837b833242df522e216fe912d1be73
2024-03-22 08:43:00 +01:00