(bug 5812) Use appropriate link colour in Special:Mostlinked
authorRob Church <robchurch@users.mediawiki.org>
Wed, 3 May 2006 14:50:16 +0000 (14:50 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Wed, 3 May 2006 14:50:16 +0000 (14:50 +0000)
RELEASE-NOTES
includes/SpecialMostlinked.php

index 35070ad..09ad397 100644 (file)
@@ -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 <li>,<dd>,<dt>)
+* (bug 5497) Regression in HTML normalization in 1.6 (unclosed <li>,<dd>,<dt>)
 * (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 ==
 
index 88a85a5..9f26a34 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * A special page to show pages ordered by the number of pages linking to them
  *
@@ -6,7 +7,9 @@
  * @subpackage SpecialPage
  *
  * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
+ * @author Rob Church <robchur@gmail.com>
  * @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 );
        }
 }