Improve support for read-new wikis with externallinks

Depends-On: I921728974cde0a095fb3034fc80f7f4bb046f380
Bug: T337149
Change-Id: I996f99acb2a0f26b177fff097406b1d935467f80
This commit is contained in:
Amir Sarabadani 2023-05-25 11:50:34 +02:00
parent d40ae3413a
commit 209db3647a

View file

@ -20,6 +20,7 @@ use MediaWiki\Extension\ConfirmEdit\CaptchaTriggers;
use MediaWiki\Extension\ConfirmEdit\Hooks\HookRunner; use MediaWiki\Extension\ConfirmEdit\Hooks\HookRunner;
use MediaWiki\Extension\ConfirmEdit\Store\CaptchaStore; use MediaWiki\Extension\ConfirmEdit\Store\CaptchaStore;
use MediaWiki\ExternalLinks\ExternalLinksLookup; use MediaWiki\ExternalLinks\ExternalLinksLookup;
use MediaWiki\ExternalLinks\LinkFilter;
use MediaWiki\MediaWikiServices; use MediaWiki\MediaWikiServices;
use MediaWiki\Request\ContentSecurityPolicy; use MediaWiki\Request\ContentSecurityPolicy;
use MediaWiki\Revision\RevisionAccessException; use MediaWiki\Revision\RevisionAccessException;
@ -672,7 +673,9 @@ class SimpleCaptcha {
// Share a parse operation with Article::doEdit() // Share a parse operation with Article::doEdit()
$editInfo = $page->prepareContentForEdit( $content, null, $user ); $editInfo = $page->prepareContentForEdit( $content, null, $user );
if ( $editInfo->output ) { if ( $editInfo->output ) {
$newLinks = array_keys( $editInfo->output->getExternalLinks() ); $newLinks = LinkFilter::getIndexedUrlsNonReversed(
array_keys( $editInfo->output->getExternalLinks() )
);
} else { } else {
$newLinks = []; $newLinks = [];
} }