Merge "SI standards for time units"
[lhc/web/wiklou.git] / includes / specials / SpecialMostimages.php
index 411a281..01a5caf 100644 (file)
  */
 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 array (
+                       'tables' => array ( 'imagelinks' ),
+                       'fields' => array ( 'namespace' => NS_FILE,
+                                       'title' => 'il_to',
+                                       'value' => 'COUNT(*)' ),
+                       'options' => array ( '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 );
 }