Record a link to pages looked up by ID

If mw.title.new is called with a page ID, record a link to it.

Change-Id: Idc5327d21b780ff8242367878102034413663643
This commit is contained in:
Jackmcbarn 2014-12-11 16:08:37 -05:00
parent ce5ac6611d
commit 15203e9b72

View file

@ -150,6 +150,11 @@ class Scribunto_LuaTitleLibrary extends Scribunto_LuaLibraryBase {
$this->incrementExpensiveFunctionCount(); $this->incrementExpensiveFunctionCount();
$title = Title::newFromID( $text_or_id ); $title = Title::newFromID( $text_or_id );
$this->idCache[$text_or_id] = $title; $this->idCache[$text_or_id] = $title;
// Record a link
if ( $this->getParser() && $title && !$title->equals( $this->getTitle() ) ) {
$this->getParser()->getOutput()->addLink( $title );
}
} }
if ( $title ) { if ( $title ) {
$this->titleCache[$title->getPrefixedDBkey()] = $title; $this->titleCache[$title->getPrefixedDBkey()] = $title;