Commit graph

3207 commits

Author SHA1 Message Date
Aaron Schulz 2807b5883a Avoid duplicate autopromote block key fetches
Bug: T133728
Change-Id: Ia3a955547e8147e92c7ca9782e399f9abd6d3949
2016-05-05 19:14:19 +00:00
Translation updater bot ef7a80ba60 Localisation updates from https://translatewiki.net.
Change-Id: I049aa74cbe28975fa18189f0bb3844894691fe4f
2016-05-04 22:20:53 +02:00
Translation updater bot 3afdff8c62 Localisation updates from https://translatewiki.net.
Change-Id: If84f70a6bc09365f9fc62b25a120d44eb05fe085
2016-05-01 23:13:47 +02:00
jenkins-bot c100e0b0ee Merge "Avoid master queries on page views in loadFilterData()" 2016-04-28 21:57:44 +00:00
Translation updater bot 5dee195c82 Localisation updates from https://translatewiki.net.
Change-Id: I87d11efb7da6542fcc0f7b9062316c9a8b71f310
2016-04-28 23:27:12 +02:00
Aaron Schulz f7367dc970 Avoid master queries on page views in loadFilterData()
Bug: T92357
Change-Id: Ib7928067bc0b7ebd631d8abc96e3c24f81e78414
2016-04-28 13:56:41 -07:00
jenkins-bot 71bb512d93 Merge "Optimize 'rcount()' function" 2016-04-28 09:32:29 +00:00
Translation updater bot 0893543789 Localisation updates from https://translatewiki.net.
Change-Id: I132f929d229399d92171cf3d702d4a08c69755b8
2016-04-27 22:53:24 +02:00
Bartosz Dziewoński 3283e2f7b8 Optimize 'rcount()' function
Starting with PHP 5.4, preg_match_all() allows omitting the '$matches'
argument. This lets PHP avoid computing them, just count the matches.

I'm not sure how various versions of HHVM handle this, so I made it
just test whether this works rather than check version numbers.

Change-Id: Ib27505c8355109c6e6a9f1c4631281a0f0caaa75
2016-04-27 18:01:56 +02:00
Translation updater bot 4232077625 Localisation updates from https://translatewiki.net.
Change-Id: Ie96677c7ce40ac94f463ebdd8cf63f2bc3d6c267
2016-04-26 22:25:11 +02:00
jenkins-bot 7e096abc85 Merge "Optimize 'count()' function" 2016-04-25 22:31:52 +00:00
jenkins-bot 5c296ab6a6 Merge "Convert Special:AbuseLog to HTMLForm from XML Form" 2016-04-23 15:40:38 +00:00
Translation updater bot 6246c561c2 Localisation updates from https://translatewiki.net.
Change-Id: I06106535cc027dbdd36189d7bb4a41ee1c841e63
2016-04-22 22:20:19 +02:00
Translation updater bot 45bcef1964 Localisation updates from https://translatewiki.net.
Change-Id: Id53848d81a4e60668b20ba47f8c8373957d5e364
2016-04-20 23:07:29 +02:00
Translation updater bot 82d3a325d1 Localisation updates from https://translatewiki.net.
Change-Id: I60e3bad3e01dac38286eeb7a0c5cfd306a739dcf
2016-04-19 22:17:03 +02:00
tonythomas01 b04da51af9 Convert Special:AbuseLog to HTMLForm from XML Form
Changes after this conversion:
* order of the fields changed slightly from the original ( User,
Filter, Title ) to ( User, Title, Filter )
* $this->mSearchUser is set as the Default value of 'user'
field, making the value from the request show up there even if
its value was invalid. Earlier, it should show up 'null' due to
loadParameters() validation checks.

Bug: T132287
Change-Id: I614cd9b962b7b672e43dd35b14700c72f3425c1f
2016-04-20 00:12:31 +05:30
Translation updater bot b7badebbfc Localisation updates from https://translatewiki.net.
Change-Id: Ic1e9e77d04d430b02e0a1969dcf2008fa38e9404
2016-04-18 22:18:48 +02:00
jenkins-bot c8a1e9fa49 Merge "Convert Special:AbuseFilter/import to HTMLForm" 2016-04-18 18:22:55 +00:00
jenkins-bot f4522444c4 Merge "Convert Special:AbuseFilter/history to HTMLForm" 2016-04-18 18:22:52 +00:00
tonythomas01 53b377a6d3 Convert Special:AbuseFilter/import to HTMLForm
Bug: T132284
Change-Id: Ife1ed3af19a4b4b506948763e4d92efc3a14a5bf
2016-04-18 23:07:31 +05:30
jenkins-bot 30534924c4 Merge "Convert Special:AbuseFilter/examine to HTMLForm" 2016-04-18 17:25:23 +00:00
jenkins-bot 5d01b30833 Merge "Add some tests for behavior of 'count()' function" 2016-04-18 08:05:38 +00:00
Translation updater bot 63a7379bf8 Localisation updates from https://translatewiki.net.
Change-Id: Ib128af567e4ec9ea73fb94df556a410252d4c16d
2016-04-17 22:13:07 +02:00
tonythomas01 b21d6a22b1 Convert Special:AbuseFilter/examine to HTMLForm
Bug: T132284
Change-Id: Ie8bc13fd8602d94f53e574efb00f9908f0029ffd
2016-04-17 13:44:04 +05:30
Bartosz Dziewoński 5fc30112c7 Optimize 'count()' function
substr_count() is just as fast as looped strpos() when there are no
matches, and gets faster as the number of matches increases.

Note that this introduces a small change in behavior when the needle
is composed of repeated substrings, e.g. 'asdasdasd' or 'aa', and
haystack is such that the needle can be matched in overlapping
positions, e.g. 'asdasdasdasd' or 'aaaaa'. The old implementation
counted overlapping matches, the new one doesn't. I don't think this
behavior was intentional and I don't think this change will cause any
real problems.

Change-Id: Icc905ca34bf08d63e969787a5e3c119d498bf878
2016-04-17 08:32:27 +02:00
Bartosz Dziewoński 7d83540527 Add some tests for behavior of 'count()' function
Change-Id: I29a6c91d0780dc9a1eaee6d29d3b1f9c9c708df7
2016-04-17 08:18:29 +02:00
tonythomas01 3b6ca98c6e Convert Special:AbuseFilter/history to HTMLForm
Bug: T132284
Change-Id: I14b98e92fa9e5ad2401c046bbaacd4a98daa5cc0
2016-04-17 10:57:08 +05:30
Translation updater bot 246ab358d5 Localisation updates from https://translatewiki.net.
Change-Id: If91c8434c67f8b5040973446d62b1fa2b1414df6
2016-04-15 22:15:24 +02:00
Translation updater bot 5f3931cffa Localisation updates from https://translatewiki.net.
Change-Id: I8f7705e2a5fa76f72e2fcc70a59f9303171b0094
2016-04-14 22:32:25 +02:00
jenkins-bot f8391b5144 Merge "Fixes to filter profiling" 2016-04-13 21:28:54 +00:00
Aaron Schulz 43a538fe03 Fixes to filter profiling
* Defer the slow profiling updates to post-send
* Convert to the object stash, so that all DCs see
  the same values

Change-Id: I08316c6a3192bd69248cf5ab5a3ed8185341c313
2016-04-13 23:21:32 +02:00
Translation updater bot d632ac8d50 Localisation updates from https://translatewiki.net.
Change-Id: I6731dc0ab76e5190a570c13a2bd7822298c16949
2016-04-13 22:16:10 +02:00
jenkins-bot 1fdf7d0a4f Merge "Use $wgExtensionDirectory instead of hardcoding $IP/extensions" 2016-04-12 21:10:35 +00:00
Translation updater bot 957932c556 Localisation updates from https://translatewiki.net.
Change-Id: I3dcce5a683fe2dfbc8aadf031bfc89cb09bdf874
2016-04-12 22:48:30 +02:00
Kunal Mehta 5a5844b840 Use $wgExtensionDirectory instead of hardcoding $IP/extensions
Change-Id: Icf28a218d18df2ba90726f8b5a86621043138e48
2016-04-12 09:13:05 -07:00
Bartosz Dziewoński e00909b3c3 Remove unnecessary phpcs overrides
Change-Id: Ic7648c14f2ac2a07878f69e102832215af6855c8
2016-04-12 12:36:06 +00:00
Translation updater bot 9e6e484776 Localisation updates from https://translatewiki.net.
Change-Id: I53a084b707a1e629c4c17fe5e0e090086e274984
2016-04-11 22:32:18 +02:00
jenkins-bot 59842c6d0e Merge "Improve ignoring short-circuited operations" 2016-04-11 19:21:15 +00:00
jenkins-bot 9eb83364d1 Merge "Improve how the number of conditions is counted" 2016-04-11 19:15:58 +00:00
jenkins-bot fa22bdae6f Merge "Mostly unbreak profiling of number of conditions used by filters" 2016-04-11 12:56:36 +00:00
jenkins-bot 0ef2bd0dac Merge "Add $wgAbuseFilterProfile to enable filter profiling" 2016-04-11 12:56:33 +00:00
jenkins-bot e8b947d3c1 Merge "Revert "Removed filter profiling using $wgMemc"" 2016-04-11 12:56:30 +00:00
Translation updater bot 6d9d9e3a7c Localisation updates from https://translatewiki.net.
Change-Id: I61166b04cedde3bb92774ea2bef89de3190fcec6
2016-04-10 19:55:22 +02:00
Amire80 134529b517 Remove a tab from abusefilter-exception-notenoughargs
It seems generally unnecessary, looks weird in translatewiki.net,
and is not translated to most languages.

Change-Id: If17cd4594b283cbadfda7dd0135cc5a5b2931f25
2016-04-09 23:22:02 +03:00
Bartosz Dziewoński e79b45b71f Improve ignoring short-circuited operations
Previously, 'false & a == b' would actually execute the comparison and
count it against the condition limit, while 'false & (a == b)' wouldn't.
They behave the same now.

mShortCircuit was only checked for the most potentially expensive
operations (computing functions and getting variables), all the other
operations on bogus values generated by this would be executed and the
results ignored later.

This probably doesn't noticeably improve performance, but it corrects
how the condition limit is counted.

Bug: T43693
Change-Id: Id1d5f577b14b6ae6d987ded12689788eb7922474
2016-04-09 16:25:52 +02:00
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