(bug 9575) Accept upload description from GET parameters
[lhc/web/wiklou.git] / includes / SpecialMostcategories.php
index c0d662c..589b96e 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 /**
- * @package MediaWiki
- * @subpackage SpecialPage
+ * @addtogroup SpecialPage
  *
  * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
  * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
@@ -9,8 +8,8 @@
  */
 
 /**
- * @package MediaWiki
- * @subpackage SpecialPage
+ * implements Special:Mostcategories
+ * @addtogroup SpecialPage
  */
 class MostcategoriesPage extends QueryPage {
 
@@ -19,8 +18,8 @@ class MostcategoriesPage extends QueryPage {
        function isSyndicated() { return false; }
 
        function getSQL() {
-               $dbr =& wfGetDB( DB_SLAVE );
-               extract( $dbr->tableNames( 'categorylinks', 'page' ) );
+               $dbr = wfGetDB( DB_SLAVE );
+               list( $categorylinks, $page) = $dbr->tableNamesN( 'categorylinks', 'page' );
                return
                        "
                        SELECT
@@ -37,20 +36,12 @@ class MostcategoriesPage extends QueryPage {
        }
 
        function formatResult( $skin, $result ) {
-               global $wgContLang, $wgLang;
-
-               $nt = Title::makeTitle( $result->namespace, $result->title );
-               $text = $wgContLang->convert( $nt->getPrefixedText() );
-
-               $plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text );
-
-               $nl = wfMsgExt( 'ncategories', array( 'parsemag', 'escape' ),
-                       $wgLang->formatNum( $result->value ) );
-
-               $nlink = $skin->makeKnownLink( $wgContLang->specialPage( 'Categories' ),
-                       $nl, 'article=' . $nt->getPrefixedURL() );
-
-               return wfSpecialList($plink, $nlink);
+               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() );
+               return wfSpecialList( $link, $count );
        }
 }
 
@@ -65,4 +56,4 @@ function wfSpecialMostcategories() {
        $wpp->doQuery( $offset, $limit );
 }
 
-?>
+