]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - includes/specials/SpecialMostlinkedtemplates.php
MediaWiki 1.17.0
[autoinstallsdev/mediawiki.git] / includes / specials / SpecialMostlinkedtemplates.php
index 2d398a381064e85b5a5ab3e2f8a395ddd445a219..822d6bc919c2a65bd8dccd0bbc645deb36d014d7 100644 (file)
@@ -1,7 +1,25 @@
 <?php
 /**
+ * Implements Special:Mostlinkedtemplates
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
  * @file
  * @ingroup SpecialPage
+ * @author Rob Church <robchur@gmail.com>
  */
  
 /**
  * transclusion links, i.e. "most used" templates
  *
  * @ingroup SpecialPage
- * @author Rob Church <robchur@gmail.com>
  */
 class SpecialMostlinkedtemplates extends QueryPage {
 
        /**
         * Name of the report
         *
-        * @return string
+        * @return String
         */
        public function getName() {
                return 'Mostlinkedtemplates';
@@ -25,7 +42,7 @@ class SpecialMostlinkedtemplates extends QueryPage {
        /**
         * Is this report expensive, i.e should it be cached?
         *
-        * @return bool
+        * @return Boolean
         */
        public function isExpensive() {
                return true;
@@ -34,7 +51,7 @@ class SpecialMostlinkedtemplates extends QueryPage {
        /**
         * Is there a feed available?
         *
-        * @return bool
+        * @return Boolean
         */
        public function isSyndicated() {
                return false;
@@ -43,7 +60,7 @@ class SpecialMostlinkedtemplates extends QueryPage {
        /**
         * Sort the results in descending order?
         *
-        * @return bool
+        * @return Boolean
         */
        public function sortDescending() {
                return true;
@@ -52,7 +69,7 @@ class SpecialMostlinkedtemplates extends QueryPage {
        /**
         * Generate SQL for the report
         *
-        * @return string
+        * @return String
         */
        public function getSql() {
                $dbr = wfGetDB( DB_SLAVE );
@@ -70,12 +87,12 @@ class SpecialMostlinkedtemplates extends QueryPage {
        /**
         * Pre-cache page existence to speed up link generation
         *
-        * @param Database $dbr Database connection
-        * @param int $res Result pointer
+        * @param $db Database connection
+        * @param $res ResultWrapper
         */
        public function preprocessResults( $db, $res ) {
                $batch = new LinkBatch();
-               while( $row = $db->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        $batch->add( $row->namespace, $row->title );
                }
                $batch->execute();
@@ -86,16 +103,15 @@ class SpecialMostlinkedtemplates extends QueryPage {
        /**
         * Format a result row
         *
-        * @param Skin $skin Skin to use for UI elements
-        * @param object $result Result row
-        * @return string
+        * @param $skin Skin to use for UI elements
+        * @param $result Result row
+        * @return String
         */
        public function formatResult( $skin, $result ) {
                $title = Title::makeTitleSafe( $result->namespace, $result->title );
 
-               $skin->link( $title );
                return wfSpecialList(
-                       $skin->makeLinkObj( $title ),
+                       $skin->link( $title ),
                        $this->makeWlhLink( $title, $skin, $result )
                );
        }
@@ -103,16 +119,16 @@ class SpecialMostlinkedtemplates extends QueryPage {
        /**
         * Make a "what links here" link for a given title
         *
-        * @param Title $title Title to make the link for
-        * @param Skin $skin Skin to use
-        * @param object $result Result row
-        * @return string
+        * @param $title Title to make the link for
+        * @param $skin Skin to use
+        * @param $result Result row
+        * @return String
         */
        private function makeWlhLink( $title, $skin, $result ) {
                global $wgLang;
                $wlh = SpecialPage::getTitleFor( 'Whatlinkshere' );
-               $label = wfMsgExt( 'nlinks', array( 'parsemag', 'escape' ),
-               $wgLang->formatNum( $result->value ) );
+               $label = wfMsgExt( 'ntransclusions', array( 'parsemag', 'escape' ),
+                       $wgLang->formatNum( $result->value ) );
                return $skin->link( $wlh, $label, array(), array( 'target' => $title->getPrefixedText() ) );
        }
 }
@@ -120,7 +136,7 @@ class SpecialMostlinkedtemplates extends QueryPage {
 /**
  * Execution function
  *
- * @param mixed $par Parameters passed to the page
+ * @param $par Mixed: parameters passed to the page
  */
 function wfSpecialMostlinkedtemplates( $par = false ) {
        list( $limit, $offset ) = wfCheckLimits();