Commit graph

4660 commits

Author SHA1 Message Date
Translation updater bot b6fcca555f Localisation updates from https://translatewiki.net.
Change-Id: Ied96eeccbd9915eaeb42d4286197b5c398457d9d
2018-09-03 22:14:45 +02:00
jenkins-bot 19853f6131 Merge "build: Update npm dev dependencies to latests versions" 2018-09-03 17:13:09 +00:00
jenkins-bot 317260a1ea Merge "Break long lines in JS code" 2018-09-03 17:13:07 +00:00
MarcoAurelio 94e079dc9b build: Update npm dev dependencies to latests versions
stylelint has v. 9.5.0 avalaible but stylelint-config-wikimedia
does require stylelint v. 9.2.0 or throws 'npm WARN' alerts. Can
be updated later.

npm WARN "eslint-config-wikimedia@0.7.2 requires a peer of eslint-plugin
-qunit@^3.3.0 but none was installed" fixed by adding that dev dep.

Depends-On: If9d5f8d4c341f2f273eda3f1fd54d59a04a9d263
Change-Id: I2de8e728c4c190c3f90653490ea48d0124a001e0
2018-09-03 16:34:07 +00:00
Daimona Eaytoy 063bdf0a4b Change events used with the Ace editor
Use an Ace-builtin "change" event on the editor so that it also triggers
for search&replace. Also, use "change" instead of "keyup" on the
textarea, just to be sure not to miss anything.

Bug: T203391
Change-Id: Ib246c30a575d140642c74e8ac08b24bdeaaf0347
2018-09-03 16:05:14 +02:00
Daimona Eaytoy e65a69b6fe Only select needed columns in queries
Using '*' is handy, but we often end up selecting too much stuff.

Change-Id: I16d791ff8de6596de4fb65b1032b225f0bd65bf3
2018-09-03 14:12:41 +02:00
jenkins-bot 7cce6d1864 Merge "Remove _age variables from cache keys" 2018-09-03 12:08:29 +00:00
Daimona Eaytoy db4a0a1eec Break long lines in JS code
Bug: T203365
Change-Id: If9d5f8d4c341f2f273eda3f1fd54d59a04a9d263
2018-09-03 10:49:24 +02:00
Daimona Eaytoy 63803568d6 Remove the last PHPCS exclusion
Bug: T178007
Change-Id: I5ddb811c2cb15040a859a63b64873f0fa53508ee
2018-09-03 10:42:30 +02:00
Daimona Eaytoy 48989ffcda Remove PHPCS exclusion and fix it
Again, we're left with only one exclusion that I don't know how to fix.
See phab for a longer explanation.

Bug: T178007
Change-Id: I017097abef755bc65c77a5658ad92320bc42d78b
2018-09-03 09:33:29 +02:00
libraryupgrader 5cdab14eb8 build: Updating mediawiki/mediawiki-codesniffer to 22.0.0
The following sniffs are failing and were disabled:
* Squiz.PHP.NonExecutableCode.Unreachable

Change-Id: Ic3f031974008776f272d1ee77093c6d170f27ae9
2018-09-02 22:05:58 +00:00
libraryupgrader 7decca9bdd build: Updating mediawiki/phan-taint-check-plugin to 1.4.0
And updating CoC link to use Special:MyLanguage (T202047).

Change-Id: Icb04f4dcd56bfd3c7525e746e84fed8c482a038c
2018-09-01 05:29:54 +00:00
Translation updater bot 2373082c2f Localisation updates from https://translatewiki.net.
Change-Id: Ie0868ccba613c4a89e1f1215c2b3ecfef58a7f3d
2018-08-31 22:16:45 +02:00
Daimona Eaytoy 75b3321df0 Bump taint-check plugin to 1.3.1
Currently at 1.3.0.

Change-Id: Id5fcbe8421de239e5ae8c096d24c4366324e5fcc
2018-08-31 13:39:25 +02:00
Translation updater bot e3b9aa002d Localisation updates from https://translatewiki.net.
Change-Id: Iba6a981fea0b62d5e088b0bda7b8ebdec5251d88
2018-08-29 22:27:46 +02:00
Daimona Eaytoy bffba28713 Add full tests for deprecated variables
This test checks every deprecated variable to be identical to the
newly-named one, and to emit a debug notice. It also changes such debug
to be emitted via logger instead of wfDebug.

Bug: T201193
Bug: T173889
Change-Id: Ie55746bb7731062ae2d46d84857af2a05d78cf4c
2018-08-29 11:00:28 +02:00
Daimona Eaytoy 2f0a0a0893 Replace wfDebug and wfDebugLog with logger
Per standard on
https://www.mediawiki.org/wiki/Manual:Structured_logging. The use inside
AbuseFilterParser is removed in
Ie55746bb7731062ae2d46d84857af2a05d78cf4c.

Change-Id: Ia62287c4ff5f904557cd6d43d47a9f4d9696b94b
2018-08-29 10:57:56 +02:00
Translation updater bot 9270ee5280 Localisation updates from https://translatewiki.net.
Change-Id: Idb1adb013c47d83ee496c8ee9697912f379d8b56
2018-08-28 22:22:00 +02:00
Translation updater bot b0bf8b0e15 Localisation updates from https://translatewiki.net.
Change-Id: I769eb392d4d348858f7e9bd1850a9879f5bb89aa
2018-08-27 22:16:12 +02:00
Daimona Eaytoy 39f42caffc Make searched filters highlighting multibyte safe
Avoid using preg_match's offset since it is MB-unsafe. Also, remove 'UTF-8'
from mb_ functions (it's the default), reduce code duplication, and show
the right snippet for long search patterns.

Bug: T202310
Change-Id: Ieb06bdd80b0f915609afed7c7ad95e6318058ee9
2018-08-27 07:22:22 +00:00
Translation updater bot e4f0270272 Localisation updates from https://translatewiki.net.
Change-Id: I1b62ffef04993b31eccb791bbfd3c595db2440ec
2018-08-26 22:32:03 +02:00
Daimona Eaytoy 934399de45 Remove _age variables from cache keys
As we do for user_age, since these will always change. Also, rework the
method to avoid repetition of unset().

Change-Id: Ie5ceedd89cae3813bacf6680d588bc925362c2c2
2018-08-26 16:02:32 +02:00
jenkins-bot 10c147cb92 Merge "Use === operator with strpos" 2018-08-25 21:28:28 +00:00
jenkins-bot e222513a80 Merge "Generate upload variables using new prefixes" 2018-08-25 21:10:03 +00:00
Translation updater bot df4c8759f8 Localisation updates from https://translatewiki.net.
Change-Id: I35085fb053df59a03d27362831eaea9197d20eac
2018-08-25 22:32:14 +02:00
Daimona Eaytoy 8094a49dcf Generate upload variables using new prefixes
This wasn't changed in I5c370b54e6516889624088e27928ad3a1f48a821 but
really needs to be merged, to avoid setting wrong variables. At the
moment this is still fine due to temporary overrides in
AbuseFilter::generateTitleVars, but this should be merged ASAP anyway.

Bug: T173889
Change-Id: I2e6058a6fa122470a30cd4a96c68eccc66e18ae4
2018-08-25 19:06:35 +02:00
Daimona Eaytoy ef51e7c253 Fix the block options on ViewEdit
Align the checkbox label on the left to conform with dropdowns, avoid
two if with the same conditions, and give variables a better name. Also,
remove an unused message: with OOUI, the old design can't be reproduced.
We could add a fieldset, but then it would be greatly different from
options for other actions.

Change-Id: Ibdc993c1457636215601eb22f5202d2f6ad57bd9
2018-08-25 18:56:44 +02:00
Daimona Eaytoy 66318915db Use === operator with strpos
The condition always evaluated to true: for global filters strpos
returned 0, otherwise it returned false, which is == 0. Fortunately, in
the second case the function returned false as it should. Anyway, be
safe and use === operator as it should always be for strpos.

Change-Id: I7ffc990b2b8b9c47ebfb64d5234f561faaff5e88
2018-08-25 17:35:15 +02:00
Daimona Eaytoy 775c736512 Improve coverage for AbuseFilterTokenizer
This will make tokenizer almost fully covered. The only uncovered parts
are the one with cache and an else condition which I think won't ever be
executed, and thus added a comment for that. Also, remove an obsolete
xxx comment from ComputedVariable (fixed in
I8e420f0259ef6c9e579f7a00beb58f28af9da37d)

Bug: T201193
Change-Id: I6e9a73aa9e437f096f6a1e20d53a7cb50e5ed85d
2018-08-25 10:25:16 +02:00
Daimona Eaytoy a8b62dc828 Remove unused method from parser
AbuseFilterParser::setVarsimply calls the setVar method in
VariableHolder and is currently unused. Its only call was removed in
I80cbc4033ff96f2fe8c1da263b1877bfb4c7c0c4. After this patch we'll only
have an uncovered line in the parser, which is likely due to a bug in
the coverage check.

Change-Id: Ic860b03b2d23fec073a9294e356e074ae1b14ae5
2018-08-24 12:30:47 +02:00
Translation updater bot 937252a74c Localisation updates from https://translatewiki.net.
Change-Id: If7fce4c795eb49056f1dd1e11c52f097c51ae3d1
2018-08-23 23:25:38 +02:00
jenkins-bot 055cc7b5ff Merge "Filter AbuseLog by triggering action" 2018-08-23 14:48:57 +00:00
jenkins-bot 1b5428b9c8 Merge "Improve tests for the AbuseFilter class" 2018-08-23 14:41:00 +00:00
jenkins-bot 826e600731 Merge "Add _age variables to tests" 2018-08-23 14:35:33 +00:00
jenkins-bot 97f98b029d Merge "Improve parser coverage" 2018-08-23 14:33:54 +00:00
Daimona Eaytoy 078e9a3d21 Improve tests for the AbuseFilter class
Add some test cases for conds limit, profiling and other minor things.

Bug: T201193
Change-Id: I9a3035459cafd6537111cf1dea1a2d9a4bd34036
2018-08-23 14:14:57 +00:00
jenkins-bot ad69ea648e Merge "Remove unused function and improve unit test" 2018-08-23 13:46:41 +00:00
Daimona Eaytoy b46a4336de Remove hex numbers from Ace highlight
Since our parser doesn't recognize them. Follow up of
If95e34fc7260413c4fb39c18a1ef44f5a93e1a68.

Change-Id: I4511a69f3be60b4c90b499c5179cf0f5bf1d6b07
2018-08-23 12:23:16 +02:00
jenkins-bot 81a4fdc964 Merge "Improve Ace syntax highlight" 2018-08-23 10:14:57 +00:00
Daimona Eaytoy 0e2ae113fb Improve parser coverage
On the way to 100%...

Bug: T201193
Change-Id: I5fd311f861acccb31f346da9acb379b0366488e7
2018-08-23 12:13:47 +02:00
jenkins-bot afbf9b5f15 Merge "Improve code coverage" 2018-08-23 10:06:41 +00:00
Matěj Suchánek 853936316f Filter AbuseLog by triggering action
For now, there is an "Other" field which will show all but hard-coded actions.

Bug: T187971
Change-Id: If564aced2e9cd933d8cfcf7cb96166aa279f2823
2018-08-23 11:40:15 +02:00
Daimona Eaytoy 03b52c2b37 Remove unused function and improve unit test
AbuseFilterParser::setVars is only used in a parser test. In the past it
was also used in the actual code (see for instance
https://phabricator.wikimedia.org/diffusion/EABF/browse/master/;5cc8dac63ca585c288ca4c8605db810774e39666?grep=setVars), but at the moment it's pretty unuseful.
This patch removes such function and makes the unit test use literals
instead of variables to avoid calling it.

Change-Id: I80cbc4033ff96f2fe8c1da263b1877bfb4c7c0c4
2018-08-23 11:00:16 +02:00
Daimona Eaytoy 90260edad0 Add _age variables to tests
Tests for new variables introduced in
I0993cecc322806382a1b567b60c0a4af69054841.

Change-Id: Iadaa33c20eb26d6e76ac02e3e9c0066b904833bc
2018-08-23 10:50:52 +02:00
Translation updater bot 88f714fed1 Localisation updates from https://translatewiki.net.
Change-Id: I68c433a15d3be6bfc6acf78d14b32796208da77e
2018-08-22 22:35:28 +02:00
Daimona Eaytoy 447d434e2a Improve code coverage
Add some parser tests, improve existing ones, and add missing @covers.

Bug: T201193
Change-Id: I9c0d2d83560baa4a3e1d4465b7919a48c4e26ac1
2018-08-22 19:07:14 +02:00
jenkins-bot 46d78623f4 Merge "Add page_age variable to AbuseFilter" 2018-08-22 16:17:36 +00:00
jenkins-bot 21547083c0 Merge "Add missing @covers tag" 2018-08-22 15:31:12 +00:00
Daimona Eaytoy e8a4517d6b Improve Ace syntax highlight
Several improvements, this is the list:
*Added highlighting for disabled and deprecated variables
*Simplified a bit Ace's keyword mapper
*Added highlighting for ternary operator
*Added logic to retrieve operators from AF tokenizer
*Removed $ symbol since it's not usable in declaring stuff
*Customized highlighting via CSS

Depends-On: I5c370b54e6516889624088e27928ad3a1f48a821
Change-Id: If95e34fc7260413c4fb39c18a1ef44f5a93e1a68
2018-08-22 15:23:35 +00:00
rarohde e1865fca74 Add page_age variable to AbuseFilter
Adds page_age variable that reports the number of seconds since the
first edit to the current article (or 0 for new articles).

Bug: T30844
Change-Id: I0993cecc322806382a1b567b60c0a4af69054841
2018-08-22 17:10:39 +02:00