24 protected $blacklist = [
'\b01bags\.com\b',
'sytes\.net' ];
40 [
'https://example.com' ],
43 'revision with spam, with additional non-spam' => [
44 [
'https://foo.com',
'http://01bags.com',
'http://bar.com' ],
48 'revision with spam using full width stop normalization' => [
49 [
'http://01bags.com' ],
53 'revision with domain blacklisted as spam, but subdomain whitelisted' => [
54 [
'http://a5b.sytes.net' ],
63 public function testSpam( $links, $expected ) {
64 $returnValue = $this->spamFilter->filter( $links, Title::newMainPage() );
65 $this->assertEquals( $expected, $returnValue );
78 \MessageCache::singleton()->enable();
79 $this->
insertPage(
'MediaWiki:Spam-blacklist', implode(
"\n", $this->blacklist ) );
80 $this->
insertPage(
'MediaWiki:Spam-whitelist', implode(
"\n", $this->whitelist ) );
84 $reflProp = new \ReflectionProperty( $instance,
'regexes' );
85 $reflProp->setAccessible(
true );
86 $reflProp->setValue( $instance,
false );
90 \MessageCache::singleton()->disable();
static getInstance( $type)
Returns an instance of the given blacklist.
SpamBlacklist Database SpamBlacklist.
testSpam( $links, $expected)
spamProvider
array $whitelist
Spam whitelist regexes.
array $blacklist
Spam blacklist regexes.
SpamBlacklist $spamFilter
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))