Commit graph

4596 commits

Author SHA1 Message Date
Aaron Schulz d4cb5f2275 Make getFilter() public for extension hooks
Bug: T139657
Change-Id: Id1c196e8ead6cd280129e7e3aa6741edcf4fa551
2016-07-15 14:55:13 -07:00
Aaron Schulz 8da016fe26 Ignore _VIEWS in getStashKey()
Change-Id: I9830fa237073f57285435c65fe4838d23ab1d024
2016-07-15 07:03:05 -07:00
Translation updater bot d94669347f Localisation updates from https://translatewiki.net.
Change-Id: Ibe817692322b2df6001caecec7c9c0905265d60f
2016-07-14 23:24:13 +02:00
Translation updater bot 9e06345f19 Localisation updates from https://translatewiki.net.
Change-Id: I2b62873ddf5b87eb635941bdfc066244a672f60b
2016-07-13 22:33:55 +02:00
Translation updater bot 2c29152b90 Localisation updates from https://translatewiki.net.
Change-Id: Ib61121dc46d15311feafb92ddb429a29472d3079
2016-07-12 22:45:29 +02:00
Translation updater bot 2bb60ea4b5 Localisation updates from https://translatewiki.net.
Change-Id: I2b32ec9ccb2e9003542208e3113c77f96d82f83f
2016-07-11 22:54:41 +02:00
Bartosz Dziewoński 1826d39620 Use custom error code for all edit and upload API responses
The error code 'abusefilter-disallowed' or 'abusefilter-warning' is
used, depending on whether the filter only warns (and will allow the
action when retried) or prevents the user from performing the action.
The API response has been extended with some additional properties.

* For simple filters with no custom messages where the only action is
  'disallow' or 'warn', the error code is the same as before.
* For filters with different actions, different error codes would
  previously be returned; 'abusefilter-disallowed' will be returned
  for them all, with the actions taken listed in the
  .abusefilter.actions property of the API response.
* For filters with custom messages, the message key would previously
  be used as the error code; now 'abusefilter-disallowed' or
  'abusefilter-warning' is used, with the message available in the
  .message property of the API response.

Also cleaned up some dead "forwards-compatibility" code and made a
recently introduced public method private.

The new functionality depends on Ifac8995a4d16d11840cee814177fc2808bc2072c
in MediaWiki core, older MediaWiki versions behave mostly as before.

The new .message property contains both the key and the parameters
duplicated from .abusefilter, so that the client doesn't have to know
what AbuseFilter is - it'll be able to just display the given
message with the given parameters. My specific use case is the upload
dialog in core (core shouldn't have to know about any extensions).

See also TitleBlacklist change I97c1f5c6bbbdfc0b8ea9914bb075d5299c14df8f.

Bug: T137961
Change-Id: I5780eae96930211191ecd874aacf53fdacb58f89
2016-07-11 19:20:19 +00:00
jenkins-bot e49bd1bdba Merge "Provide page text and edit summary when filtering file uploads" 2016-07-11 19:12:52 +00:00
Translation updater bot 0c08ef888f Localisation updates from https://translatewiki.net.
Change-Id: I1160307d7fb61fa3f93caf12ace7fb8c2281b1dc
2016-07-10 22:17:48 +02:00
Translation updater bot ab9a11da0a Localisation updates from https://translatewiki.net.
Change-Id: I36ca9a3b713808495a258674682166fd87819d0a
2016-07-09 22:51:50 +02:00
Bartosz Dziewoński 069e0c89a5 Provide page text and edit summary when filtering file uploads
This allows filters using `action='upload'` to use the variables
`summary`, `new_wikitext` and several others that previously were only
provided when editing pages (`action='edit'`).

This is achieved using the new UploadVerifyUpload hook, introduced in
MediaWiki core in change Ie68801b307de8456e1753ba54a29c34c8063bc36.

`action='upload'` is now only used when publishing an upload, and not
for uploads to stash. A new `action='stashupload'` is introduced,
which is used for all uploads, including uploads to stash. This
behaves like `action='upload'` used to, and only provides file
metadata variables.

Filter authors should use `action='stashupload'` when a file can be
checked based only on the file contents, and `action='upload'` only
when the wikitext edit needs to be examined too.

Bug: T87381
Bug: T89252
Bug: T139848
Change-Id: I9654f82ecda82e4917fd0ac6b364b947a1434c73
2016-07-09 13:31:15 +00:00
Translation updater bot 9f1edcc5eb Localisation updates from https://translatewiki.net.
Change-Id: Ic61fe2d6662ee11c1ee915e238a170c540d3d659
2016-07-07 22:35:57 +02:00
Translation updater bot f9c2f89d39 Localisation updates from https://translatewiki.net.
Change-Id: I843c69155db9447765dd809de16a16f5f63fee64
2016-07-05 22:30:17 +02:00
Translation updater bot f268434c26 Localisation updates from https://translatewiki.net.
Change-Id: I1516f25f35f2735ddee640a4ecb1d74a0c7e0412
2016-07-01 23:15:32 +02:00
Aaron Schulz f3ac71de38 Fix $filters and $tagsToSet static variable handling
* Make $filters act as a proper process cache with
  lazy-loading and renamed it to $filterCache.
  This avoids warnings that appeared in e91939fb3f.
* Make sure tags are applied on stash hits by storing
  and reloading the static variable.
* Only check the cache for "edit" actions to avoid
  filling the statsd and logging data with noise.
* Remove some unused class variables.

Bug: T138529
Change-Id: I8230fef0ad0db7ae63086470189204e319382cca
2016-06-30 00:50:34 +00:00
Aaron Schulz 9fed0a2b76 Avoid using computed variables to determine stash keys
These variables are not used as "inputs" and are expensive to
compute (the main reason for caching to begin with).

Bug: T138550
Change-Id: I75849ca8eab941f75ebb82313d07d946bc095ae9
2016-06-28 21:17:45 +00:00
Translation updater bot a508a1343a Merge "Localisation updates from https://translatewiki.net." 2016-06-27 21:11:44 +00:00
Translation updater bot 563d5dc129 Localisation updates from https://translatewiki.net.
Change-Id: Ibf34a50e1880499c9d8c35e620151de08fef2fbe
2016-06-27 23:00:20 +02:00
Aaron Schulz 4091c87bad Remove "minor_edit" variable
This is almost never used and greatly complicates edit stash hooks.
It now always set to false.

Change-Id: I7f13773766e12f3d4b86451fdf3ae23e067ac373
2016-06-27 13:07:14 -07:00
Aaron Schulz 6af0857c55 Move the filter pre-caching outside of the DB lock
Edits should not wait on this to finish, especially since it does
both the minor and non-minor edit cases, only one of which actually
being useful. If the cache is there in time and there is no edit
summary it will be used; if not, there probably no reason to wait.

Bug: T138550
Change-Id: Ifc3b97ddf4dbb94f8ec3eacfcd5c8994c69aafbc
2016-06-27 11:30:29 -07:00
Translation updater bot 5a3ea2351e Localisation updates from https://translatewiki.net.
Change-Id: I289636491c0796efb72ae15f0474e185843b0493
2016-06-26 14:10:49 +02:00
Translation updater bot 9996c10349 Localisation updates from https://translatewiki.net.
Change-Id: Idfe526e6b04c8a15296ed05625f33f37ce64791f
2016-06-26 11:48:30 +02:00
jenkins-bot 9bc9f058f2 Merge "Add GENDER to abusefilter-revert-preview-item" 2016-06-25 15:31:41 +00:00
jenkins-bot 0bfa856cc2 Merge "Support GENDER in two more log messages" 2016-06-25 15:31:38 +00:00
Translation updater bot 4f1467b0bf Localisation updates from https://translatewiki.net.
Change-Id: Ife6444d2a78b3fccbec7b89561962f001f65b518
2016-06-25 14:48:30 +02:00
Translation updater bot cd999f65ab Localisation updates from https://translatewiki.net.
Change-Id: Iebbd99d38f6ef615216161bf865eaa4d5ce91399
2016-06-24 11:06:19 +02:00
jenkins-bot 0fb0477838 Merge "Minor code quality tweaks" 2016-06-23 13:39:14 +00:00
jenkins-bot 3431c84e6a Merge "Remove backwards-compatibility code using APIEditBeforeSave hook" 2016-06-23 13:39:11 +00:00
Translation updater bot 76b95a87e5 Localisation updates from https://translatewiki.net.
Change-Id: I2ec388d6d139e0144cc549303f504900aee73484
2016-06-21 23:26:05 +02:00
Translation updater bot 713b152911 Localisation updates from https://translatewiki.net.
Change-Id: Ia3e2ff640fb17d227201d4224296e5d659e5db26
2016-06-20 22:17:38 +02:00
jenkins-bot d140ae4163 Merge "Add $options parameter for testUserForCreation()" 2016-06-20 17:30:05 +00:00
Bartosz Dziewoński b053963b87 Minor code quality tweaks
Change-Id: If34e763e7cc82917c8611ec638972d20f559a601
2016-06-20 19:10:57 +02:00
Translation updater bot 4f03d59e55 Localisation updates from https://translatewiki.net.
Change-Id: I11ae4f6add99398817dcbbb32a8d4a7472bb90d0
2016-06-19 22:40:52 +02:00
Translation updater bot 1e848910cb Localisation updates from https://translatewiki.net.
Change-Id: I3d6d70b7b432df38ebbca1557acc01da5e5f7a1d
2016-06-18 22:42:33 +02:00
Bartosz Dziewoński c03ac953ad Remove backwards-compatibility code using APIEditBeforeSave hook
It was only needed for MediaWiki prior to 1.25
(09a5febb7b024c0b6585141bb05cba13a642f3eb).
We no longer support those versions after
d527574d2b.

Bug: T137832
Change-Id: I9d0b7e7713c805ebc7bf59f55456e69c6491e265
2016-06-17 01:45:29 +02:00
Brad Jorsch e533af5ced Add $options parameter for testUserForCreation()
In the future this will likely be useful for T136621.

Change-Id: I063cbdfbd9a223bf2391fce2b714ab82ddd3272f
2016-06-16 17:33:42 -04:00
Translation updater bot b019f97e17 Localisation updates from https://translatewiki.net.
Change-Id: I1016795899b854dfa9bc76af7d960939405f7526
2016-06-16 22:24:08 +02:00
Translation updater bot 063ac925a8 Localisation updates from https://translatewiki.net.
Change-Id: If5e72889ddad1d615ac1036a75a817a5a1c50102
2016-06-15 22:31:41 +02:00
Aaron Schulz e91939fb3f Cache AbuseFilter::checkAllFilters during edit stashing
This should improve page save times when manual edit summaries are
not used (and in a few cases, where they are).

Also fix a few annoying IDEA errors with block comments.

Bug: T137698
Depends-On: I2e407a3ac8b74e77bf88b1e34c1519f4dea63b80
Change-Id: I972e9147a5e52a941f478eaf1e96dc3ef8bdfe94
2016-06-14 04:26:14 -07:00
Translation updater bot 76ef672c2f Localisation updates from https://translatewiki.net.
Change-Id: I5b1fb88c1bcac31d51af3943814d1c0713f2d276
2016-06-13 22:53:55 +02:00
Translation updater bot ce38d97fd2 Localisation updates from https://translatewiki.net.
Change-Id: I119dfd2449129ed50cb534ae80498f89fa0bd625
2016-06-12 22:13:40 +02:00
jenkins-bot 8517f8fb47 Merge "Use msg() from Context instead of wfMessage() where possible" 2016-06-12 02:06:47 +00:00
Translation updater bot 84edb79545 Localisation updates from https://translatewiki.net.
Change-Id: I96a83543c93bc473ec323dfaf1e5d12776c84a8f
2016-06-11 22:08:07 +02:00
Translation updater bot ac011b1c4c Localisation updates from https://translatewiki.net.
Change-Id: I3c4e7dc652cbccc1b4c94a0c57d857b636505123
2016-06-10 22:12:36 +02:00
Translation updater bot a4f31e89a3 Localisation updates from https://translatewiki.net.
Change-Id: I5416306dbb554bf5c0617732a184bc1bd479b604
2016-06-09 22:35:34 +02:00
Translation updater bot 81b43c2383 Localisation updates from https://translatewiki.net.
Change-Id: Iadfd251ca976fd27320145910f1e478890e717fd
2016-06-08 22:25:48 +02:00
Translation updater bot 767ae7b4e6 Localisation updates from https://translatewiki.net.
Change-Id: If38a9892fd1118bbb59e8ead91540704ca1ea756
2016-06-07 22:41:10 +02:00
jenkins-bot 7dc45d4c06 Merge "Update for AuthManager" 2016-06-07 14:32:11 +00:00
jenkins-bot be0cd1da32 Merge "Change some globals to work better with extension registration" 2016-06-07 14:32:08 +00:00
jenkins-bot 126b0c61ff Merge "Add extension.json, empty php entry point" 2016-06-07 14:32:05 +00:00