Partially fix #15528. Use Linker::link() from r40496 to deal with invalid
authorAntoine Musso <hashar@users.mediawiki.org>
Mon, 8 Sep 2008 22:08:39 +0000 (22:08 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Mon, 8 Sep 2008 22:08:39 +0000 (22:08 +0000)
titles that might be present in database.

includes/specials/SpecialDisambiguations.php
includes/specials/SpecialMostcategories.php
includes/specials/SpecialMostlinkedtemplates.php

index 3404566..a29111c 100644 (file)
@@ -87,10 +87,10 @@ class DisambiguationsPage extends PageQueryPage {
                $title = Title::newFromId( $result->value );
                $dp = Title::makeTitle( $result->namespace, $result->title );
 
-               $from = $skin->makeKnownLinkObj( $title, '' );
-               $edit = $skin->makeKnownLinkObj( $title, "(".wfMsgHtml("qbedit").")" , 'redirect=no&action=edit' );
+               $from = $skin->link( $title );
+               $edit = $skin->link( $title, "(".wfMsgHtml("qbedit").")", array(), array( 'redirect' => 'no', 'action' => 'edit' ) );
                $arr  = $wgContLang->getArrow();
-               $to   = $skin->makeKnownLinkObj( $dp, '' );
+               $to   = $skin->link( $dp );
 
                return "$from $edit $arr $to";
        }
index e681099..1ba0562 100644 (file)
@@ -39,9 +39,9 @@ class MostcategoriesPage extends QueryPage {
        function formatResult( $skin, $result ) {
                global $wgLang;
                $title = Title::makeTitleSafe( $result->namespace, $result->title );
-               if ( !$title instanceof Title ) { throw new MWException('Invalid title in database'); }
+
                $count = wfMsgExt( 'ncategories', array( 'parsemag', 'escape' ), $wgLang->formatNum( $result->value ) );
-               $link = $skin->makeKnownLinkObj( $title, $title->getText() );
+               $link = $skin->link( $title );
                return wfSpecialList( $link, $count );
        }
 }
index d597a4e..2d398a3 100644 (file)
@@ -92,15 +92,12 @@ class SpecialMostlinkedtemplates extends QueryPage {
         */
        public function formatResult( $skin, $result ) {
                $title = Title::makeTitleSafe( $result->namespace, $result->title );
-               if( $title instanceof Title ) {
-                       return wfSpecialList(
-                               $skin->makeLinkObj( $title ),
-                               $this->makeWlhLink( $title, $skin, $result )
-                       );
-               } else {
-                       $tsafe = htmlspecialchars( $result->title );
-                       return "Invalid title in result set; {$tsafe}";
-               }
+
+               $skin->link( $title );
+               return wfSpecialList(
+                       $skin->makeLinkObj( $title ),
+                       $this->makeWlhLink( $title, $skin, $result )
+               );
        }
 
        /**
@@ -115,8 +112,8 @@ class SpecialMostlinkedtemplates extends QueryPage {
                global $wgLang;
                $wlh = SpecialPage::getTitleFor( 'Whatlinkshere' );
                $label = wfMsgExt( 'nlinks', array( 'parsemag', 'escape' ),
-                       $wgLang->formatNum( $result->value ) );
-               return $skin->makeKnownLinkObj( $wlh, $label, 'target=' . $title->getPrefixedUrl() );
+               $wgLang->formatNum( $result->value ) );
+               return $skin->link( $wlh, $label, array(), array( 'target' => $title->getPrefixedText() ) );
        }
 }