Commit graph

290 commits

Author SHA1 Message Date
addshore 093b2dba8a Remove use of deprecated wfRunHooks
Change-Id: I58776ddaae3dfb70a4ab4e83dfba544670b66fef
2015-08-06 18:15:42 +01:00
jenkins-bot be09eabbdd Merge "Conversion to using getMainStashInstance()" 2015-07-15 08:23:58 +00:00
Timo Tijhof fbbdce5d38 Clean up scary code
Change-Id: If4dd95c2b6e55a680c9faf03455288340e8164fb
2015-06-28 02:22:04 +01:00
Timo Tijhof abb31b0023 Fix "Fatal error: Call to undefined method WikiPage::getCount"
This was removed in MediaWiki 1.25 (90d90dad6e).

Bug: T104100
Change-Id: I25edf9e9f10cd3e14e02e63cab86fb5164af8d1a
2015-06-28 02:18:52 +01:00
Aaron Schulz 9ffa400322 Conversion to using getMainStashInstance()
Bug: T97620
Change-Id: I7fc2c0a42bf295d71b9e0721ab4261290334cdec
2015-06-24 20:18:22 +00:00
Aaron Schulz afb78deb84 Removed filter profiling using $wgMemc
* This is very slow as there can easily be hundreds of filters,
  each doing 6 memcached queries. Xenon flamegraphs show a lot
  of time spent in this method, slowing down editing.

Change-Id: I31e4502bbd45cc284db3cd89eb34ad365c59905b
2015-05-19 08:14:33 -07:00
Aaron Schulz 60d1eebb6b Conversion to using WAN cache
* Also removed some code duplication
* Use getConnectionRef in checkAllFilters so that the
  DB connection can be reused

Bug: T93141
Change-Id: I17c5a976b6c45029cde4ed34ad82d69e365ae8c5
2015-05-12 22:55:05 -07:00
jenkins-bot 3409e62df1 Merge "Fix for legacy testwiki AFL entries (1 to 154)" 2015-03-25 22:31:13 +00:00
Jeff Janes 942a95e80e PostgreSQL: Fix magic-value code for AbuseFilter
When importing filters, the code is using the magic value
of 'new' for the af_id field, which is of type bigint, to
indicate a not-yet-inserted record.

In MySQL, comparing a bigint to 'new' is legal but always false,
while in PostgreSQL it is illegal, and led to errors when checking
if the filter is hidden.

Fix this by adding special-case code to filterHidden so that it
always returns false for 'new' records. In PostgreSQL this fixes
the error, and in MySQL it avoids a pointless trip to the database.

Should be back patched to 1.23 and 1.24

Bug: T89514
Change-Id: Ib4b5585ac9889a1760ec930c555e7809a424538e
2015-03-25 22:07:55 +00:00
Alex Monk f5c4a724dc Fix for legacy testwiki AFL entries (1 to 154)
Also clean up an easy-for-users-to-break check for these legacy entries

Tested on mw1017

Change-Id: I7c1a45e39f188f4509fe4a601d2fd524717c00f8
2015-03-21 23:20:14 +00:00
Chad Horohoe 0715c05ed9 Remove obvious function-level profiling
Change-Id: I85f65a65abb5b91b44441caa21fb9c5e8edb2ebe
2015-02-04 10:26:04 -08:00
Kunal Mehta 68639158f8 Add file_size variable
To be able to filter on extremely large uploads

Change-Id: Id4c4c0f900ba6b91579211b8412ee194f09f6118
2015-01-07 20:56:53 -08:00
jenkins-bot c1aac8de74 Merge "Consistently document function parameter $group" 2014-11-15 17:00:38 +00:00
Nemo bis 936f57c0f6 Consistently document function parameter $group
Followup to 0c174aec.

Change-Id: Idbe7eee4288b5c09d3b9f373cb4eb22da659fc16
2014-11-07 13:21:45 +01:00
Nemo bis f24985e6c2 Condition match: comment says 10k, code 1k
Change-Id: Ia8cf3510a19315cd6b9610d972703a46c8eea9ef
2014-11-07 13:16:12 +01:00
Liangent a86019d2d3 Add new variable article_first_contributor
Bug: 67793
Change-Id: I725b7150de52bdc6518f73a6302f850e8d596824
2014-08-11 11:51:44 +00:00
Marius Hoch 39fb819b9c Don't try to pass non Title objects into RequestContext::setTitle
That will cause a fatal error...

Change-Id: Ib12765ca696ee9c8c5a0572dab54d30a4434e6ce
2014-07-20 22:04:37 +02:00
Kunal Mehta b40416c037 Add user_rights variable
Allows for more broad filters to check for a given right, rather
than having to check against multiple groups, which becomes useful
with global groups.

Bug: 60191
Change-Id: I95b5477d6d868d4b83bcd98e779e6d535aa755b3
2014-07-06 22:18:57 -07:00
Jackmcbarn 9409452698 Add tags from all matching filters
If multiple filters all add tags to an edit, make all of them be added
rather than just one of them.

Bug: 66387
Change-Id: Ib666c2765718d7d0603921ab94d22a7d51cbd3d2
2014-07-02 23:20:47 +00:00
Aaron Schulz 9a632d04ec Defer af_throttled query to post-commit auto-commit mode
* Due to the nature of this code (a throttle) it will likely slam the DB,
  so push it after the end of the main transaction.

bug: 60600
Change-Id: I48895358deaa1b951d849eeee14c7126cfa25ec8
2014-01-29 23:37:08 +00:00
jenkins-bot efa50efe4f Merge "Increased the number of rows in AbuseFilter's Filter testing textarea" 2014-01-24 00:27:22 +00:00
Liangent 25a15f641c New diff variables regarding pre-save transformed wikitext
Change-Id: Ie21041d96f1c4cf37d697fffcaffa1ff8242f886
2014-01-20 02:49:54 +01:00
jenkins-bot cb7dc7fa63 Merge "Make MOVED_TO* var generating from RecentChanges working" 2014-01-19 23:54:15 +00:00
nullzero 6c89ccc2fe Make MOVED_TO* var generating from RecentChanges working
This patch fixes the generation of MOVED_TO vars from
recentchanges rows.

Change-Id: I6c5471620a0fb5cb78b946fc162ff3d6a30b0e0e
2014-01-20 00:48:23 +01:00
Anjana S 4a5b76539d Increased the number of rows in AbuseFilter's Filter testing textarea
The text areas for the table row had only 5 rows, which is a lot less than
 the default number of rows.So now the number of rows in the testing textarea is changed to 15.

Bug: 59869
Change-Id: I9f221e7a49473ae1d473333f7ecf26235366d257
2014-01-12 21:04:52 +05:30
jenkins-bot 2125c3e341 Merge "Removing AbuseFilter::checkConditions' param" 2014-01-07 19:28:46 +00:00
Hoo man 91ff9853ce Merge "Add triggered filter id as parameter to messages" 2014-01-05 21:04:09 +00:00
Matthias Mullie 84536df324 Removing AbuseFilter::checkConditions' param
I'm not really sure why it exists; I assume to minimize overhead of init'ing
multiple AbuseFilterParser objects that would be exactly the same.

However, checkConditions() - which checks one specific condition - is not really
an "endpoint" you will want to call in <your-extension-that-uses-AbuseFilter>.
You're more likely to call something higher-lever (like
AbuseFilter::filterAction, which will take care of fetching all appropriate
filters, as well as run them through checkConditions, and much more). This will
trickle down to ::checkAllFilter, down to ::checkFilter, which would eventually
call ::checkConditions with the 'keepvars' argument.
Basically, unless you're re-implementing much of AbuseFilter yourself, you won't
get to pass anything other than 'keepvars' to checkFilter.
As a result, even though you may call AbuseFilter to call on multiple different
vars, it will re-use the same parser with the first vars.

I'm proposing to drop the 'keepvars' and just keep the vars around instead.
checkFilter can compare previous vars with new vars, and only init a new Parser
if the vars are different.

Change-Id: I96ccc60c77f3cdbb82c0f9f16782a1a44ffb1592
2013-12-30 12:15:59 +01:00
jenkins-bot 1f6936c8b3 Merge "Send AbuseFilter hits to CheckUser" 2013-12-26 22:13:45 +00:00
se4598 2c30df42c5 Add triggered filter id as parameter to messages
Bug: 50464
Change-Id: I82f1c7f021c8d95fe50fd4da4bc57a8850bbbb84
2013-12-26 22:09:03 +01:00
Kunal Mehta ba6d178f07 Send AbuseFilter hits to CheckUser
Bug: 29583
Change-Id: I175f95b7118dab87de208cfb729e14403a670680
2013-11-10 12:34:48 -08:00
Siebrand Mazeland 2bb441ee9c Declare visibility on class properties
Also compress some variable documentation.

Change-Id: I47d31e18df18492373aa407ea19f1a81b2cf5d57
2013-11-06 16:11:09 +00:00
Siebrand Mazeland ddc930e897 Ensure variables are defined
Change-Id: Iab1d36b0162c1d7a91cdd80ac36bbf338e7df61d
2013-11-06 17:09:24 +01:00
jenkins-bot 14871447ee Merge "Adding some comments to explain what various classes are for." 2013-11-05 13:26:15 +00:00
kaldari 307b078ada Only allow throttling if object caching is enabled...
...otherwise it doesn't work.

This change add 2 checks for object caching, one for the filter
configuration interface, and one for the actual throttle checking.

Bug: 50894
Change-Id: I89ebcc6ff7d91d3a9ad8e744c0c4ff3e33e3b673
2013-10-31 14:59:26 -07:00
kaldari b165827b67 Adding some comments to explain what various classes are for.
Change-Id: Ic44342035bc277dfd75c1da06a3a1205e8c659a4
2013-10-24 15:11:08 -07:00
Siebrand Mazeland 632365e834 Create consistent return point
Change-Id: Iaca35d1d9e94c027b580ead8bec102d1f6306105
2013-10-15 14:27:10 +02:00
Siebrand Mazeland 84d5cd33a2 Remove unused local variables
Change-Id: If708a112ae6df070da19f52682f0e2b19fe67959
2013-10-14 21:39:35 +02:00
Siebrand Mazeland 563bf12331 Pass correct variable to closure
Corrects Change-Id I3d8ace509ec0a9471cc68be3398bb1c108d6e570.

Change-Id: I5937aef91710e48c5417cff55f824ae67825097d
2013-10-14 21:39:05 +02:00
Brad Jorsch 0ef6f6dcce Reset $wgTitle in AbuseFilter::filterAction()
If AbuseFilter::filterAction changed $wgTitle, we need to reset it back
to the old value before returning.

And for good measure, we also need to check the main RequestContext to
make sure it didn't cache the bogus $wgTitle on us.

Bug: 53498
Change-Id: I4d706a1ee07f0b171f98e7d558d7be27e6759614
2013-09-30 14:37:52 -04:00
Aaron Schulz 5c322d6f31 Fixed "A BAD KEY WAS PROVIDED/CHARACTERS OUT OF RANGE" memcached errors
Change-Id: I27b51a4baec34475513407b604cf4c5fcd561cc9
2013-09-17 16:52:19 -07:00
jenkins-bot 74f8ecc379 Merge "Push counter updates to transaction end to avoid contention" 2013-08-30 22:35:35 +00:00
Aaron Schulz a951290cb7 Push counter updates to transaction end to avoid contention
Change-Id: I3d8ace509ec0a9471cc68be3398bb1c108d6e570
2013-08-28 14:31:08 -07:00
Yuki Shira a84e56bd39 Give grep a chance to find the usages
Change-Id: I65fbf2b7cd8d03c669646607e3841eb7d69b4e75
2013-08-18 15:35:16 +09:00
jenkins-bot 963655c81e Merge "New variable: new_pst which provides a PSTed version of new_wikitext" 2013-08-08 08:01:47 +00:00
Marius Hoch fb40850d9e Make sure a session has been started prior to using it
Thanks Anomie for pointing this out.

Change-Id: Ieaa9847e74c35e3080dabeaef8895209bfcc675b
2013-07-31 18:46:43 +02:00
Marius Hoch 4cb9a96ac9 Don't trigger filter hits for nonexisting filter 0
AbuseFilter::getConsequencesForFilters uses filter ids as
array keys, that causes problems if both local and global
filters were hit, because array_merge reindexes arrays.

Example:
https://www.mediawiki.org/wiki/Special:AbuseLog/18687

Change-Id: I81cb110322461e30113199cfa313cd8e8e8b2262
2013-07-09 13:57:22 +02:00
Marius Hoch 8957c003ba Revert "Change AbuseFilter to use UserCache instead of user_text fields"
This reverts commit aaa256aa94.

Bug: 49918
Change-Id: I597cbc03e2ecc45cfcca632232d5bbb1ef7be9d8
2013-06-27 01:01:15 +02:00
Marius Hoch 89726ae861 Allow filtering links and html for page creations
Right now it's impossible to filter added_links etc.
for page creations.

(Only slightly tested)

Change-Id: Iee07fc8bfe41e78abb73d8ae969aa1e4d97339bc
2013-06-05 03:52:29 +02:00
Marius Hoch a7aa0fa185 Fix AbuseFilter::disableConditionLimit()
Used for Special:AbuseFilter/test

Change-Id: I964efbbb0be7cae418746667778874790fdbb499
2013-05-28 00:43:33 +02:00