Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -1843,13 +1843,10 @@ |
1844 | 1844 | # FIXME: isAlwaysKnown() can be expensive for file links; we should really do |
1845 | 1845 | # batch file existence checks for NS_FILE and NS_MEDIA |
1846 | 1846 | if( $iw == '' && $nt->isAlwaysKnown() ) { |
1847 | | - # Need to add file links to parser output here or else they won't end up |
1848 | | - # in the pagelinks table later |
1849 | | - if( $ns == NS_FILE ) { |
1850 | | - $this->mOutput->addLink( $nt ); |
1851 | | - } |
| 1847 | + $this->mOutput->addLink( $nt ); |
1852 | 1848 | $s .= $this->makeKnownLinkHolder( $nt, $text, '', $trail, $prefix ); |
1853 | 1849 | } else { |
| 1850 | + # Links will be added to the output link list after checking |
1854 | 1851 | $s .= $holders->makeHolder( $nt, $text, '', $trail, $prefix ); |
1855 | 1852 | } |
1856 | 1853 | } |
Index: trunk/phase3/includes/parser/ParserOutput.php |
— | — | @@ -87,6 +87,14 @@ |
88 | 88 | function addLink( $title, $id = null ) { |
89 | 89 | $ns = $title->getNamespace(); |
90 | 90 | $dbk = $title->getDBkey(); |
| 91 | + if ( $ns == NS_MEDIA ) { |
| 92 | + // Normalize this pseudo-alias if it makes it down here... |
| 93 | + $ns = NS_FILE; |
| 94 | + } elseif( $ns == NS_SPECIAL ) { |
| 95 | + // We don't record Special: links currently |
| 96 | + // It might actually be wise to, but we'd need to do some normalization. |
| 97 | + return; |
| 98 | + } |
91 | 99 | if ( !isset( $this->mLinks[$ns] ) ) { |
92 | 100 | $this->mLinks[$ns] = array(); |
93 | 101 | } |