Commit graph

5856 commits

Author SHA1 Message Date
Matěj Suchánek 0f062fca06 Move AbuseFilterView classes to separate namespace
Change-Id: I569281b13ec81d9f35038c7ef17a2d98f16f9b5c
2020-12-03 13:06:53 +01:00
Matěj Suchánek a1ba43f586 DI for AbuseFilterView and subclasses
Also add a test to ensure all views can be instantiated without problem.

Change-Id: Iedd7a5dca240efab1077fa51a3522c983b0ba4fa
2020-12-03 13:04:35 +01:00
jenkins-bot 53d1501f7e Merge "Update a few unspecific PHPDoc comments" 2020-12-03 10:54:00 +00:00
Thiemo Kreuz e17e1b7e01 Remove comments that literally repeat what the code says
Such comments don't add anything.

Change-Id: I7530d6693293fbdd06ca3ee077c6e783fd9a4ac1
2020-12-03 09:50:56 +01:00
Thiemo Kreuz 7047dba1f1 Update a few unspecific PHPDoc comments
Change-Id: I363d7f854c550654c5d4345f381e3731de6f2d3c
2020-12-03 09:50:09 +01:00
Translation updater bot ce3e8163ab Localisation updates from https://translatewiki.net.
Change-Id: Id94fb17266f156e6a107e055c10cd875209a2257
2020-12-03 08:31:30 +01:00
jenkins-bot 753a0dc482 Merge "Add ConsequencesLookup" 2020-12-02 15:49:33 +00:00
Translation updater bot e19905cd8c Localisation updates from https://translatewiki.net.
Change-Id: I67f103963663a3185d4275dda8ec72f1170dc77f
2020-12-02 08:31:29 +01:00
Translation updater bot 7c0bdecf44 Localisation updates from https://translatewiki.net.
Change-Id: I423a8af0d0acd50b8b2d336a1b7ecd31b78b767b
2020-12-01 08:22:16 +01:00
Translation updater bot 7d3aec3dcc Localisation updates from https://translatewiki.net.
Change-Id: I1116d64f0762cd58358a059b7b90a84a0e932965
2020-11-30 08:45:28 +01:00
DannyS712 ace8a613a4 Consequences cleanup, should be a no-op
Reduce use of User objects in favor of UserIdentity
Use `use` statements

Change-Id: Icdd1b8be2d1345a8dd48b8d5d3af8781c6658c7c
2020-11-30 01:12:25 +00:00
Reedy 95d8278b58 Clean up SchemaChangeHandler
* Move all SQL files into db_patches (or below)
** Remove db type from filename
* Remove a lot of duplicated code and simplify

Change-Id: If22f2a2c46a59ac24c89ce612c74d169f053ab26
2020-11-29 19:14:24 +00:00
Matěj Suchánek db87a68260 Remove unused variable and comment
Change-Id: I76f1d08aadda89dc9ba22eb35469c33cf9c86a33
2020-11-29 11:11:39 +01:00
Reedy f11bbe1c9b Use ::class rather than stringified class name
Change-Id: I5695f40627122b76d792a3a05c97c42d921a5536
2020-11-28 11:19:51 +00:00
DannyS712 66a43948f3 EditBoxBuilder: Minor cleanup for readability
Add use statements for OOUI classes,
clean up line breaks
Should be a no-op

Change-Id: I7e83a41a138557f99fadcef38e992bfc1bff7f7f
2020-11-27 23:33:11 +00:00
Daimona Eaytoy c957188866 Add ConsequencesLookup
The class is used to retrieve consequences from the Database.

Change-Id: I46b3925aac47554723649c076eff64707a2ea2e6
2020-11-27 16:43:44 +01:00
Matěj Suchánek d76affb1db Move ChangeTags stuff to separate namespace
Change-Id: I6d7bed0e62f001f82c00a3528cc0018388c9c70e
2020-11-27 15:13:34 +00:00
jenkins-bot a6e96ed915 Merge "Introduce ChangeTagValidator service" 2020-11-27 15:13:06 +00:00
Matěj Suchánek 872b6118f4 Introduce ChangeTagValidator service
Just moving code around. Without a unit test because DI
coverage of change tags in core isn't available yet.

Change-Id: Iac861e1e24dae13581b8d9173357a1d6c94be88a
2020-11-27 15:11:48 +01:00
Matěj Suchánek 1ad77dc9fb Introduce EditBoxBuilderFactory service and EditBoxBuilder
It makes sense to look at this and Iedd7a5dca24 together,
as this patch itself doesn't really fix anything.

Change-Id: Ifef5266b1803d1a96489789b08d9beed044d908f
2020-11-26 14:49:04 +01:00
Translation updater bot b33da096ba Localisation updates from https://translatewiki.net.
Change-Id: I4bbd2af76ed10ce5ffb874ce1a66ed1655294391
2020-11-26 08:27:18 +01:00
Daimona Eaytoy 904d9cddbb Represent Consequences with command objects
The consequence-taking logic is moved away from AbuseFilterRunner, to
dedicated classes. There's now one class per consequence, encapsulating
everything it needs to take the consequence.

Several interfaces allow customizing different types of consequences.
Every "special check" in AbuseFilter was generalized to use these
interfaces, rather than knowing how to handle each consequence.

Adding more consequences from other extensions will also be easier, and
it should happen via a hook (not a global), returning a class that
implements Consequence. The BCConsequence class was temporarily added
for legacy custom consequences.

A ConsequenceFactory class is added to instantiate consequences; this
would possibly benefit from using ObjectFactory, but it doesn't because
it would also reduce readability (although we might do that in the
future).

These classes are still not covered by unit tests, and this is left to
do for later. The new unit tests should mostly replace
AbuseFilterConsequencesTest. @covers tag were added to keep the status
quo (i.e. code that was considered covered while in AbuseFilterRunner
will still be considered covered), although we'll have to adjust them.

Change-Id: Ia1a9a8bbf55ddd875dfd5bbc55fcd612cff568ef
2020-11-25 17:35:36 +00:00
jenkins-bot 26d3abfab4 Merge "Introduce a service for saving filters" 2020-11-25 14:47:21 +00:00
Translation updater bot 12f4c51483 Localisation updates from https://translatewiki.net.
Change-Id: I6f89aafcacd8aa2179feab327d451b99b34fb71d
2020-11-25 08:33:15 +01:00
Translation updater bot fcae85fbf4 Localisation updates from https://translatewiki.net.
Change-Id: I44fe03712e442ad37f073c3e88e225c9546ff408
2020-11-24 08:38:27 +01:00
Translation updater bot a575efcc54 Localisation updates from https://translatewiki.net.
Change-Id: I8b7e000cd50ad1aa9635a2fb9760d1c91feee691
2020-11-23 08:38:01 +01:00
jenkins-bot 020ca95186 Merge "Create a base interface for watchers" 2020-11-22 03:08:46 +00:00
libraryupgrader b7a40e702c build: Updating npm dependencies
* grunt-stylelint: 0.15.0 → 0.16.0
* stylelint-config-wikimedia: 0.10.1 → 0.10.3

Change-Id: I8536a09b1833797ab7ed6b6316df2f9d0bb08f39
2020-11-21 19:38:27 +00:00
Daimona Eaytoy c368575af0 Create a base interface for watchers
This will ease adding new watchers, for instance to send Echo
notifications (see T179495 and T100892).

For now, this is just boilerplate, and converting EmergencyWatcher to
the new interface.

Change-Id: I18d62aba53471202b709cdb19033b1729c5c25b4
2020-11-20 23:34:20 +01:00
Daimona Eaytoy 9595bd9da5 Introduce a service for saving filters
Change-Id: I6b7d16ad7ea1124989ed67c74413979cfd0275c4
2020-11-20 22:33:21 +01:00
Translation updater bot 1ce325efc2 Localisation updates from https://translatewiki.net.
Change-Id: I2d07eabf8125c5689727df1c8d83fe237a7a6c2c
2020-11-20 09:17:19 +01:00
jenkins-bot ca54f0b2e3 Merge "EmergencyWatcher: update data for all filters at the same time" 2020-11-20 07:04:58 +00:00
jenkins-bot a16cca0ecb Merge "Adjust code coverage" 2020-11-20 06:48:12 +00:00
jenkins-bot b6b90c07cb Merge "Remove AbuseFilter::getFilter" 2020-11-20 06:46:01 +00:00
Daimona Eaytoy cdbe9260c7 EmergencyWatcher: update data for all filters at the same time
This will avoid unneeded queries, in theory. In practice, it will
almost never happen to have more than one filter to throttle.

Change-Id: I5b8df51215463ce4464f6a2d0390f58612a5a213
2020-11-20 06:41:56 +00:00
Daimona Eaytoy 3f7fff56e8 Adjust code coverage
-Exclude methods and classes that cannot be meaningfully covered
-Add a simple test for AbuseFilterServices
-Exclude ServiceWiring because there's no way to tell PHPUnit it's
covered

Change-Id: I4c67b0d3fea68c7a3b3cbe01b5608f87e1b492db
2020-11-19 22:40:26 +00:00
libraryupgrader e5c9bf119d build: Updating mediawiki/mediawiki-phan-config to 0.10.4
Change-Id: I8309c5ed36536f5304e1429c4c24553b456ddc8e
2020-11-19 20:33:25 +00:00
jenkins-bot 6375b51b9b Merge "Optimize EmergencyWatcher" 2020-11-19 18:26:19 +00:00
Matěj Suchánek 83c2ccb1b3 Optimize EmergencyWatcher
Avoid queries for profiler data when the filter hasn't
been changed recently.

Change-Id: I691d3922436e80264403f9c5b8b822be729e1d94
2020-11-19 18:20:16 +01:00
Daimona Eaytoy a71ea3aa38 Remove AbuseFilter::getFilter
Needs the patch in ContentTranslation first.

Depends-On: I0b74db70ad4e9768e4dcb84b9decb9c737e942e5
Change-Id: Id186ea99fcf69aa4348e404677ce5da998d83170
2020-11-19 15:11:32 +00:00
Daimona Eaytoy eab1f13696 Make VariableGeneratorTest an integration test
It's actually using MediaWikiServices.

Change-Id: I6ec1b4723ff3f187eccf44a8b4ac286572fdfbbe
2020-11-19 13:55:16 +01:00
Translation updater bot 498e8ce9fa Localisation updates from https://translatewiki.net.
Change-Id: I005ea915a4b569ad204dd75fce60a597564c83c6
2020-11-19 09:09:40 +01:00
jenkins-bot 97019239bc Merge "FilterProfiler: allow searching for slow global filters" 2020-11-18 23:43:20 +00:00
jenkins-bot 31f4607790 Merge "Handle DUNDEFINED in array offsets" 2020-11-18 23:30:58 +00:00
DannyS712 09c3a9df05 FilterProfiler: allow searching for slow global filters
The slow filter hits are logged for the target wiki, but
the fix would be on meta, so make it possible to filter
for those

Change-Id: I6e02866479e77d707f4fa951ec909c325b944158
2020-11-18 23:20:30 +00:00
jenkins-bot 8f47259285 Merge "Add an interface for exporting/importing filters" 2020-11-18 23:13:53 +00:00
Daimona Eaytoy 3fc30021d2 Handle DUNDEFINED in array offsets
The behaviour is:
- When assigning to an undefined offset, delete the whole array and turn
it into another DUNDEFINED
- When retrieving from an undefined offset, just return DUNDEFINED.

Bug: T237214
Change-Id: I621ee7a16c90bb86a57be04e7ce0a748ecdbfcc7
2020-11-18 14:20:49 -08:00
Daimona Eaytoy 210cf29658 Add an interface for exporting/importing filters
The main benefit of having a dedicated interface is that we can easily
change the output format. So we're now using a custom array without
references to the DB schema, thus making the import/export process
completely independent from the schema.

Change-Id: I4c0de41d914baf1e9a0e588bd31f95b3524a424b
2020-11-18 22:06:09 +00:00
Daimona Eaytoy 7a24c94d6e Evaluate left-to-right when adding elements to array
Bug: T237090
Change-Id: I5fb72dec0ea12240b6563e66b69e399edc4c72d6
2020-11-18 21:25:45 +00:00
Daimona Eaytoy b5ae7360bc AbuseLog: Use a radio button not checkbox for suppressing entries
Add a radio to select between "hide" and "show" instead of a single,
cryptic checkbox which doesn't really explain what it does.
Also wrap the list in a form which will later be used to mass-delete
entries.

Depends-On: I1bb45e47c3b42c01388b99778ce833e4e44419e1
Change-Id: Ie2d019fad5af7c626d722dc348f40eb0db21e527
2020-11-18 20:57:39 +00:00