Topic on Extension talk:AbuseFilter/Rules format

Alternatives to added_lines for new pages

9
Wedhro (talkcontribs)

I'm writing a basic anti-spam filter that checks added_lines but it seems to only work on edits of already existing pages, not for new pages, which have no diffs. Would new_text do the job? Any other alternative?

Ciencia Al Poder (talkcontribs)

added_lines works for new pages too. On page creation, added_lines and new_text are the same

Wedhro (talkcontribs)

I'm asking this because the spam filter prevented all edits including an URL except one, which was a newly created page.

Daimona Eaytoy (talkcontribs)

added_lines is likely not the cause. The variable is available for all edits, including new page creations. As an alternative, you may try new_wikitext (not new_text), but the result will be the same.

Wedhro (talkcontribs)

You're right, now I see where the problem is: there's a & !"://" in removed_lines to allow edits on already existing URLs so that only new URLs are prevented, but that doesn't work on new pages because they have no previous version without an URL. I have no idea how to make this work logic-wise, can you help me?

Daimona Eaytoy (talkcontribs)

If you want to catch the addition of new links exclusively, you can use added_links; but beware, that tends to be slowish. You'd better evaluate that variable only as the last condition of the filter (i.e. after user_groups checks etc.).

Wedhro (talkcontribs)

I thought about that but it's not very clear how it works, especially where it says "Only unique links are added to the array." Would a generic search for "https://" or such work, or does it only accept full URLs to specific websites?

Daimona Eaytoy (talkcontribs)

That means that every link only appears once. Being an array, you can use length() on that, or string manipulation functions.

Ciencia Al Poder (talkcontribs)

Oops, yes, I meant to say added_lines was the same as new_wikitext, not new_text

Reply to "Alternatives to added_lines for new pages"