From: Rob Church Date: Wed, 3 May 2006 14:50:16 +0000 (+0000) Subject: (bug 5812) Use appropriate link colour in Special:Mostlinked X-Git-Tag: 1.31.0-rc.0~57259 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=f9a7e534647e26bcc79926087cddfd3b42d25518;p=lhc%2Fweb%2Fwiklou.git (bug 5812) Use appropriate link colour in Special:Mostlinked --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 35070ad712..09ad397f16 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -121,7 +121,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Remove useless whitespace from Special:Brokenredirects header * Treat "allmessagesnotsupporteddb" as wikitext when echoing; change default text -* (bug 5497) regeression in HTML normalization in 1.6 (unclosed
  • ,
    ,
    ) +* (bug 5497) Regression in HTML normalization in 1.6 (unclosed
  • ,
    ,
    ) * (bug 5709) Allow customisation of separator for categories * (bug 5684) Introduce Special:Randomredirect * (bug 5611) Add a name attribute to the text box containing source text in @@ -192,6 +192,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Silently ignore errors on profiling table update. * (bug 5801) Correct handling of underscores in Special:Listusers * Clean up Special:Listusers; add an "(all)" label to the group selection box +* (bug 5812) Use appropriate link colour in Special:Mostlinked == Compatibility == diff --git a/includes/SpecialMostlinked.php b/includes/SpecialMostlinked.php index 88a85a5cb0..9f26a34dbd 100644 --- a/includes/SpecialMostlinked.php +++ b/includes/SpecialMostlinked.php @@ -1,4 +1,5 @@ + * @author Rob Church * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason + * @copyright © 2006 Rob Church * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later */ @@ -41,24 +44,43 @@ class MostlinkedPage extends QueryPage { HAVING COUNT(*) > 1"; } - function formatResult( $skin, $result ) { - global $wgContLang; - - $nt = Title::makeTitle( $result->namespace, $result->title ); - $text = $wgContLang->convert( $nt->getPrefixedText() ); - - if ( $this->isCached() ) - $plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text ); - else { - $plink = is_null( $result->page_namespace ) - ? $skin->makeBrokenLink( $nt->getPrefixedText(), $text ) - : $skin->makeKnownLink( $nt->getPrefixedText(), $text ); + /** + * Pre-fill the link cache + */ + function preprocessResults( &$dbr, $res ) { + if( $dbr->numRows( $res ) > 0 ) { + $linkBatch = new LinkBatch(); + while( $row = $dbr->fetchObject( $res ) ) + $linkBatch->addObj( Title::makeTitleSafe( $row->namespace, $row->title ) ); + $dbr->dataSeek( $res, 0 ); + $linkBatch->execute(); } + } - $nl = wfMsg( 'nlinks', $result->value ); - $nlink = $skin->makeKnownLink( $wgContLang->specialPage( 'Whatlinkshere' ), $nl, 'target=' . $nt->getPrefixedURL() ); + /** + * Make a link to "what links here" for the specified title + * + * @param $title Title being queried + * @param $skin Skin to use + * @return string + */ + function makeWlhLink( &$title, $caption, &$skin ) { + $wlh = Title::makeTitle( NS_SPECIAL, 'Whatlinkshere' ); + return $skin->makeKnownLinkObj( $wlh, $caption, 'target=' . $title->getPrefixedUrl() ); + } - return wfSpecialList($plink, $nlink); + /** + * Make links to the page corresponding to the item, and the "what links here" page for it + * + * @param $skin Skin to be used + * @param $result Result row + * @return string + */ + function formatResult( $skin, $result ) { + $title = Title::makeTitleSafe( $result->namespace, $result->title ); + $link = $skin->makeLinkObj( $title ); + $wlh = $this->makeWlhLink( $title, wfMsgHtml( 'nlinks', $result->value ), $skin ); + return wfSpecialList( $link, $wlh ); } }