Revert r35848 per Brion's WONTFIX of bug 14536: "This would just mean that there...
[lhc/web/wiklou.git] / includes / SpecialMostlinkedtemplates.php
index 874cc23..b8d47e6 100644 (file)
@@ -1,10 +1,14 @@
 <?php
-
+/**
+ * @file
+ * @ingroup SpecialPage
+ */
 /**
  * Special page lists templates with a large number of
  * transclusion links, i.e. "most used" templates
  *
- * @addtogroup SpecialPage
+ * @ingroup SpecialPage
  * @author Rob Church <robchur@gmail.com>
  */
 class SpecialMostlinkedtemplates extends QueryPage {
@@ -17,7 +21,7 @@ class SpecialMostlinkedtemplates extends QueryPage {
        public function getName() {
                return 'Mostlinkedtemplates';
        }
-       
+
        /**
         * Is this report expensive, i.e should it be cached?
         *
@@ -26,7 +30,7 @@ class SpecialMostlinkedtemplates extends QueryPage {
        public function isExpensive() {
                return true;
        }
-       
+
        /**
         * Is there a feed available?
         *
@@ -44,7 +48,7 @@ class SpecialMostlinkedtemplates extends QueryPage {
        public function sortDescending() {
                return true;
        }
-       
+
        /**
         * Generate SQL for the report
         *
@@ -60,26 +64,25 @@ class SpecialMostlinkedtemplates extends QueryPage {
                        COUNT(*) AS value
                        FROM {$templatelinks}
                        WHERE tl_namespace = " . NS_TEMPLATE . "
-                       GROUP BY 1, 2, 3";                      
+                       GROUP BY 1, 2, 3";
        }
-       
+
        /**
         * Pre-cache page existence to speed up link generation
         *
         * @param Database $dbr Database connection
         * @param int $res Result pointer
         */
-       public function preprocessResults( $dbr, $res ) {
+       public function preprocessResults( $db, $res ) {
                $batch = new LinkBatch();
-               while( $row = $dbr->fetchObject( $res ) ) {
-                       $title = Title::makeTitleSafe( $row->namespace, $row->title );
-                       $batch->addObj( $title );
+               while( $row = $db->fetchObject( $res ) ) {
+                       $batch->add( $row->namespace, $row->title );
                }
                $batch->execute();
-               if( $dbr->numRows( $res ) > 0 )
-                       $dbr->dataSeek( $res, 0 );
+               if( $db->numRows( $res ) > 0 )
+                       $db->dataSeek( $res, 0 );
        }
-       
+
        /**
         * Format a result row
         *
@@ -99,7 +102,7 @@ class SpecialMostlinkedtemplates extends QueryPage {
                        return "Invalid title in result set; {$tsafe}";
                }
        }
-       
+
        /**
         * Make a "what links here" link for a given title
         *
@@ -115,7 +118,6 @@ class SpecialMostlinkedtemplates extends QueryPage {
                        $wgLang->formatNum( $result->value ) );
                return $skin->makeKnownLinkObj( $wlh, $label, 'target=' . $title->getPrefixedUrl() );
        }
-       
 }
 
 /**
@@ -128,5 +130,3 @@ function wfSpecialMostlinkedtemplates( $par = false ) {
        $mlt = new SpecialMostlinkedtemplates();
        $mlt->doQuery( $offset, $limit );
 }
-
-?>
\ No newline at end of file