Page MenuHomePhabricator

AbuseFilter-contentToString hook help?
Open, Needs TriagePublic

Description

After doing research, I believe the "AbuseFilter-content-To-String" is the hook method required for third party extensions to allow enforcement of abusefilters. I am having difficulty as to what the actual detailed explanation of what this method would be used for and how to implement it? The master hook documentation is lacking detail and explanation.

My goal is to allow WikiForums and MediaWikiChat to utilize and allow enforcement of filters. Currently neither extensions actually enforce filters, already tested on MediaWiki 1.32.

Event Timeline

@SpookyGhost8 what do you mean with "enforcements of abusefilters"? The contentToString hook is used to change how AF converts a content object to a string, which happens before trying to filter the edit. At the moment it's only used by Wikibase for entities. If you explain in detail what you'd like to do with WikiForums and MediaWikiChat, I'll be glad to help you.

"enforcement of abusefilters", I mean to actually filter new threads/replies to WikiForum or new comments in MediaWikiChat.

The main purposes would be:

  1. to allow a bad word filter for WikiForums and MediaWikiChat
  2. rate limiting filter for WikiForums

1 could be solved by abusefilter, a mediawiki page, or a configuration variable; a mediawiki page would just defeat the purpose.
2 could be solved by abusefilter or a rate limiting configuration change.

This way there would not be a need for a chatbot since MediaWikiChat currently covers all other functions of such a bot.

@SpookyGhost8 so you mean to filter edits coming from either WikiForum or MediaWikiChat? Unfortunately I have no knowledge of those extensions. I can tell you that you need the contentToString hook if such extensions represent Contents in a peculiar way, and you may also need to add an entry in wgAbuseFilterValidGroups. Then, you'll probably need to add specific variables using onAbuseFilterBuilder and maybe onAbuseFilterComputeVariable hooks. Probably someone else could give you a more exhaustive explanation. You may also check Flow code to see how it implements AbuseFilter.