r10664 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r10663‎ | r10664 | r10665 >
Date:13:47, 20 August 2005
Author:timstarling
Status:old
Tags:
Comment:
With the introduction of action=render, internal links may also contain http://, and so must be hardened against replacement by replaceExternalLinks in the same way as interwiki links.
Modified paths:
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -1456,28 +1456,21 @@
14571457 $s .= $prefix . $sk->makeKnownLinkObj( $nt, $text, '', $trail );
14581458 continue;
14591459 }
1460 - if( !$nt->isExternal() && $nt->isAlwaysKnown() ) {
1461 - /**
1462 - * Skip lookups for special pages and self-links.
1463 - * External interwiki links are not included here because
1464 - * the HTTP urls would break output in the next parse step;
1465 - * they will have placeholders kept.
1466 - */
1467 - $s .= $sk->makeKnownLinkObj( $nt, $text, '', $trail, $prefix );
1468 - } else {
1469 - /**
1470 - * Add a link placeholder
1471 - * Later, this will be replaced by a real link, after the existence or
1472 - * non-existence of all the links is known
1473 - */
1474 - $s .= $this->makeLinkHolder( $nt, $text, '', $trail, $prefix );
1475 - }
 1460+ $s .= $this->makeLinkHolder( $nt, $text, '', $trail, $prefix );
14761461 }
14771462 wfProfileOut( $fname );
14781463 return $s;
14791464 }
14801465
14811466 /**
 1467+ * Hardens some text possibly containing URLs against mangling by
 1468+ * replaceExternalLinks()
 1469+ */
 1470+ function hardenURLs( $text ) {
 1471+ return str_replace( 'http://', 'http-noparse://', $text );
 1472+ }
 1473+
 1474+ /**
14821475 * Make a link placeholder. The text returned can be later resolved to a real link with
14831476 * replaceLinkHolders(). This is done for two reasons: firstly to avoid further
14841477 * parsing of interwiki links, and secondly to allow all extistence checks and
@@ -3023,7 +3016,7 @@
30243017 $pdbk = $pdbks[$key] = $title->getPrefixedDBkey();
30253018
30263019 # Check if it's in the link cache already
3027 - if ( $wgLinkCache->getGoodLinkID( $pdbk ) ) {
 3020+ if ( $title->isAlwaysKnown() || $wgLinkCache->getGoodLinkID( $pdbk ) ) {
30283021 $colours[$pdbk] = 1;
30293022 } elseif ( $wgLinkCache->isBadLink( $pdbk ) ) {
30303023 $colours[$pdbk] = 0;

Status & tagging log