r67993 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67992‎ | r67993 | r67994 >
Date:13:22, 14 June 2010
Author:thomasv
Status:ok
Tags:
Comment:
patch for bug 22981 : pass cached links to the extension hook too.
Modified paths:
  • /trunk/phase3/includes/parser/LinkHolderArray.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/LinkHolderArray.php
@@ -144,6 +144,8 @@
145145 # Sort by namespace
146146 ksort( $this->internals );
147147
 148+ $linkcolour_ids = array();
 149+
148150 # Generate query
149151 $query = false;
150152 $current = null;
@@ -165,6 +167,7 @@
166168 } elseif ( ( $id = $linkCache->getGoodLinkID( $pdbk ) ) != 0 ) {
167169 $colours[$pdbk] = $sk->getLinkColour( $title, $threshold );
168170 $output->addLink( $title, $id );
 171+ $linkcolour_ids[$id] = $pdbk;
169172 } elseif ( $linkCache->isBadLink( $pdbk ) ) {
170173 $colours[$pdbk] = 'new';
171174 } else {
@@ -191,7 +194,6 @@
192195
193196 # Fetch data and form into an associative array
194197 # non-existent = broken
195 - $linkcolour_ids = array();
196198 while ( $s = $dbr->fetchObject($res) ) {
197199 $title = Title::makeTitle( $s->page_namespace, $s->page_title );
198200 $pdbk = $title->getPrefixedDBkey();
@@ -205,6 +207,8 @@
206208 $linkcolour_ids[$s->page_id] = $pdbk;
207209 }
208210 unset( $res );
 211+ }
 212+ if ( count($linkcolour_ids) ) {
209213 //pass an array of page_ids to an extension
210214 wfRunHooks( 'GetLinkColours', array( $linkcolour_ids, &$colours ) );
211215 }

Status & tagging log