Commit graph

13 commits

Author SHA1 Message Date
Daimona Eaytoy 97afa97403 Exclude old, single-use scripts from coverage reports
These scripts were already included in the updater (and hence executed)
several MW versions ago. There's no need to write tests for them right
now, so exclude these from coverage.

Change-Id: I43e46f06b98bb3b9b9d61a45baaf232e2a99c308
2020-09-30 12:42:34 +02:00
Daimona Eaytoy f0e428d4c3 Fix query in normalizeThrottleParameters
afh_actions was removed from the fields list in
I48f83f64d406c553a55ac4bbee700d59002e6a18, but we actually need it to
build the new actions.

Bug: T209565
Change-Id: I21acced670c568307f87e90179ac3a9d944b0bb1
2019-07-05 18:46:36 +02:00
jenkins-bot 903f3db8fe Merge "Beautify old, broken abuse_filter_history rows" 2019-04-10 05:11:38 +00:00
Daimona Eaytoy 25ed009518 Beautify old, broken abuse_filter_history rows
And right when the throttle script seemed complete... Here is another
function! So, this change splits the logic in new functions called
sequentially, and the only actual change is adding the beautifyHistory
function. Its purpose is to search ANY row in abuse_filter_history with
empty/missing parameters and normalize it. More specifically, missing
period and count are inserted as 0, and for missing groups we add
"none", used by a newly introduced message. This way, messages shown on
Special:AbuseFilter/history will be clearer and won't have gaps.

Bug:T209565
Bug:T215787
Change-Id: I38395f4df9d83badfd26cdf584ffba743b6417a9
2019-04-10 04:51:58 +00:00
Max Semenik 9afac9d6ff Use setDescription() instead of accessing guts directly
Change-Id: I369b88419afc6550922caf625059ad9570428cac
2019-03-25 19:51:20 -07:00
jenkins-bot b4780723e4 Merge "Fix faulty query in normalizeThrottleParameters" 2019-03-17 09:50:39 +00:00
Umherirrender da682f78ac Use ::class for class name resolution
Available since php5.5

Change-Id: Ie60465484858867d507081dfe5a305c6ab0599de
2019-03-03 01:41:40 +01:00
Daimona Eaytoy 1244960435 Fix faulty query in normalizeThrottleParameters
The DESC must be specified in the ORDER BY clause, or it will return the
first row instead of the last. Plus select only needed fields and remove
deprecated Database::nextSequenceValue.

Bug: T209565
Change-Id: I48f83f64d406c553a55ac4bbee700d59002e6a18
2019-03-02 12:57:41 +00:00
Daimona Eaytoy 15019ed34d Update the throttle script
Another batch of changes for the throttle script, fixing bugs discovered
on its last run and improving performance.
For a list of fixes, see T209565#4903044.
After merging, we need backports (REL1_32 and wmf branches) and another
dry-run.

Bug: T209565
Change-Id: I530a22d57971f8b22892e43faae5d1c6fa1e14ed
2019-01-24 00:13:09 +01:00
Daimona Eaytoy af9c7ee852 Re-fix the throttle script
This include a technical improvement (use local variables instead of
class members), and prevents displaying duplicates in the list of broken
filters.
It also covers other two quite common cases: the one where groups aren't
lowercase (for instance 'Page' instead of 'page') and extra spaces (e.g.
'user, ip' instead of 'user,ip'). The former is now fixed automatically,
while the second is a correct syntax which we don't need to fix, but now
it's effectively recognized as correct.

Bug: T209565
Change-Id: Idbfa114048bfb1127b1240c787cffa8973a47220
2019-01-09 15:58:49 +01:00
Daimona Eaytoy ea89dd4ca3 Report all filters with wrong throttle parameters
Instead of only the first one. This is quite hacky, but I don't have
much time right now, and this script is written in the spirit of JFDI.

Bug: T209565
Change-Id: Ic12ff21dd41b619bea9c71001555fd4d6299e58b
2018-12-17 20:19:20 +01:00
Daimona Eaytoy aa280998c0 Fix big problems with normalizeThrottleParameters
My final testing unveiled 4 problems, see T209565#4780868. Testing again
after this patch yields the expected outcome.

Update: A fifth problem is that we cannot disable throttling if throttle
groups are empty or fully invalid: that case is similar to the one with
invalid rate, the throttle limit is never reached and thus throttle just
doesn't work. Instead, ask users to fix it by hand.

Bug: T203336
Bug: T209565
Change-Id: Id03c9880f60764efc596ac40b8662087fdb30550
2018-12-15 18:36:16 +01:00
Daimona Eaytoy d3a8491c3f Change throttle selector to restore old functionality, overall improvement
Long (sigh) explanation in T203587#4569698. Also, simplified the way
TagMultiselect are generated, this one and the one for change tags.
This new selector is back-compat both with the old textarea and the OOUI
checkboxMultiselect; actually, this one is //fully// compatible with the
old textarea.
Add validation for throttle parameters and unit tests for validation
(split from I976c95658cddb2585910b6f8a5f047aadc4e4d47).
Added a trim when retrieving throttle identifier to allow syntax like
'ip, user'.
Improved the message shown on history.
Re-added the maintenance script to clean DB.

As I wrote in the task, a review by two other people would be great, at
least for the maintenance script (it could potentially break the DB).

Bug: T203587
Bug: T203336
Bug: T203584
Bug: T203585
Depends-On: I3b2e763bd8835207dc5df1db43d3e1881e6961c3
Change-Id: I7831dbb0bab55807392ac1f7915d6cb0cb713593
2018-11-14 12:51:36 +01:00