From a1d810ee7e8cc697065bfb9682bbe71bc7dbd35c Mon Sep 17 00:00:00 2001 From: ThomasV Date: Mon, 14 Jun 2010 13:22:21 +0000 Subject: [PATCH] patch for bug 22981 : pass cached links to the extension hook too. --- includes/parser/LinkHolderArray.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/parser/LinkHolderArray.php b/includes/parser/LinkHolderArray.php index 17cffe86a6..37c1387c5a 100644 --- a/includes/parser/LinkHolderArray.php +++ b/includes/parser/LinkHolderArray.php @@ -144,6 +144,8 @@ class LinkHolderArray { # Sort by namespace ksort( $this->internals ); + $linkcolour_ids = array(); + # Generate query $query = false; $current = null; @@ -165,6 +167,7 @@ class LinkHolderArray { } elseif ( ( $id = $linkCache->getGoodLinkID( $pdbk ) ) != 0 ) { $colours[$pdbk] = $sk->getLinkColour( $title, $threshold ); $output->addLink( $title, $id ); + $linkcolour_ids[$id] = $pdbk; } elseif ( $linkCache->isBadLink( $pdbk ) ) { $colours[$pdbk] = 'new'; } else { @@ -191,7 +194,6 @@ class LinkHolderArray { # Fetch data and form into an associative array # non-existent = broken - $linkcolour_ids = array(); while ( $s = $dbr->fetchObject($res) ) { $title = Title::makeTitle( $s->page_namespace, $s->page_title ); $pdbk = $title->getPrefixedDBkey(); @@ -205,6 +207,8 @@ class LinkHolderArray { $linkcolour_ids[$s->page_id] = $pdbk; } unset( $res ); + } + if ( count($linkcolour_ids) ) { //pass an array of page_ids to an extension wfRunHooks( 'GetLinkColours', array( $linkcolour_ids, &$colours ) ); } -- 2.20.1