Commit graph

4412 commits

Author SHA1 Message Date
Bartosz Dziewoński 3b32cf00e9 Improve how the number of conditions is counted
With the new behavior, the number of conditions in incremented when:
* Evaluating a function
* Evaluating a comparison operator (== === != !== < > <= >= =)
* Evaluating a keyword (in like matches contains rlike irlike regex)

Previously, the number of conditions was incremented when:
* Evaluating a function
* Entering the comparison operator evaluation mode

This resulted in a number of surprising behaviors. In particular:
* '(((a == b)))' counted as 4 conditions, not 1
* 'contains_any(a, b, c)' counted as 5 conditions, not 1
* 'a == b == c' counted as 1 condition, not 2
* 'a in b + c in d + e in f' counted as 1 condition, not 3
* 'true' counted as 1 condition, not 0

It is still possible to easily cheat the count by rewriting comparisons
as arithmetic operations. I believe this is meant to advise users of
the complexity of their rules and not really enforce strict limits.

Bug: T132190
Change-Id: I897769db4c2ceac802e3ae5d6fa8e9c9926ef246
2016-04-09 16:16:27 +02:00
Bartosz Dziewoński e0ff347e29 Interpret data correctly in getMoveVarsFromRCRow()
$params[0] is the full prefixed page title, with namespace.
$params[1] is whether the move was with or without a redirect.

Bug: T121963
Change-Id: I880bb227f2fc97394a68187e7b8391acf5aeaf5e
2016-04-09 01:29:27 +00:00
Bartosz Dziewoński 8e48a8eb37 Avoid crippled APIEditBeforeSave hook, use new features of EditFilterMergedContent instead
Back when APIEditBeforeSave was being introduced here, it was
impossible to return error data for API requests from it (T34216). But
this hook runs a lot earlier than EditFilterMergedContent, and only
gives us the text submitted in the action=edit API call and not the
actual text that's going to be saved, which are different for section
edits (T54077) or edits where an edit conflict is automatically
resolved (T73947).

T54077 was solved by making the APIEditBeforeSave lie that there are
no sections edits in the API. Perhaps T73947 could also be resolved by
lying that there are no edit conflicts in the API, but it seemed that
this would require duplicating even more logic from EditPage in the
API than T54077.

And luckily, EditFilterMergedContent recently gained the ability to
return precise error messages to the API (in MediaWiki 1.25,
I4b4270dd868a643512d4717927858b6ef0556d8a). So let's use that if
available and only fall back to APIEditBeforeSave on older versions.

Bug: T73947
Change-Id: I30c1e3d0a6c10888e6ac53745313434474663cce
2016-04-09 01:16:28 +00:00
Bartosz Dziewoński ca0b0c081d Mostly unbreak profiling of number of conditions used by filters
We were only recording the total number of conditions used by all filters,
then treating it as if it was the per-filter number, resulting in crazy
stupid values. We were also not clearing this when a filter was edited.

(This does not fix the remaining problems mentioned on the task.)

Bug: T53294
Change-Id: I4f9f88f94469b977fe60c554b76e94edacac3462
2016-04-08 19:51:16 +02:00
Bartosz Dziewoński 337cad30d9 Add $wgAbuseFilterProfile to enable filter profiling
Follow-up to b60829a60c.

I'll fix up message translations on Translatewiki when this is merged.

Bug: T132189
Change-Id: I1ecaedd7489b264ed621309b6fbfb63b9287a437
2016-04-08 16:53:45 +00:00
Bartosz Dziewoński 39261ff5cd Revert "Removed filter profiling using $wgMemc"
This reverts commit afb78deb84.

I'll guard this behind a global and fix up the localisation messages
in a separate commit. This is a straight revert.

Bug: T132189
Change-Id: Iff4aa6d7d543db8f47c5f81f3c206dafcd5373dc
2016-04-08 16:53:34 +00:00
Bartosz Dziewoński 6298c91bde Remove executable bit from files
find . -perm /111 -type f | grep -v .git | xargs chmod ago-x

Change-Id: I1e5994ba0a74eafdeff262017f90d4c0f09f3ab4
2016-04-08 14:00:52 +00:00
Translation updater bot 19731a94df Localisation updates from https://translatewiki.net.
Change-Id: I51e55f2add8c046b99940480bad830166a0b73b7
2016-04-07 22:57:40 +02:00
Translation updater bot 3d9c10d314 Localisation updates from https://translatewiki.net.
Change-Id: Ia1b8e584e75a958f1efcfdddf0d243cf8aa87824
2016-04-06 23:08:42 +02:00
Translation updater bot 3ffd6b039e Localisation updates from https://translatewiki.net.
Change-Id: Ia257e801a88fd13cfded1e6e1f5bd2528c98a177
2016-04-05 22:52:01 +02:00
jenkins-bot ff09b901d8 Merge "Add more file_* variables for file metadata" 2016-04-05 19:38:06 +00:00
Bartosz Dziewoński 8858cdd42a Add more file_* variables for file metadata
* file_mime
  The MIME type of the file, e.g. 'image/png'.

* file_mediatype
  The media type of the file, one of 'UNKNOWN', 'BITMAP', 'DRAWING',
  'AUDIO', 'VIDEO', 'MULTIMEDIA', 'OFFICE', 'TEXT', 'EXECUTABLE', 'ARCHIVE'.

* file_width
  Width of the image in pixels, or 0 if it's inapplicable (e.g. for
  audio files).

* file_height
  Height of the image in pixels, or 0 if it's inapplicable (e.g. for
  audio files).

* file_bits_per_channel
  Bits per color channel of the image, or 0 if it's inapplicable (e.g.
  for audio files). The most common value is 8.

Bug: T131643
Change-Id: Id355515a18d3674393332c0f4094e34f9f522623
2016-04-04 23:40:03 +02:00
Translation updater bot 251f5d2452 Localisation updates from https://translatewiki.net.
Change-Id: Icb49d8eabd0ef30976ce60f23790c20a16d5a435
2016-04-04 22:11:00 +02:00
jenkins-bot 6d2acf6e6b Merge "Save upload related title vars in ARTICLE prefix not FILE" 2016-04-04 18:53:45 +00:00
Reedy f2715ee51c Save upload related title vars in ARTICLE prefix not FILE
We don't define FILE_* as useable title variables, so they're
not accessible

Change-Id: I857b55937204c9ecd2bbd433a33f360b7d3e3aa7
2016-04-02 23:13:38 +01:00
Bartosz Dziewoński d2f7f86160 AbuseFilterViewEdit: Correctly reject non-existent historical versions
Return value of this function is already being checked for this.

Bug: T125572
Change-Id: I6f1d77d335a7ed269e6fbb9aaf2c3a7a566ae992
2016-04-03 00:11:29 +02:00
Florian 98cb0973cd Remove usage of DifferenceEngine::generateDiffBody()
Bug: T122754
Change-Id: Ic13c22169317150ee9fe00a0334eed7e3623c5cf
2016-04-02 13:10:23 +00:00
Glaisher bbd3574731 Don't add 'anononly' flag for Abuse filter blocks
Bug: T131362
Change-Id: I6421293195d2d86574f8ecda9b467e1fedabc3ba
2016-03-31 20:42:30 +05:00
Translation updater bot 0c40e76a3e Localisation updates from https://translatewiki.net.
Change-Id: I67c5260ecc8e1b8733dfa42b7782ecc10f0dd5db
2016-03-28 22:38:31 +02:00
Translation updater bot 009ecee5de Localisation updates from https://translatewiki.net.
Change-Id: Ib3f63579df062a4e68a9c88a91bc868a71174abf
2016-03-27 21:06:27 +02:00
Translation updater bot 851fb2e7f9 Localisation updates from https://translatewiki.net.
Change-Id: Ic3343aa0c3f7467866fd7a5b95059b3e43e3dc6b
2016-03-24 22:31:44 +01:00
Translation updater bot aeab5724b0 Localisation updates from https://translatewiki.net.
Change-Id: Icaa8a00b37e5c9519147d5c09446ebdbdc0f64c2
2016-03-23 22:17:54 +01:00
Translation updater bot 1eed48e09d Localisation updates from https://translatewiki.net.
Change-Id: Ie64837fea3e0935678133ac8dceeb14d21c86024
2016-03-22 22:27:10 +01:00
jenkins-bot 9994de1062 Merge "Migrate (un)block logging to new system" 2016-03-21 12:53:51 +00:00
Glaisher ffcb4d945d Migrate (un)block logging to new system
Also
* Fix a bug where action-reverts doesn't work for anons
since the userid is always 0 for them, instead use the username.
* Start adding block log flags consistently with core

Bug: T124789
Change-Id: Ic6680dad891e2169b392fcfefc1e313af85bc92f
2016-03-21 15:26:59 +05:00
Translation updater bot 58e883c277 Localisation updates from https://translatewiki.net.
Change-Id: I7e362c7cc29504a1553eb0dadef02c16c4dc1efc
2016-03-20 22:35:28 +01:00
jenkins-bot db61abb01c Merge "Don't filter undos coming in via the "APIEditBeforeSave" hook" 2016-03-18 14:18:31 +00:00
Translation updater bot 643dc7df78 Localisation updates from https://translatewiki.net.
Change-Id: I9e0311b03cb59ffb732d7a2059a4bafcedd7bc27
2016-03-17 23:13:22 +01:00
Marius Hoch b2ae8af263 Don't filter undos coming in via the "APIEditBeforeSave" hook
For consistency with other hooks.

Bug: T126861
Change-Id: I087276495c6f5f7fb01855aee3798516869e1a3e
2016-03-17 19:51:16 +00:00
Translation updater bot 93f28e613c Localisation updates from https://translatewiki.net.
Change-Id: I1d89f783f3397d34b1b5314388cee27518a4e6f5
2016-03-14 22:45:05 +01:00
Translation updater bot 53746bdfe6 Localisation updates from https://translatewiki.net.
Change-Id: I214b1e19175ddc039fc8de78ba058c7c7145e0ba
2016-03-12 21:08:30 +01:00
Translation updater bot 3ff8573930 Localisation updates from https://translatewiki.net.
Change-Id: I3144b60875cd059e2916bde80e50ba876ebfee86
2016-03-09 22:37:31 +01:00
Translation updater bot 2da5424db8 Localisation updates from https://translatewiki.net.
Change-Id: I6d7e5b5e7f5e29e9947d478e229b558662ff7b98
2016-03-07 22:22:23 +01:00
Translation updater bot dd655f3db4 Localisation updates from https://translatewiki.net.
Change-Id: I4484059e7101db45408f8472ad650e04a6a82565
2016-03-06 22:10:52 +01:00
Translation updater bot 6cc6fe6cd3 Localisation updates from https://translatewiki.net.
Change-Id: I9e9b4f8c6dc95539cb5cef8325c1182b218f2e4c
2016-03-04 22:48:19 +01:00
Translation updater bot e292e6e751 Localisation updates from https://translatewiki.net.
Change-Id: I06430e9df92df1343adceb9e626e50f358974ce3
2016-03-02 23:34:15 +01:00
jenkins-bot accf17bc73 Merge "Add npm entry point" 2016-03-01 21:16:12 +00:00
Translation updater bot b07896a19f Localisation updates from https://translatewiki.net.
Change-Id: Idc7bb3a71904a128fc75e0f0d8dd005b01edb529
2016-03-01 21:51:15 +01:00
Paladox 87c078f3c2 Add npm entry point
Bug: T119973
Change-Id: Idcce2f848d3b1f8028efbc54cafa012af725e336
2016-02-29 19:52:23 +00:00
Translation updater bot db6a6d5160 Localisation updates from https://translatewiki.net.
Change-Id: Icaba14695eca136c84c129f48e7639c929e6c2e7
2016-02-25 22:16:32 +01:00
Translation updater bot 12c464d1ef Localisation updates from https://translatewiki.net.
Change-Id: Ic3455be1ff3945828b63b9f43d83880efd29dd81
2016-02-24 22:00:01 +01:00
Translation updater bot 8123f660a1 Localisation updates from https://translatewiki.net.
Change-Id: I5115fb3a237577a2689fa369a81ab06afc69a4ee
2016-02-21 22:23:45 +01:00
Ori Livneh 3f4a0df551 Compress PNGs with zopflipng
Zopfli is the most efficient DEFLATE compression algorithm, trading run-time
performance for file sizes that are typically 3-8% smaller than those produced
by zlib with the maximum compression setting. Its output is Deflate-compatible,
so no specialized decoder is needed.

This change was created by running zopflipng against all the PNG files in this
repository. The exact invocation was:

  git ls-files --exclude-per-directory=.gitignore -- '*.png' \|
    parallel zopflipng -m -y {} {} \;

Files which zopflipng was not able to compress more efficiently were left unmodified.

Bug: T127608
Change-Id: Ib947620d9dd4d9e5760b2b7ab42f5bea1734e654
2016-02-21 00:51:11 +00:00
Translation updater bot a8ea2e936b Localisation updates from https://translatewiki.net.
Change-Id: I4b595c81197df62679da47e78ac395baf3205217
2016-02-20 22:19:23 +01:00
Ori Livneh eed0747629 Compress PNGs with zopflipng
Zopfli is the most efficient DEFLATE compression algorithm, trading run-time
performance for file sizes that are typically 3-8% smaller than those produced
by zlib with the maximum compression setting. Its output is Deflate-compatible,
so no specialized decoder is needed.

This change was created by running zopflipng against all the PNG files in this
repository. The exact invocation was:

  git ls-files --exclude-per-directory=.gitignore -- '*.png' \|
    parallel zopflipng -m -y --iterations=1000 --filters=01234mepb {} {} \;

Files which zopflipng was not able to compress more efficiently were left unmodified.

Change-Id: I82b3141f3f19e594ab955f250e47dc6311e337c2
Task: T127608
2016-02-20 20:17:20 +00:00
Translation updater bot d10b016071 Localisation updates from https://translatewiki.net.
Change-Id: Ic9837c2de1cdef8579c1ace4d846a051db7f0ff5
2016-02-19 22:04:53 +01:00
Translation updater bot 9aa44dd53e Localisation updates from https://translatewiki.net.
Change-Id: I66e6cef5cec649ace35c63f95d958a4ad9ca1ea2
2016-02-18 22:13:33 +01:00
jenkins-bot 42bea193e5 Merge "Avoid unstubbing $wgUser when unsafe during filter failures" 2016-02-10 20:50:35 +00:00
Brad Jorsch c0c4e390b9 Avoid unstubbing $wgUser during AbortAutoAccount hook
At this point $wgUser->getId() will be 0 anyway because the $wgUser is
in the process of being created, so skip the call.

Bug: T124367
Change-Id: I4c6c999f1799db6ff21db3d9df537da643442d27
2016-02-08 19:06:59 +00:00
Translation updater bot 4875efcb5d Localisation updates from https://translatewiki.net.
Change-Id: Id921664598d2776015687d8b8d20bba9ff7822e0
2016-02-07 22:12:42 +01:00