r9310 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r9309‎ | r9310 | r9311 >
Date:05:46, 3 June 2005
Author:vibber
Status:old
Tags:
Comment:
* (bug 2130) Fixed interwiki links with fragments
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -140,7 +140,10 @@
141141 $this->mStripState = array();
142142 $this->mArgStack = array();
143143 $this->mInPre = false;
144 - $this->mInterwikiLinkHolders = array();
 144+ $this->mInterwikiLinkHolders = array(
 145+ 'texts' => array(),
 146+ 'titles' => array()
 147+ );
145148 $this->mLinkHolders = array(
146149 'namespaces' => array(),
147150 'dbkeys' => array(),
@@ -1423,8 +1426,8 @@
14241427 list( $inside, $trail ) = Linker::splitTrail( $trail );
14251428
14261429 if ( $nt->isExternal() ) {
1427 - $iwRecord = array( $nt->getPrefixedDBkey(), $prefix.$text.$inside );
1428 - $nr = array_push($this->mInterwikiLinkHolders, $iwRecord);
 1430+ $nr = array_push( $this->mInterwikiLinkHolders['texts'], $prefix.$text.$inside );
 1431+ $this->mInterwikiLinkHolders['titles'][] =& $nt;
14291432 $retVal = '<!--IWLINK '. ($nr-1) ."-->{$trail}";
14301433 } else {
14311434 $nr = array_push( $this->mLinkHolders['namespaces'], $nt->getNamespace() );
@@ -2481,7 +2484,7 @@
24822485 "\$this->mLinkHolders['texts'][\$1]",
24832486 $canonized_headline );
24842487 $canonized_headline = preg_replace( '/<!--IWLINK ([0-9]*)-->/e',
2485 - "\$this->mInterwikiLinkHolders[\$1][1]",
 2488+ "\$this->mInterwikiLinkHolders['texts'][\$1]",
24862489 $canonized_headline );
24872490
24882491 # strip out HTML
@@ -2985,13 +2988,13 @@
29862989
29872990 # Now process interwiki link holders
29882991 # This is quite a bit simpler than internal links
2989 - if ( !empty( $this->mInterwikiLinkHolders ) ) {
 2992+ if ( !empty( $this->mInterwikiLinkHolders['texts'] ) ) {
29902993 wfProfileIn( $fname.'-interwiki' );
29912994 # Make interwiki link HTML
29922995 $wgOutputReplace = array();
2993 - foreach( $this->mInterwikiLinkHolders as $i => $lh ) {
2994 - $s = $sk->makeLink( $lh[0], $lh[1] );
2995 - $wgOutputReplace[] = $s;
 2996+ foreach( $this->mInterwikiLinkHolders['texts'] as $key => $link ) {
 2997+ $title = $this->mInterwikiLinkHolders['titles'][$key];
 2998+ $wgOutputReplace[$key] = $sk->makeLinkObj( $title, $link );
29962999 }
29973000
29983001 $text = preg_replace_callback(
@@ -3040,8 +3043,8 @@
30413044 return $this->mLinkHolders['texts'][$key];
30423045 }
30433046 } elseif( $type == 'IWLINK' ) {
3044 - if( isset( $this->mInterwikiLinkHolders[$key][1] ) ) {
3045 - return $this->mInterwikiLinkHolders[$key][1];
 3047+ if( isset( $this->mInterwikiLinkHolders['texts'][$key] ) ) {
 3048+ return $this->mInterwikiLinkHolders['texts'][$key];
30463049 }
30473050 }
30483051 return $matches[0];
Index: trunk/phase3/RELEASE-NOTES
@@ -238,6 +238,7 @@
239239 * (bug 2274) Respect stub threshold in category page list
240240 * (bug 2173) Fatal error when removing an article with an empty title from the watchlist
241241 * Removed -f parameter from mail() usage, likely to cause failures and bounces.
 242+* (bug 2130) Fixed interwiki links with fragments
242243
243244
244245 === Caveats ===

Follow-up revisions

RevisionCommit summaryAuthorDate
r41507Reverting r41410 -- broke interwikis totally in parser tests....brion16:59, 1 October 2008

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r9308Add test for bug 2130vibber22:39, 2 June 2005

Status & tagging log