Commit graph

5442 commits

Author SHA1 Message Date
Ammar Abdulhamid 323fe4666c Draw suppression reason from Revdelete-reason-dropdown-suppress
Bug: T245990
Change-Id: Ic5adcf4e6693cb5b4c849156e54d97cf35b70dee
2020-02-24 14:06:43 +01:00
Translation updater bot 544528a297 Localisation updates from https://translatewiki.net.
Change-Id: I9684fdd729db8f275db305ffdcd0274101cf2c69
2020-02-24 09:01:13 +01:00
jenkins-bot 84b3a590a3 Merge "tests: Use ChangeTags::getTags instead of hardcoded queries" 2020-02-23 10:35:39 +00:00
Daimona Eaytoy aa15267c79 Add string typehint to $summary in onParserOutputStashForEdit
Bug: T245928
Depends-On: I8fa287f335e90a59ac18365e7401a5cf703130a3
Change-Id: Ia075e4bdf3a3f011a181c8026ff1cdb8e186f096
2020-02-22 19:27:05 +00:00
Ed Sanders d86b74d3de eslint: Add /mediawiki rules
Change-Id: I1853e273fad3308349c79d188bc30de98fe116c4
2020-02-22 15:59:28 +00:00
Daimona Eaytoy bef72c7dc3 tests: Use ChangeTags::getTags instead of hardcoded queries
This is the "clean alternative" mentioned in the method comment!

Change-Id: Ieb87a1f512c930c2e33e721ba792986bc198e414
2020-02-22 13:54:23 +00:00
Translation updater bot 12c1c424c0 Localisation updates from https://translatewiki.net.
Change-Id: I0b3fdbb8abbb0d1e4c7655bfd610d838ac29d0c9
2020-02-21 09:38:01 +01:00
libraryupgrader b97818867d build: Updating npm dependencies
* grunt-stylelint: 0.13.0 → 0.14.0
* stylelint-config-wikimedia: 0.8.0 → 0.9.0

Change-Id: I3113038f3f57b63d2f7c1cf2e7b41946d1e52bdd
2020-02-20 17:23:00 +00:00
Translation updater bot 6df61ff3a9 Localisation updates from https://translatewiki.net.
Change-Id: I084c8f91a9bb16e1aa1f8b7128fcad55fd493a5f
2020-02-19 08:22:06 +01:00
Translation updater bot 72765c8a3f Localisation updates from https://translatewiki.net.
Change-Id: I91bb7a73642dadc48d4b300850fe7e871d9f711e
2020-02-18 08:24:33 +01:00
Translation updater bot e8344ac9d3 Localisation updates from https://translatewiki.net.
Change-Id: I05eeb3b3424c52271bbf27e23cfa4d5f6268defb
2020-02-17 08:44:34 +01:00
Translation updater bot e61b67b7f6 Localisation updates from https://translatewiki.net.
Change-Id: I0409d29695866c04f4d0bdfbbd69b5390eda9979
2020-02-14 08:24:58 +01:00
Translation updater bot 5889f6f187 Localisation updates from https://translatewiki.net.
Change-Id: I2c65f2a8a8b0ed2c70c767782834d9868b948b75
2020-02-13 08:53:58 +01:00
Translation updater bot 7722bb9c00 Localisation updates from https://translatewiki.net.
Change-Id: Ia35fcb8ce5e5ddacc5a93fdc53c264b495fc4556
2020-02-12 08:21:14 +01:00
Translation updater bot 7cd23c468a Localisation updates from https://translatewiki.net.
Change-Id: I0bfbaf1dd962f8ad723ce24d3333fbe40013bc45
2020-02-11 08:18:36 +01:00
jenkins-bot 76a1be97a4 Merge "Add site name and language variables" 2020-02-10 19:06:01 +00:00
jenkins-bot b6ca1402d0 Merge "Rename addStaticVars and related hook" 2020-02-10 19:03:34 +00:00
jenkins-bot 89e8797ca1 Merge "Validate imported data" 2020-02-10 19:00:48 +00:00
Daimona Eaytoy 0d2cab0deb Validate imported data
At the moment there's no validation for import data, so it's totally
possible to insert rubbish in the field, and the code will produce other
rubbish. For instance, it's not so uncommon to see lots of PHP notices
on logstash for ViewEdit code trying to access members of the imported
data as if it were an object.

Change-Id: If9d783f0f9242d3d1bc297572471e62f51ee0e40
2020-02-10 18:41:36 +00:00
jenkins-bot d89d919f76 Merge "Fix PHPNotice caused by missing row fields" 2020-02-10 18:14:27 +00:00
Daimona Eaytoy 9d8e004972 fixOldLogEntries: don't pass empty lists to Database::makeList
This made the script fail at a later stage, although it didn't cause any
harm.

Bug: T228655
Change-Id: I0c983cb4b5a262e81372fbd23f893ffb176eb9b5
2020-02-10 17:24:18 +01:00
Translation updater bot 83211b7e3a Localisation updates from https://translatewiki.net.
Change-Id: I36e67469f9a5991eb3f3e879feeb7d260e4d4cd3
2020-02-10 08:31:31 +01:00
Daimona Eaytoy 57415d8a31 Fix PHPNotice caused by missing row fields
Follow-up Ie9aae938cca06e38a7a834a3f74f3e8735ab01ee.

Some fields are actually necessary when the filter isn't saved. This
would cause PHP notices when showing the editor again.

Change-Id: I2b9e0f04b3e8ad4eea8e334e16ee422bb40f0eb5
2020-02-09 13:36:36 +00:00
Daimona Eaytoy d9ae71f578 Add site name and language variables
In T43172 it was told that adding the site name could increase the risk of
attracting more spam, but I don't see how this variable could cause that.

Bug: T240948
Bug: T97933
Change-Id: I1d2aeabaf008ac06798b8d7e4af7d61ae1702776
2020-02-09 14:32:02 +01:00
Daimona Eaytoy 661a77f0eb Rename addStaticVars and related hook
This code was introduced with Iba59fe8d190dd338ecc8cfd682205bce33c9738b
and is unused since then. The name should highlight that those variables are not
supposed to be "static", i.e. immutable. Examples are: timestamp, spam
blacklist, site name, site language. These are not immutable, but rather
"generic", and they're known even without an ongoing action.

Also add an RC row param and update docs.

Change-Id: I402f04585e9154059fc413e527e39dcb8e6b3d7c
2020-02-09 14:29:08 +01:00
jenkins-bot 77ab71e3cf Merge "fixOldLogEntries: Add missing pairs of parentheses" 2020-02-08 17:33:48 +00:00
jenkins-bot 391bbee53c Merge "Fix some edge cases in ViewEdit" 2020-02-08 16:36:19 +00:00
jenkins-bot c0b58d7699 Merge "Factor out variables-related methods" 2020-02-08 14:42:13 +00:00
Daimona Eaytoy 0834f37e42 Fix some edge cases in ViewEdit
Follow-up Iabd0ae5b18571f8cad44ef2d86bcf2519e7f95ba.

This patch:
 - Moves some save-related code to a separate method
 - Reduces conditionals nesting
 - Fixes an edge case where the content of the form would be
 wiped in case the token didn't match.
 - Adds another (basic) selenium test
 - Standardizes return types
 - Moves data load outside of buildFilterEditor

Change-Id: I89444b59f04c495c9ab59244151c8ed5d38cf0fe
2020-02-08 15:35:46 +01:00
Daimona Eaytoy d79970ef38 fixOldLogEntries: Add missing pairs of parentheses
Bug: T228655
Change-Id: I3bdb7e9efc8e12b055ba37440f1197fe6ed3b69d
2020-02-08 15:18:52 +01:00
jenkins-bot 430058f2c0 Merge "Avoid keeping superfluous row properties" 2020-02-07 21:26:34 +00:00
jenkins-bot 02cd866f53 Merge "Refactor data load in ViewEdit" 2020-02-07 21:26:32 +00:00
jenkins-bot 44998acf4d Merge "Move variable generators to new classes" 2020-02-07 20:41:25 +00:00
jenkins-bot bd9a0758a1 Merge "Fix more inconsistencies in scripts for logging entries" 2020-02-07 20:32:45 +00:00
Daimona Eaytoy 3f83e57ad7 Factor out variables-related methods
This is another step needed to reduce the size of the gigantic
AbuseFilter and AbuseFilterHooks classes. It also makes many methods
non-static, for more testability.

Note, this layout is still not final. We should somehow merge the
functionality of VariableGenerator and AFComputedVariable, for which
I already have plans.

Change-Id: I366d598b69ad866496b7cb0059e0835c02e54041
2020-02-07 20:27:26 +00:00
Daimona Eaytoy 1686042a91 Move variable generators to new classes
RunVariableGenerator is for generating variables based on the current
action;
RowVariableGenerator is for RC entries;
VariableGenerator is the generic one.

This patch only moves the methods to the new classes, to keep the diff
easier to read, and facilitate conflict resolution. These classes will
then be revamped in I366d598b69ad866496b7cb0059e0835c02e54041.

Note that these classes are now namespaced.

One method, AbuseFilter::getEditVars, was renamed to
AbuseFilterVariableGenerator::generateEditVars, because it would
otherwise conflict with an incompatible method in RunVariableGenerator.

Change-Id: Iff412e5492873d4fae55402939a51609e64d55a8
2020-02-07 19:44:31 +00:00
Daimona Eaytoy 6b7be78534 Use RCDatabaseLogEntry as wrapper in get*VarsFromRCRow
This provides various shortcuts for user, target, comment, etc.,
avoiding direct access to the row, and thus a dependency on the
schema.

Change-Id: I250f94e0ac6cade33441a31ae8a27093a4d937a0
2020-02-07 19:19:10 +00:00
Daimona Eaytoy 472d1221bd tests: Increase and rebalance code coverage
Also fix a couple of broken tests in Consequences:
 - For createaccount, $user->addToDatabase must be called before
   testForAccountCreation, or it will throw a CannotCreateActorException.
 - In testThrottleLimit, also set wgAbuseFilterEmergencyDisableThreshold
   to avoid relying on the local config.

Bug: T201193
Change-Id: If1a50b0a729e4d554485f2e2225d5877510966b6
2020-02-07 18:32:17 +00:00
Translation updater bot df318a8d33 Localisation updates from https://translatewiki.net.
Change-Id: Ic72a381c829f49d6175d964a76522aab50d9b0a6
2020-02-06 08:18:34 +01:00
Translation updater bot cf9d4f54f9 Localisation updates from https://translatewiki.net.
Change-Id: I0ab18a55991d9e5eeba5a7c703ed571ed14dd60c
2020-02-05 08:18:27 +01:00
Translation updater bot 5dbd92df73 Localisation updates from https://translatewiki.net.
Change-Id: Ifcd188567652155e61ab8a4d52460ab26009228c
2020-02-04 08:32:45 +01:00
Daimona Eaytoy 54512dd124 Fix more inconsistencies in scripts for logging entries
This includes a bunch of improvements.

In addMissingLoggingEntries:
 - Don't access mDescription directly
 - Build a ManualLogEntry instead of stuffing data in the DB

In fixOldLogEntries:
 - Fix entries having log_page = NULL instead of 0 due to
 addMissingLoggingEntries skipping that field
 - Fix entries having log_deleted = afh_deleted caused by
 addMissingLoggingEntries -- those are completely unrelated
 - Add batching, controlled by log_id, with default size of 500
 - Use Database::strreplace to have a single UPDATE per batch, instead
 of one per row.
 - In dry run, when checking rows to update, exclude the rows that
 would've been deleted in the first phase.

Bug: T228655
Change-Id: I885dba3f0772633d843b8a55e483047b169dc9ba
2020-02-03 15:30:07 +00:00
Translation updater bot 39b07ff63a Localisation updates from https://translatewiki.net.
Change-Id: Ia204eb5179a8eb90d53a7b924be9086a3461d216
2020-02-03 08:25:16 +01:00
Translation updater bot 8109bafff1 Localisation updates from https://translatewiki.net.
Change-Id: Ia2dc67115aab1b3e5204a607d6028d49b882c845
2020-01-31 09:51:38 +01:00
libraryupgrader a14ec744f7 build: Updating composer dependencies
* mediawiki/minus-x: 0.3.2 → 1.0.0
* mediawiki/mediawiki-phan-config: 0.9.0 → 0.9.1

Change-Id: I119f4d56cce674302f34e938e598e6cc6bf28dc0
2020-01-28 17:51:38 +00:00
Translation updater bot b497bcf337 Localisation updates from https://translatewiki.net.
Change-Id: Ia2c6fcc94217e79aa4c10f5fa79b2b7cea434c38
2020-01-28 08:23:53 +01:00
libraryupgrader b91530a128 build: Updating jakub-onderka/php-console-highlighter to 0.4.0
Change-Id: I9d1eaece84340db9576b63a1340a7a3cffbc5b77
2020-01-28 02:27:42 +00:00
Ammar Abdulhamid 641aeebbcf Replace deprecated IP class with IPUtils
Bug: T242556
Change-Id: If8e9034885726b673d1500fa8b538b5302e66165
2020-01-24 18:27:26 +01:00
Translation updater bot a6098bb465 Localisation updates from https://translatewiki.net.
Change-Id: I24d6a752789355597e19b0feeba04e85a6072bf1
2020-01-24 08:14:16 +01:00
Daimona Eaytoy 102789f62a Avoid keeping superfluous row properties
Most of them are overwritten either in ViewEdit::loadRequest or
AbuseFilter::saveFilter. af_hit_count and af_throttled are actually
relevant for the old version, so list them explicitly. And also add
default af_group and af_global, which are later read, for import action.

Depends-On: Iabd0ae5b18571f8cad44ef2d86bcf2519e7f95ba
Change-Id: Ie9aae938cca06e38a7a834a3f74f3e8735ab01ee
2020-01-23 12:50:03 +00:00