# FIXME: isAlwaysKnown() can be expensive for file links; we should really do
# batch file existence checks for NS_FILE and NS_MEDIA
if( $iw == '' && $nt->isAlwaysKnown() ) {
- # Need to add file links to parser output here or else they won't end up
- # in the pagelinks table later
- if( $ns == NS_FILE ) {
- $this->mOutput->addLink( $nt );
- }
+ $this->mOutput->addLink( $nt );
$s .= $this->makeKnownLinkHolder( $nt, $text, '', $trail, $prefix );
} else {
+ # Links will be added to the output link list after checking
$s .= $holders->makeHolder( $nt, $text, '', $trail, $prefix );
}
}
function addLink( $title, $id = null ) {
$ns = $title->getNamespace();
$dbk = $title->getDBkey();
+ if ( $ns == NS_MEDIA ) {
+ // Normalize this pseudo-alias if it makes it down here...
+ $ns = NS_FILE;
+ } elseif( $ns == NS_SPECIAL ) {
+ // We don't record Special: links currently
+ // It might actually be wise to, but we'd need to do some normalization.
+ return;
+ }
if ( !isset( $this->mLinks[$ns] ) ) {
$this->mLinks[$ns] = array();
}