r5361 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r5360‎ | r5361 | r5362 >
Date:17:57, 21 September 2004
Author:jeluf
Status:old
Tags:
Comment:
Instead of storing entire link attributes in wikitext for
deleayed link colouring, store pointer to an entry in array wgLinkHolders. Fixes BUG#493 and should
be faster.


Forgot to submit this this morning. Sorry!!
Modified paths:
  • /trunk/phase3/includes/Skin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Skin.php
@@ -53,6 +53,15 @@
5454
5555 require_once( 'RecentChange.php' );
5656
 57+global $wgLinkHolders;
 58+$wgLinkHolders = array(
 59+ 'namespaces' => array(),
 60+ 'dbkeys' => array(),
 61+ 'queries' => array(),
 62+ 'texts' => array(),
 63+ 'titles' => array()
 64+);
 65+
5766 /**
5867 * @todo document
5968 * @package MediaWiki
@@ -1497,7 +1506,7 @@
14981507 * Pass a title object, not a title string
14991508 */
15001509 function makeLinkObj( &$nt, $text= '', $query = '', $trail = '', $prefix = '' ) {
1501 - global $wgOut, $wgUser;
 1510+ global $wgOut, $wgUser, $wgLinkHolders;
15021511 $fname = 'Skin::makeLinkObj';
15031512
15041513 # Fail gracefully
@@ -1534,8 +1543,13 @@
15351544 }
15361545
15371546 # Allows wiki to bypass using linkcache, see OutputPage::parseLinkHolders()
1538 - $retVal = '<!--LINK ' . implode( ' ', array( $nt->getNamespace(), $nt->getDBkey(),
1539 - $query, $prefix . $text . $inside ) ) . "-->{$trail}";
 1547+ $nr = array_push( $wgLinkHolders['namespaces'], $nt->getNamespace() );
 1548+ $wgLinkHolders['dbkeys'][] = $nt->getDBkey();
 1549+ $wgLinkHolders['queries'][] = $query;
 1550+ $wgLinkHolders['texts'][] = $prefix.$text.$inside;
 1551+ $wgLinkHolders['titles'][] = $nt;
 1552+
 1553+ $retVal = '<!--LINK '. ($nr-1) ."-->{$trail}";
15401554 } else {
15411555 # Work out link colour immediately
15421556 $aid = $nt->getArticleID() ;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r5337Instead of storing entire link attributes in wikitext for...jeluf23:02, 20 September 2004

Status & tagging log