]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - includes/specials/SpecialMostimages.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / includes / specials / SpecialMostimages.php
index 411a281b0700dcfc7c9408e511b94367ca28c8f9..1339f4bcbb450317ed87a2e2f09f2b2d47caf8bd 100644 (file)
  */
 
 /**
- * A special page page that list most used images
+ * A special page that lists most used images
  *
  * @ingroup SpecialPage
  */
 class MostimagesPage extends ImageQueryPage {
-
-       function getName() { return 'Mostimages'; }
-       function isExpensive() { return true; }
-       function isSyndicated() { return false; }
-
-       function getSQL() {
-               $dbr = wfGetDB( DB_SLAVE );
-               $imagelinks = $dbr->tableName( 'imagelinks' );
-               return
-                       "
-                       SELECT
-                               'Mostimages' as type,
-                               " . NS_FILE . " as namespace,
-                               il_to as title,
-                               COUNT(*) as value
-                       FROM $imagelinks
-                       GROUP BY il_to
-                       HAVING COUNT(*) > 1
-                       ";
+       function __construct( $name = 'Mostimages' ) {
+               parent::__construct( $name );
        }
 
-       function getCellHtml( $row ) {
-               global $wgLang;
-               return wfMsgExt( 'nimagelinks',  array( 'parsemag', 'escape' ),
-                       $wgLang->formatNum( $row->value ) ) . '<br />';
+       function isExpensive() {
+               return true;
        }
 
-}
+       function isSyndicated() {
+               return false;
+       }
 
-/**
- * Constructor
- */
-function wfSpecialMostimages() {
-       list( $limit, $offset ) = wfCheckLimits();
+       function getQueryInfo() {
+               return [
+                       'tables' => [ 'imagelinks' ],
+                       'fields' => [
+                               'namespace' => NS_FILE,
+                               'title' => 'il_to',
+                               'value' => 'COUNT(*)'
+                       ],
+                       'options' => [
+                               'GROUP BY' => 'il_to',
+                               'HAVING' => 'COUNT(*) > 1'
+                       ]
+               ];
+       }
 
-       $wpp = new MostimagesPage();
+       function getCellHtml( $row ) {
+               return $this->msg( 'nimagelinks' )->numParams( $row->value )->escaped() . '<br />';
+       }
 
-       $wpp->doQuery( $offset, $limit );
+       protected function getGroupName() {
+               return 'highuse';
+       }
 }