Page MenuHomePhabricator

Add contains_all function to abuse filter
Closed, ResolvedPublic

Description

Author: Prodego

Description:
A function similar to the existing contains_any function, but instead only returning true if all substrings are present, would be useful both for cleanliness of code, and from an efficiency standpoint (less normalization in some cases).

Instead of

norm(haystack) contains "needle1" &
norm(haystack) contains "needle2" &
norm(haystack) contains "needle3"

contains_all(haystack,"needle1","needle2","needle3")

[contains_any is basically the same situation, except with the &'s replaces with |s]

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:41 PM
bzimport added a project: AbuseFilter.
bzimport set Reference to bz19176.
bzimport added a subscriber: Unknown Object (MLST).

(Batch change)

These are low-priority miniprojects that I can mop up at some point when I'm doing general code work as opposed to working on a specific projects.

[Batch change]

Removing Dave McCabe from CC, who I somehow managed to add to the CC list of 12 bugs assigned to me.

Daimona subscribed.

This isn't hard to do, I'm working on it and I'll send a commit in a few days.

Change 391065 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Add contains_all function

https://gerrit.wikimedia.org/r/391065

Change 391065 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Add contains_all and ccnorm_contains_all functions

https://gerrit.wikimedia.org/r/391065

Hi, 2 requests: It looks like this new feature needs to be documented at
https://www.mediawiki.org/wiki/Extension:AbuseFilter/Rules_format

Please could you also help us to write the short explanation of this feature, for Tech/News? If I understand correctly, this might be clear and accurate?

The abuse filter extension has a new feature contains_all that will improve the efficiency and readability of some filters. [link to help page]

(I'm freezing next week's edition soon, so it will likely appear the week after that.) Thanks.

@Quiddity Right, I'll write the docs as soon as possible. I don't know how much details should be included in tech/news (I only wrote there once), but a relatively simple explaination could be:

The abuse filter extension has a new feature contains_all that you may use to check if one or more strings are all contained in another given string.

Please let me know if something else should be done.

matej_suchanek removed a project: Patch-For-Review.
matej_suchanek updated the task description. (Show Details)
matej_suchanek removed a subscriber: wikibugs-l-list.