Commit graph

30 commits

Author SHA1 Message Date
Andrew Garrett e60dee6cac Add an interface for extensions to add variables into the variable list (only for ones generated for filtering, for now). Includes an implementation in the TorBlock extension 2009-03-05 02:43:05 +00:00
Andrew Garrett 92698e95ba Improve AbuseFilter performance by implementing lazy initialisation of computed variables.
This has been done by replacing simple associative arrays with an AbuseFilterVariableHolder, which recognises helper classes called AFComputedVariables.
Computation may occur during the abuse filter analysis, or later when testing and reviewing filters.
2009-02-26 12:15:14 +00:00
Andrew Garrett 05ea5b783d Add rmwhitespace function 2009-02-18 19:42:01 +00:00
Andrew Garrett 32d676942d Remove remnants of ctype_, and replace them with appropriate regexes (which, while slower, are locale-safe). 2009-02-11 20:01:00 +00:00
Andrew Garrett 35e61feeb6 Abuse Filter Parser updates
* Deprecate parseTokens in favour of a parse-as-you-go approach, faster and uses less memory.
* Display variables in lower_case so they aren't SHOUTING_AT_PEOPLE.
* Tell people if they try to use variables that don't exist, rather than silently returning NULL.
2009-02-11 20:00:33 +00:00
Andrew Garrett 0880f444b1 Abuse Filter Parser updates:
* Use strcspn to scan ahead for long regions of uninteresting text in string handling (performance).
* Remove cruft specific to my system in phpTest.php.
* Remove a test that was in incorrect syntax, and useless without adding variable support.
2009-02-11 18:23:21 +00:00
Andrew Garrett bfe57be65d Rewrite of Abuse Filter parser tokeniser.
I've made it more performant and fixed a few bugs by using regexes
instead of PHP loops, where possible, under the assumption that the
PCRE parser is more efficient than the same thing implemented in pure PHP.
Also, I'm now passing the same string around and calculating offsets, which
Tim tells me is far more performant than continually truncating the same string.

All tests still pass, with the exception of string.t, which I've modified
to remove the offending code, which never worked.
2009-02-11 01:41:51 +00:00
Andrew Garrett 430c95a60d Make variable names and keywords case-insensitive. 2009-01-30 23:46:25 +00:00
Andrew Garrett 48748d8fa7 Fix use of instance methods in nextToken, which is a static method. 2009-01-27 04:09:53 +00:00
Andrew Garrett 11ab345814 Localise Abuse Filter exceptions. 2009-01-26 23:32:46 +00:00
Andrew Garrett d50a26f04d Explicit detection for division by zero. 2009-01-25 05:54:49 +00:00
Andrew Garrett 2d1056858d Fix up error message. 2009-01-25 05:41:58 +00:00
Andrew Garrett 7c210e7849 Typo 2009-01-25 05:34:27 +00:00
Andrew Garrett 7872822e86 Fix weird method of checking if any MulRel operations worked. 2009-01-25 05:25:33 +00:00
Andrew Garrett f3015ff2fd Fix notice in a corner case. 2009-01-23 23:59:42 +00:00
Andrew Garrett 53179c675f Apply changes from change-tagging branch. I will remove all of the stuff actually related to change tagging in a moment, to avoid trunk changes on Wikimedia sites. 2009-01-23 19:23:19 +00:00
Andrew Garrett d5b58edfbb Windows compatibility with PHP parser, fnmatch() function. 2008-10-27 02:24:35 +00:00
Andrew Garrett d0972206f3 Add forgotten rmspecials to funcNorm in PHP parser 2008-09-22 14:03:45 +00:00
Andrew Garrett 308867d25c Fix count function 2008-09-18 14:27:26 +00:00
Andrew Garrett 4fd43cdea9 Add basic functionality to delete filters (not really a deletion, just moved to another list) 2008-09-05 14:27:18 +00:00
Victor Vasiliev c8ea521424 PHP parser:
* Fix some notices
* Add if-then-else and ternary operator
* Fix ordering of operators
* Skip whitespace.t till test runner will be fixed
* Still lacks dates and correct Unicode string handling
2008-08-31 15:12:55 +00:00
Andrew Garrett 1f7effdd19 Fix a notice 2008-08-31 08:05:33 +00:00
Andrew Garrett fc0b18e2d6 PHP Parser:
* Re-add, per Brion's request.
* Add an easy PHP tester, to run the tests used for the native parser.
* Update to pass 20 tests out of 27. Still to go:
** Implement dates.
** Fix order of operations.
** Fix backslash parsing.
** Implement if-then-else and ternery operator.
2008-08-31 05:56:49 +00:00
Andrew Garrett fa02666551 Remove PHP parser. It's totally inconsistent with the native parser now, and updating it wouldn't really be worth it (seeing as the native one would be used on Wikimedia) 2008-08-16 07:41:46 +00:00
Andrew Garrett 016da694a6 Abuse Filter:
* Reimplement tools, starting with a spiffy AJAX expression tester. Didn't bother implementing as non-AJAX, as it's just an extra.
* Change exchange protocol between native parser and PHP app. Resulted in 2-3-fold performance boost.
* Fix minor bug from last night.
2008-08-04 14:27:48 +00:00
Brion Vibber ea40085dc8 fix parse error, stray executable bit 2008-08-04 05:33:06 +00:00
Andrew Garrett 529d7b4277 Abuse Filter:
* Introduce a syntax check on-save.
* Introduce filter history (requires DB schema change).
* Deprecate now non-working /tools interface (will come back).
2008-08-03 14:04:26 +00:00
Andrew Garrett cb65839e40 Fix more deprecated pass-by-reference syntax 2008-08-02 13:51:29 +00:00
Andrew Garrett d5ec855d5b Fix some erroneous deprecated pass-by-reference syntax 2008-08-02 13:45:08 +00:00
Andrew Garrett b283904b81 AbuseFilter native parser:
* Revert r38187 for now:
** Introduced a memory leak.
** Used an unnecessary library. The point is taken, and this will be fixed in a few days (using glibc instead).
* Fix logic error in boolean ops.
* Integrate with the PHP abuse filter using AbuseFilterParserNative class.
* Fix memory leak.
* Fix a few miscellaneous bugs
2008-07-31 16:28:24 +00:00