Use core's externallinks lookup

Depends-On: I8ae9ef388957b0c04efa281f3bc3b5796bec17fe
Bug: T326251
Change-Id: Ic326c6ba4476093cb62a8d1ce82da44c32b7d1e1
This commit is contained in:
Amir Sarabadani 2023-04-24 15:09:17 +02:00
parent ac817efa52
commit 1d8b60b7b9
2 changed files with 5 additions and 7 deletions

View file

@ -10,7 +10,7 @@
"type": "antispam",
"license-name": "GPL-2.0-or-later",
"requires": {
"MediaWiki": ">= 1.38.0"
"MediaWiki": ">= 1.41.0"
},
"GroupPermissions": {
"user": {

View file

@ -6,6 +6,7 @@ use ExtensionRegistry;
use LogPage;
use ManualLogEntry;
use MediaWiki\CheckUser\Hooks as CUHooks;
use MediaWiki\ExternalLinks\ExternalLinksLookup;
use MediaWiki\MediaWikiServices;
use ObjectCache;
use RequestContext;
@ -192,12 +193,9 @@ class SpamBlacklist extends BaseBlacklist {
static function ( $oldValue, &$ttl, array &$setOpts ) use ( $title, $fname ) {
$dbr = wfGetDB( DB_REPLICA );
$setOpts += Database::getCacheSetOptions( $dbr );
return $dbr->selectFieldValues(
'externallinks',
'el_to',
// should be zero queries
[ 'el_from' => $title->getArticleID() ],
return ExternalLinksLookup::getExternalLinksForPage(
$title->getArticleID(),
$dbr,
$fname
);
}