Commit graph

35 commits

Author SHA1 Message Date
jeblad 68ecb6f985 (Bug 42064) Add a hook to AbuseFilter
The hook 'AbuseFilter-interceptVariable' can be used
for intercepting any request to recalculate a variable,
and if a handler is returning false the later code
will be skipped. That makes it possible to avoid using
content if the content model is wrong, as it could be
for a Wikibase entity.

The hook uses the same arguments as the hook
'AbuseFilter-computeVariable', thereby making it simple
to move handlers around.

The arguments to the hook are
@param string $method
@param AbuseFilterVariableHolder $vars
@param array $parameters
@param AFPData|array|int|mixed|null|string &$result

Patchset 2: Fix for arg 1 to the hook, it got $this
	instead of $this->mMethod

Change-Id: I4944ea612369d6f96319e24c96d97cf9739358c7
2012-12-19 10:13:31 +01:00
jeblad ae2c2f7e67 (Bug 42064) Change getText to getContent in AbuseFilter
Patchset 2: Handle more content types
Patchset 3: Change cover letter
Patchset 4: Make it b/c
Patchset 5: Refactor and use previous audience
Patchset 6: Fixed/ minor changes

Change-Id: Ib1d2f9803bc95bb9efd445e3778126d5c3090a71
2012-11-25 18:09:47 +01:00
Siebrand Mazeland 176227e721 Maintenance for AbuseFilter extension.
* Replace deprecated methods.
* Remove no longer needed function fnmatch().
* Remove superfluous newlines.
* Remove unused and redundant local variables and globals.
* Deglobalization.
* Update documentation.
* Fix incorrect return values or add FIXMEs when in doubt.
* Escape output in a few places where needed.
* Remove unneeded MEDIAWIKI constant checks.
* Fix various JSHint/JSLint issues.

Patch Set 11: Merged https://gerrit.wikimedia.org/r/24701 into
this one per Siebrand's request

Change-Id: I02ba4ce31b6aca5b7324114093f8ece143abc295
2012-10-09 22:26:45 +02:00
Reedy 3da992692c Add a few bits of method documentation
De-indent a line

Tidy up method returns

Change-Id: I7aa93072c80a16eb27b7f7ac3d2f030ea63ebf60
2012-06-21 14:32:05 +01:00
Sam Reed bea9cb0874 A LOT of function level documentation
Change-Id: I8b591be3c2da7cfb29d3be026772816d14037d37
2012-03-26 16:03:22 +02:00
Roan Kattouw 6c4bd57043 Revert r111217 (unreviewed rev in AbuseFilter) and its dependencies r113585, r113587, r113588, r113589.
All of these revisions are tagged with 'gerritmigration' and will be resubmitted into Gerrit after the Gerrit switchover. See also http://lists.wikimedia.org/pipermail/wikitech-l/2012-March/059124.html
2012-03-21 19:41:11 +00:00
Sam Reed 0c99b2bc15 A LOT of function level documentation 2012-03-11 20:40:04 +00:00
Sam Reed 857ae7c546 Bug 35156 - Harmonise spelling of getArticleID() and getArticleId()
Mass change ->getArticleId() to ->getArticleID()
2012-03-11 19:04:37 +00:00
Alexandre Emsenhuber 675e4c673a * (bug 29092) Removed usage of $wgArticle from AbuseFilter extension
Instead pass the Article object from the EditFilterMerged hook to the AFComputedVariable object and see whether the object is present to do a parse operation since other code paths won't pass an Article object

Also simplified the fallback code in AFComputedVariable::compute() to simply continue instead of calling the function again.
2011-11-09 08:36:26 +00:00
Sam Reed a9e738f099 More document
Few minor code improvements
2011-08-24 22:11:52 +00:00
Sam Reed 5050eefa57 Then do the swap to foreach properly 2011-02-11 11:42:19 +00:00
Sam Reed 9056e18882 Partial revert to r81905 2011-02-11 11:37:57 +00:00
Sam Reed 6b782a96dd while to foreach
Remove unused variables

Condense css
2011-02-10 17:25:25 +00:00
Roan Kattouw 802ea446a4 Revert 75677 for AbuseFilter, caused fatals 2011-02-08 15:33:02 +00:00
Sam Reed 272013d0f2 Conditionals in loops to foreachs 2010-10-29 21:30:20 +00:00
Jack Phoenix 5e0330c6cc AbuseFilter: coding style tweaks, changed some while loops to foreach (as per http://www.mediawiki.org/wiki/Manual:Coding_conventions#Assignment_expressions) and added __METHOD__ to one DB query 2010-08-19 21:12:09 +00:00
Siebrand Mazeland b274606879 Update code formatting, run stylize.php, whitespace updates 2010-02-13 14:10:36 +00:00
Jack Phoenix e2a16fe755 AbuseFilter: big commit - coding style & spacing cleanup; also marked SpecialPages' construct() and execute() functions as public and capitalized some SQL keywords 2009-10-07 13:57:06 +00:00
Andrew Garrett be3de66d4f Minor bugfixes to r51014 suggested on codereview by Tim. 2009-06-05 10:32:31 +00:00
Andrew Garrett 48bfcc35ee Various code quality fixes for AbuseFilter suggested by Tim Starling in a private email, including bugfixes, memory safeguards, performance improvements, removal of redundant code, consolidation of similar functionaality. 2009-05-26 13:08:15 +00:00
Tim Starling 268d72f43b Code formatting and comments. 2009-05-22 06:42:10 +00:00
Victor Vasiliev 27fb1303a8 * Use lists instead of implode()d strings in built-in variables wherever it's possible
ATTENTION! This may break filters that rely on "added_lines contains 'bla-bla'" syntax. They'll need to be replaced with "string(added_lines) contains 'bla-bla'"
2009-04-05 19:07:47 +00:00
Andrew Garrett 7c2a7a2fe0 Support for variable setting with the set_var function, and multiple expressions separated by semicolons (;). In evaluation, the result of the LAST expression will be the return value. 2009-04-01 06:53:18 +00:00
Andrew Garrett 14b850f891 Implementation of global filters, including a major i18n change for abusefilter-log-detailedentry message (rename and split). Needs further testing before deployment 2009-03-30 06:12:12 +00:00
Andrew Garrett 2000d06c59 Add hook to AFPComputedVariable::compute() so extensions can add lazy-loaded variables. 2009-03-25 05:18:27 +00:00
Andrew Garrett b28f614390 Backcompat for stored data 2009-03-19 03:10:18 +00:00
Andrew Garrett ce47bca4a8 Load link vars from DB on edit. Includes some tracking of context, so it knows whether to check the DB or the parser. 2009-03-19 02:05:58 +00:00
Andrew Garrett 667c566423 Add a diff, if applicable, below the var dump in abuse log details 2009-03-18 05:45:36 +00:00
Andrew Garrett d257820a83 Fix weird interaction of user age for anonymous users 2009-03-18 00:26:28 +00:00
Andrew Garrett 334582b645 Fix weird bug occurring in corrupted databases. 2009-03-16 08:21:24 +00:00
Andrew Garrett 145db0f341 load() user objects when retriving properties. Might help with some strange bugs we're seeing on testwiki but nowhere else 2009-03-10 23:28:18 +00:00
Andrew Garrett 02a84cbd90 Debugging code for bug 17815 2009-03-06 23:11:07 +00:00
Andrew Garrett ceb5261bb6 AbuseFilter -- precache article object for edits, fix lazy initialisation of IP user objects 2009-02-28 01:10:45 +00:00
Andrew Garrett 216fde8956 Some debugging code 2009-02-27 13:16:34 +00:00
Andrew Garrett b34f35ff40 svn add AbuseFilterVariableHolder.php 2009-02-27 00:03:30 +00:00