mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/SpamBlacklist
synced 2024-11-23 22:54:57 +00:00
Fix Schema:ExternalLinksChange logging if no links are left on page
If there are no links left on the page, we would avoid invoking the spam blacklist filtering entirely, to avoid having to do blacklist lookups, etc. However, since we want link removal data, explicitly check for this scenario and mark all current links as removals, and avoid invoking the rest of the spam blacklist code. Bug: T115119 Change-Id: I0bcd5b55594e38c0508b21db2c45e5136123efa0
This commit is contained in:
parent
c0379a5a72
commit
2cac3f9ecd
|
@ -43,9 +43,6 @@ class SpamBlacklistHooks {
|
|||
if ( preg_match( '/\S(\.[^\s\d]{2,}|[\/@]\S)/', $summary ) ) {
|
||||
$links[] = $summary;
|
||||
}
|
||||
if ( !$links ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$spamObj = BaseBlacklist::getInstance( 'spam' );
|
||||
$matches = $spamObj->filter( $links, $title );
|
||||
|
|
|
@ -55,6 +55,16 @@ class SpamBlacklist extends BaseBlacklist {
|
|||
$statsd = MediaWikiServices::getInstance()->getStatsdDataFactory();
|
||||
$cache = ObjectCache::getLocalClusterInstance();
|
||||
|
||||
// If there are no new links, and we are logging,
|
||||
// mark all of the current links as being removed.
|
||||
if ( !$links && $this->isLoggingEnabled() ) {
|
||||
$this->logUrlChanges( $this->getCurrentLinks( $title ), [], [] );
|
||||
}
|
||||
|
||||
if ( !$links ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
sort( $links );
|
||||
$key = $cache->makeKey(
|
||||
'blacklist',
|
||||
|
|
Loading…
Reference in a new issue