Do not insert page titles into querycache.qc_value
[lhc/web/wiklou.git] / includes / specials / SpecialMediaStatistics.php
index b6812bc..333d9b3 100644 (file)
@@ -28,7 +28,7 @@ use Wikimedia\Rdbms\IDatabase;
 /**
  * @ingroup SpecialPage
  */
-class MediaStatisticsPage extends QueryPage {
+class SpecialMediaStatistics extends QueryPage {
        protected $totalCount = 0, $totalBytes = 0;
 
        /**
@@ -76,9 +76,9 @@ class MediaStatisticsPage extends QueryPage {
                        $dbr->addQuotes( '/' ),
                        'img_minor_mime',
                        $dbr->addQuotes( ';' ),
-                       'COUNT(*)',
+                       $dbr->buildStringCast( 'COUNT(*)' ),
                        $dbr->addQuotes( ';' ),
-                       'SUM( img_size )'
+                       $dbr->buildStringCast( 'SUM( img_size )' )
                ] );
                return [
                        'tables' => [ 'image' ],
@@ -102,7 +102,7 @@ class MediaStatisticsPage extends QueryPage {
         *
         * It's important that img_media_type come first, otherwise the
         * tables will be fragmented.
-        * @return Array Fields to sort by
+        * @return array Fields to sort by
         */
        function getOrderFields() {
                return [ 'img_media_type', 'count(*)', 'img_major_mime', 'img_minor_mime' ];
@@ -156,7 +156,10 @@ class MediaStatisticsPage extends QueryPage {
         * Output closing </table>
         */
        protected function outputTableEnd() {
-               $this->getOutput()->addHTML( Html::closeElement( 'table' ) );
+               $this->getOutput()->addHTML(
+                       Html::closeElement( 'tbody' ) .
+                       Html::closeElement( 'table' )
+               );
                $this->getOutput()->addWikiTextAsInterface(
                                $this->msg( 'mediastatistics-bytespertype' )
                                        ->numParams( $this->totalPerType )
@@ -214,7 +217,7 @@ class MediaStatisticsPage extends QueryPage {
 
        /**
         * @param float $decimal A decimal percentage (ie for 12.3%, this would be 0.123)
-        * @return String The percentage formatted so that 3 significant digits are shown.
+        * @return string The percentage formatted so that 3 significant digits are shown.
         */
        protected function makePercentPretty( $decimal ) {
                $decimal *= 100;
@@ -258,7 +261,10 @@ class MediaStatisticsPage extends QueryPage {
         * @param string $mediaType
         */
        protected function outputTableStart( $mediaType ) {
-               $this->getOutput()->addHTML(
+               $out = $this->getOutput();
+               $out->addModuleStyles( 'jquery.tablesorter.styles' );
+               $out->addModules( 'jquery.tablesorter' );
+               $out->addHTML(
                        Html::openElement(
                                'table',
                                [ 'class' => [
@@ -267,15 +273,16 @@ class MediaStatisticsPage extends QueryPage {
                                        'sortable',
                                        'wikitable'
                                ] ]
-                       )
+                       ) .
+                       Html::rawElement( 'thead', [], $this->getTableHeaderRow() ) .
+                       Html::openElement( 'tbody' )
                );
-               $this->getOutput()->addHTML( $this->getTableHeaderRow() );
        }
 
        /**
         * Get (not output) the header row for the table
         *
-        * @return String the header row of the able
+        * @return string The header row of the table
         */
        protected function getTableHeaderRow() {
                $headers = [ 'mimetype', 'extensions', 'count', 'totalbytes' ];