Extension:AbuseFilter/Rules format/tr

Kurallar, C/Java/Perl benzeri bir dilde koşullara benzer şekilde biçimlendirilmiştir.

Dizeler
Tek veya çift tırnak içine yerleştirerek (dizeler için) veya olduğu gibi yazarak (sayılar için hem kayan nokta hem de tamsayı) bir değişmez belirtebilirsiniz. ile satır sonu,  ile sekme karakterleri alabilir ve ayrıca bir ters eğik çizgi ile tırnak karakterinden kaçabilirsiniz.

(artı) sembolünü birleştirme iki değişmez dize veya bir dizeyle iki değişken için kullanın.


 * Örnekler:

Kullanıcı tanımlı değişkenler
Bir koşul içinde bir satırda ( ile kapatılmış)   atama simgesiyle anlaşılması kolay olacak özel değişkenler tanımlayabilirsiniz. Bu tür değişkenler harf, alt çizgi ve sayı (ilk karakter dışında) kullanabilir ve büyük/küçük harfe duyarlı değildir. Örnek (w:Special:AbuseFilter/79):

Diziler
AbuseFilter, aşağıdaki örneklerde olduğu gibi kullanılabilen ilişkisel olmayan dizileri destekler.

Yorumlar
Aşağıdaki sözdizimini kullanarak yorumları belirtebilirsiniz: /* Bu bir yorum */

Aritmetik
Aşağıdaki sözdizimi ile değişkenler ve değişmezler üzerinde aritmetik yapmak için temel aritmetik sembolleri kullanabilirsiniz:


 * — Sağ-el işleneni sol-el işlenenden çıkar.
 * — Sağ-el işleneni sol-el işlenene ekleyin.
 * — Sol el operandını sağ taraf operandıyla çarpın.
 * — Soldaki işleneni sağ el işlenene bölün.
 * — Sol-el işleneni sağ-el işleneni tarafından belirtilen üssel kuvvete yükseltin.
 * — Soldaki işlenen sağ taraftaki işlenene bölündüğünde verilen kalanı döndür.

Döndürülen sonucun türü, PHP tarafından döndürülecek olanla aynıdır ve bunun için birçok belge çevrimiçi bulunabilir. Bu AF ayrıştırıcı testinde daha kapsamlı örnekler bulunabilir.

Boole işletmeleri
Sadece ve ancak birkaç koşulun tümü true ise, birkaç koşuldan biri true ise veya tüm koşullardan biri ve yalnızca biri true ise eşleşebilirsiniz.


 * &mdash; OR – koşullardan biri veya daha fazlası true ise true döndürür.
 * &mdash; AND – returns true if both of the conditions are true.
 * &mdash; XOR – returns true if one, and only one of the two conditions is true.
 * &mdash; NOT – returns true if the condition is not true.

Examples

Simple comparisons
You can compare variables with other variables and literals with the following syntax:


 * &mdash; Return true if the left-hand operand is less than/greater than the right-hand operand respectively. Watch out: operands are casted to strings and, like it happens in PHP,  and.
 * &mdash; Return true if the left-hand operand is less than or equal to/greater than or equal to the right-hand operand respectively. Watch out: operands are casted to strings and, like it happens in PHP,  and.
 * (or ),   &mdash; Return true if the left-hand operand is equal to/not equal to the right-hand operand respectively.
 * &mdash; Return true if the left-hand operand is equal to/not equal to the right-hand operand AND the left-hand operand is the same/not the same data type to the right-hand operand respectively.

Built-in variables
The abuse filter passes various variables by name into the parser. These variables can be accessed by typing their name in, in a place where a literal would work. You can view the variables associated with each request in the abuse log.

Performance
As noted in the table above, some of these variables can be very slow. While writing filters, remember that the condition limit is not a good metric of how heavy filters are. For instance, variables like  or   always need a DB query to be computed, while   variables will have to perform parsing of the text, which again is a heavy operation; all these variables should be used very, very carefully. For instance, on Italian Wikipedia it's been observed that, with 135 active filters and an average of 450 used conditions, filters execution time was around 500ms, with peaks reaching 15 seconds. Removing the  variable from a single filter, and halving the cases when another filter would use   brought the average execution time to 50ms. More specifically:

Last but not least, note that whenever a variable is computed for a given filter, it'll be saved and any other filter will immediately retrieve it. This means that one single filter computing this variable counts more or less as dozens of filters using it.
 * Use  variables when you need high accuracy and checking for "http://..." in other variables (for instance,  ) could lead to heavy malfunctioning;
 * Use  variables when you're really sure that non-PST variables aren't enough. You may also conditionally decide which one to check: if, for instance, you want to examine a signature, check first if   contains  ;
 * In general, when dealing with these variables, it's always much better to consume further conditions but avoid computing heavy stuff. In order to achieve this, always put heavy variables as last conditions.

Keywords
The following special keywords are included for often-used functionality:


 * (or ) returns true if the left-hand operand matches the glob pattern in the right-hand operand.
 * returns true if the right-hand operand (a string) contains the left-hand operand. Note: empty strings are not contained in, nor contain, any other string (not even the empty string itself).
 * works like, but with the left and right-hand operands switched. Note: empty strings are not contained in, nor contain, any other string (not even the empty string itself).
 * (or ) and   return true if the left-hand operand matches (contains) the regex pattern in the right-hand operand (  is case insensitive).

The system uses PCRE. The only PCRE option enabled is  (modifier   in PHP); for   both   and   are enabled (modifier  ).



Examples

Functions
A number of built-in functions are included to ease some common issues. They are executed in the general format, and can be used in place of any literal or variable. Its arguments can be given as literals, variables, or even other functions.

Order of operations
Operations are generally done left-to-right, but there is an order to which they are resolved. As soon as the filter fails one of the conditions, it will stop checking the rest of them (due to short-circuit evaluation) and move on to the next filter. The evaluation order is:


 * 1) Anything surrounded by parentheses (  and  ) is evaluated as a single unit.
 * 2) Turning variables/literals into their respective data. (e.g.,   to 0)
 * 3) Function calls (,  , etc.)
 * 4) Unary   and   (defining positive or negative value, e.g. ,  )
 * 5) Keywords (,  , etc.)
 * 6) Boolean inversion
 * 7) Exponentiation
 * 8) Multiplication-related (multiplication, division, modulo)
 * 9) Addition and subtraction
 * 10) Comparisons.
 * 11) Boolean operations.

Examples

 * is equivalent to, not to  . In particular, both   and   evaluates to.
 * is equivalent to, not to  . In particular, both   and   evaluates to.

Condition counting
The condition limit is (more or less) tracking the number of comparison operators + number of function calls entered.

Further explanation on how to reduce conditions used can be found at.

Exclusions
Although the AbuseFilter examine function will identify "rollback" actions as edits, the AbuseFilter will not evaluate rollback actions for matching.

Useful links

 * PCRE pattern syntax
 * Edit filters benefiting to various local Wikiprojects