Commit graph

4857 commits

Author SHA1 Message Date
Daimona Eaytoy dd4b579695 Remove exclusions for Generic.Files.LineLength
Keep it only for filters definitions in ConsequencesTests.

Change-Id: I305c7f496a29b20a3ee1d34479d1e4cb9252060a
2019-02-23 10:12:07 +01:00
Thalia 540a557a59 Replace calls to deprecated Block::prevents
Where prevents is used as a setter, use the new setter methods;
where it is used to determine whether a block blocks the target
from editing their talk page, use appliesToUsertalk.

Block::prevents was deprecated and replaced by several other
methods in I0e131696419211.

Bug: T211578
Change-Id: I166cc6f64c0f895ff8c631d2655c1c3208131371
2019-02-22 19:29:02 +00:00
Translation updater bot de6560fb20 Localisation updates from https://translatewiki.net.
Change-Id: I3ccdfdc829e7c0c979795ce1a6005c1a5359e3ef
2019-02-21 22:20:16 +01:00
Translation updater bot ed4ecd5267 Localisation updates from https://translatewiki.net.
Change-Id: I3ea7e36650c5603813a7401bd44b1596c2e43580
2019-02-19 22:19:38 +01:00
Thiemo Kreuz 3993a7ea15 Replace @expectedException with $this->expectException()
The @expectedException annotation got deprecated in PHPUnit 7.5, and
removed in PHPUnit 8.0. This was done because the annotation does have
two disadvantages:
* The class name is encoded in string, where it is not easy to find for
  all IDEs and tools.
* it did not allow to say exactly *when* the exception is expected.

Change-Id: I85f0b5f44b2f400a121115d402b64827ea534c32
2019-02-19 10:58:16 +01:00
Translation updater bot 7a8b1ae811 Localisation updates from https://translatewiki.net.
Change-Id: Ic637db688e5ce40d3425ccb05e22a308a64fa74f
2019-02-18 22:22:38 +01:00
jenkins-bot 6745b9a994 Merge "Fix a typo in EmergencyDisable globals description" 2019-02-18 20:32:39 +00:00
Daimona Eaytoy 6e2b66f96d build: Update eslint-config-wikimedia to 0.10.1
And exclude no-global-selectors for now...

Change-Id: I0cea497ff8d8c749ea4f365c968428af01e85d18
2019-02-18 19:26:42 +01:00
MarcoAurelio 8f56c681c7 build: Update banana to v. 0.7.0
Change-Id: I3c1d52f3cf0e4a2d7ed5e288ab126b12ba56b938
2019-02-18 11:39:38 +00:00
Translation updater bot a2a8985255 Localisation updates from https://translatewiki.net.
Change-Id: Ib1afc13fa0b86967a4d0d0363140c47b7b1fcdaf
2019-02-17 22:13:34 +01:00
Daimona Eaytoy 0df04cd829 Fix a typo in EmergencyDisable globals description
And specify what we mean with "dangerous actions".

Change-Id: Ida5827978b257cfdf61786c7e19c11a1dc74c664
2019-02-16 14:43:29 +01:00
Matěj Suchánek 253668ef6e Fix confused statement about disabled variable
AbuseFilter::$disabledVars lists three disabled variables with their
message keys: old_text, old_html, minor_edit. It was confused that
old_text is mapped to ...-old-text but in fact, old_wikitext does and
there was a false statement in the logs that old_wikitext is no more
in use.

Change-Id: I61b2d252333ca634eae560d824f740f0f947b3d3
2019-02-15 11:59:30 +01:00
Translation updater bot c720a17a82 Localisation updates from https://translatewiki.net.
Change-Id: I4b1544794e86555f5817c50c254f38226d2e7a8a
2019-02-13 22:37:49 +01:00
Translation updater bot 85c7c8b46d Localisation updates from https://translatewiki.net.
Change-Id: Iacb03aa90a502e6e09aa5a0144add8513e3b1fba
2019-02-12 22:25:18 +01:00
Translation updater bot e9ef6df65c Localisation updates from https://translatewiki.net.
Change-Id: I124de656d8d0af7ffb37e2a2dd2257994aaeb84c
2019-02-11 22:27:45 +01:00
Translation updater bot a82d234077 Localisation updates from https://translatewiki.net.
Change-Id: I29a29dd980ca4090daaeeef67c5c92c034805415
2019-02-10 22:18:16 +01:00
Daimona Eaytoy 27f8b9ab34 Make the filter field on ViewHistory of "int" type
Following up I636b4e56f39282593c737ace1d6ff2d90900d997, enforce a basic
clientside validation and don't fill the field with the URL parameter if
it's not valid.

Change-Id: If4fd015dff64237375a0c4d3b9fbcefbd54dba3e
2019-02-10 12:11:52 +01:00
Daimona Eaytoy 90df3560b1 Replace deprecated cache-related functions
Some ObjectCache:: methods are soft deprecated since 1.28. Remove them
now, since the replacement is easy.

Change-Id: I713781d5e98238a1c194e97b5faae488a8ac190d
2019-02-09 16:01:57 +00:00
Daimona Eaytoy 6f4bfc9597 Fix shortcircuit for consecutive operations
Using break could halt parsing between operations, instead use continue
to parse all operations.

Bug: T214642
Change-Id: If67ddaffef280c2448c55ae536013758617bba68
2019-02-08 17:55:59 +00:00
Daimona Eaytoy e0b2b9ffd5 Allow filtering AbuseLog for filter group
This adds the capability to filter AbuseLog using filter groups, if
there's at list an extra group (like flow). Since abuse_filter_log
doesn't store info about filter groups, this needs query on
abuse_filter, and its result must then be intersected with explicitly
searched filters, if any.
The way I wrote it takes several lines and IFs, but is meant to be less
subject to regression in case something gets moved.

Change-Id: I747ba491d2b390562ce5f71396eed095116d8eaf
2019-02-08 10:51:11 +01:00
jenkins-bot 3229ce5236 Merge "In tests that create users, add 'user' to $this->tablesUsed" 2019-02-08 09:24:50 +00:00
Tim Starling c889c2990c In tests that create users, add 'user' to $this->tablesUsed
Change-Id: I7d2c6b304974d487e1b7727f594d0843ff080a7d
2019-02-08 16:40:17 +11:00
jenkins-bot 3a69c7b42e Merge "Update the throttle script" 2019-02-08 02:28:32 +00:00
jenkins-bot ed79a48f12 Merge "Localisation updates from https://translatewiki.net." 2019-02-07 21:29:53 +00:00
Translation updater bot 2759b57354 Localisation updates from https://translatewiki.net.
Change-Id: I81bd4ba2fc9f286bbe7fd32be974856f8271e8a3
2019-02-07 22:28:16 +01:00
jenkins-bot 981a447aaf Merge "Remove ancient permission checks" 2019-02-07 21:13:16 +00:00
Daimona Eaytoy 85ba973747 Move the "global-" prefix to a const
And add an utility function to use it to build full names.

Change-Id: Ib5fdeb75c1324f672b4ded39681f006fde34b4d1
2019-02-06 14:42:05 +01:00
Daimona Eaytoy 51120e51c5 Don't use wgLang and wgContLang
For wgLang, there's a Language object available in the proximity, so just pass it.
For wgContLang, use MediaWikiServices.

Change-Id: Ic492007f2d5eeb8048d0919a4b9b7dd98c15c350
2019-02-06 12:00:44 +01:00
libraryupgrader b744d18526 build: Updating mediawiki/mediawiki-codesniffer to 24.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgContLang

Change-Id: Ic167fc5e836c5437edc6b330e5d73f9913bc2859
2019-02-06 09:28:26 +00:00
Translation updater bot b713b94e4b Localisation updates from https://translatewiki.net.
Change-Id: I1f6d9338a0a5bd1008a6b21bb51fa0d4d7806f5a
2019-02-05 22:37:22 +01:00
Translation updater bot 45bed8b1d6 Localisation updates from https://translatewiki.net.
Change-Id: I99e5be5d537670305abc55d8e357a9eaf68af04f
2019-02-03 22:37:48 +01:00
jenkins-bot 775368a6fb Merge "Ensure the specified filter is valid in ViewHistory" 2019-01-31 21:52:00 +00:00
jenkins-bot 2ea783a385 Merge "Strike suppressed AbuseLog entries" 2019-01-31 21:51:58 +00:00
jenkins-bot 8d7361b590 Merge "Avoid PHP 7.3 Undeclared variable notice" 2019-01-31 21:51:56 +00:00
jenkins-bot 15a8340ee1 Merge "Reject empty warning and disallow messages when validating a filter" 2019-01-31 21:28:17 +00:00
Translation updater bot a21d673931 Localisation updates from https://translatewiki.net.
Change-Id: I2c8febe128861eb8f4891f766681f882e19e187a
2019-01-31 22:25:41 +01:00
Daimona Eaytoy 2a0246ddb5 Remove ancient permission checks
In both SpecialAbuseLog and ApiQueryAbuseLog, we use
Title::getUserPermissionsErrors to check if the user is allowed to
perform 'abusefilter-log' on the API page... However, this is a
completely redundant check (which is also pretty expensive and queries
the master): for the SpecialPage, we can specify the required right in
the constructor and use checkPermissions, and for the API we can simply use checkUserRightsAny.
If I'm not mistaken, there's no benefit in using
getUserPermissionsErrors.

Change-Id: I4c4dbace67b24cc1f45e50ab1c0d251522935513
2019-01-31 21:16:18 +00:00
Translation updater bot 6f1c907f9b Localisation updates from https://translatewiki.net.
Change-Id: I8e38531d5237e549f14fd205e0dd3f38c208cb39
2019-01-30 22:13:26 +01:00
Daimona Eaytoy 196a3ba7d5 Ensure the specified filter is valid in ViewHistory
We do not validate the param, and instead only check if it was
specified. In the specific case of ViewHistory, specifying as "filter"
something invalid for a title (e.g. with a + inside) will throw an
exception, seen in production.

Change-Id: I636b4e56f39282593c737ace1d6ff2d90900d997
2019-01-29 19:58:59 +01:00
Translation updater bot f4f43d1ab6 Localisation updates from https://translatewiki.net.
Change-Id: Ic8076c70de9dc333631d00bf637a9ba596d8e95e
2019-01-28 22:26:27 +01:00
Translation updater bot 4cf5ee3664 Localisation updates from https://translatewiki.net.
Change-Id: Ic2bfd77a2919724a4ab6fa7c51164594face4ced
2019-01-26 22:17:07 +01:00
Translation updater bot 37284ebc5d Localisation updates from https://translatewiki.net.
Change-Id: Ia96a91212cfa68375c26276b8d935a11567d251d
2019-01-25 22:28:11 +01:00
Daimona Eaytoy 8f9b27d856 Fix MWException from AbuseFilterView
The case default was recently added, but didn't take into account that
"false" is valid too. Noticed by chance just before the train rolled
out.

Change-Id: I67ca475fa16ea449820f8c735531c2cc1b0ec975
2019-01-24 21:48:50 +01:00
Daimona Eaytoy fe03de6e4f Add help links for throttle groups
Several people have reported throttle groups being hard to use, mostly
because the field doesn't have options with the usable groups. This is
because users can combine valid groups in many ways, and thus we don't
provide options. However, let's add an help link pointing to mw.org.

Change-Id: I982d67aa62a899916a26452aceb9646df8c31232
2019-01-24 12:58:41 +01:00
Daimona Eaytoy ba1b27d7f6 Optionally pass the filter ID to checkConditions for error reporting
Now that Parser errors are on logstash, I noticed a huge spike of errors
on Wikimedia Commons, about 35000 per hour. They seem to be due to 2
broken filters, but id doesn't say which ones.

Change-Id: I8510319c075520f9a893cd7d56f2e30679e249ba
2019-01-24 10:03:52 +01:00
Daimona Eaytoy 15019ed34d Update the throttle script
Another batch of changes for the throttle script, fixing bugs discovered
on its last run and improving performance.
For a list of fixes, see T209565#4903044.
After merging, we need backports (REL1_32 and wmf branches) and another
dry-run.

Bug: T209565
Change-Id: I530a22d57971f8b22892e43faae5d1c6fa1e14ed
2019-01-24 00:13:09 +01:00
Daimona Eaytoy 0f041e8282 Split AbuseFilterConsequencesTest tests in several methods
This makes the code easier to maintain and more flexible, plus adds
several tests. Some flaky tests are also improved.

Depends-On: I57ce67c5202c8574fcf1957999a6999fec264cb7
Change-Id: Ibb5322bca93b464e9014b53644c04f2bc1141e72
2019-01-23 21:26:25 +00:00
Daimona Eaytoy 26b783f062 Use data provider's array keys to specify test description
We just passed the description as a parameter, but it's much quicker to
use it as the key in the data provider: PHPUnit will automatically
display it in case of failure, so that we don't have to do that
manually (and still get messages like "failed with data set #7").

Depends-On: I8edcca17ecdcf71397cc9b0d101e8b13ac112047
Change-Id: I57ce67c5202c8574fcf1957999a6999fec264cb7
2019-01-23 21:26:17 +00:00
Daimona Eaytoy a207cf22f7 Unbreak tagging for createaccount actions
Tagging doesn't work for account creations, and probably never did. This
is because we used a wrong identifier for such actions. This patch fixes
the problem, although in the long term we should find a smarter way to
apply tags.
Also, clean AbuseFilter::$tagsToSet if the action will be prevented.

Depends-On: Ia8e38ba25d1989fe71714d2b76891c4587921466
Change-Id: I8edcca17ecdcf71397cc9b0d101e8b13ac112047
2019-01-23 21:25:47 +00:00
Daimona Eaytoy f3f8bd11b9 Re-execute checkAllFilters if the edit was stashed
This may solve several issues, see T176291#4105438 for further details.

Bug: T191430
Bug: T176291
Depends-On: Iebbdeac7898b35beea79aa3d0cdf9d0fb265d726
Change-Id: Ia8e38ba25d1989fe71714d2b76891c4587921466
2019-01-23 18:16:01 +00:00