Bypass warming red link cache for wikitext requests

Wikitext editor doesn't need to know about redlinks
on the page, so this is a waste of time. If the user
switches to VE, they will do a fresh metadata request
at that point.

Change-Id: I57f3fe3fca47dde03bba7905f763abc8a43d0653
This commit is contained in:
Ed Sanders 2017-01-12 16:33:49 -08:00
parent a4543a7336
commit 3577035825

View file

@ -445,7 +445,11 @@ class ApiVisualEditor extends ApiBase {
// We do the lookup for the current version. This might not be entirely complete // We do the lookup for the current version. This might not be entirely complete
// if we're loading an oldid, but it'll probably be close enough, and LinkCache // if we're loading an oldid, but it'll probably be close enough, and LinkCache
// will automatically request any additional data it needs. // will automatically request any additional data it needs.
$links = []; // We only do this for visual edits, as the wikitext editor doesn't need to know
// about redlinks on the page. If the user switches to VE, they will do a fresh
// metadata request at that point.
$links = null;
if ( $params['paction'] !== 'wikitext' ) {
$wikipage = WikiPage::factory( $title ); $wikipage = WikiPage::factory( $title );
$popts = $wikipage->makeParserOptions( 'canonical' ); $popts = $wikipage->makeParserOptions( 'canonical' );
$cached = ParserCache::singleton()->get( $article, $popts, true ); $cached = ParserCache::singleton()->get( $article, $popts, true );
@ -474,6 +478,7 @@ class ApiVisualEditor extends ApiBase {
} elseif ( $links['known'] !== 1 ) { } elseif ( $links['known'] !== 1 ) {
$links['known'][] = $title->getPrefixedText(); $links['known'][] = $title->getPrefixedText();
} }
}
// On parser cache miss, just don't bother populating red link data // On parser cache miss, just don't bother populating red link data