[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/specials/ -> SpecialMediaStatistics.php (summary)

Implements Special:MediaStatistics 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.

Author: Brian Wolff
File Size: 325 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

MediaStatisticsPage:: (16 methods):
  __construct()
  isExpensive()
  getQueryInfo()
  getOrderFields()
  outputResults()
  outputTableEnd()
  outputTableRow()
  makePercentPretty()
  getExtensionList()
  outputTableStart()
  getTableHeaderRow()
  outputMediaType()
  splitFakeTitle()
  getGroupName()
  formatResult()
  preprocessResults()


Class: MediaStatisticsPage  - X-Ref


__construct( $name = 'MediaStatistics' )   X-Ref
No description

isExpensive()   X-Ref
No description

getQueryInfo()   X-Ref
Query to do.

This abuses the query cache table by storing mime types as "titles".

This will store entries like [[Media:BITMAP;image/jpeg;200;20000]]
where the form is Media type;mime type;count;bytes.

This relies on the behaviour that when value is tied, the order things
come out of querycache table is the order they went in. Which is hacky.
However, other special pages like Special:Deadendpages and
Special:BrokenRedirects also rely on this.

getOrderFields()   X-Ref
How to sort the results

It's important that img_media_type come first, otherwise the
tables will be fragmented.
return: Array Fields to sort by

outputResults( $out, $skin, $dbr, $res, $num, $offset )   X-Ref
Output the results of the query.

param: $out OutputPage
param: $skin Skin (deprecated presumably)
param: $dbr DatabaseBase
param: $res ResultWrapper Results from query
param: $num integer Number of results
param: $offset integer Paging offset (Should always be 0 in our case)

outputTableEnd()   X-Ref
Output closing </table>


outputTableRow( $mime, $count, $bytes )   X-Ref
Output a row of the stats table

param: $mime String mime type (e.g. image/jpeg)
param: $count integer Number of images of this type
param: $totalBytes integer Total space for images of this type

makePercentPretty( $decimal )   X-Ref

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.

getExtensionList( $mime )   X-Ref
Given a mime type, return a comma separated list of allowed extensions.

param: $mime String mime type
return: String Comma separated list of allowed extensions (e.g. ".ogg, .oga")

outputTableStart( $mediaType )   X-Ref
Output the start of the table

Including opening <table>, and first <tr> with column headers.

getTableHeaderRow()   X-Ref
Get (not output) the header row for the table

return: String the header row of the able

outputMediaType( $mediaType )   X-Ref
Output a header for a new media type section

param: $mediaType string A media type (e.g. from the MEDIATYPE_xxx constants)

splitFakeTitle( $fakeTitle )   X-Ref
parse the fake title format that this special page abuses querycache with.

param: $fakeTitle String A string formatted as <media type>;<mime type>;<count>;<bytes>
return: Array The constituant parts of $fakeTitle

getGroupName()   X-Ref
What group to put the page in

return: string

formatResult( $skin, $result )   X-Ref
This method isn't used, since we override outputResults, but
we need to implement since abstract in parent class.

param: $skin Skin
param: $result stdObject Result row

preprocessResults( $dbr, $res )   X-Ref
Initialize total values so we can figure out percentages later.

param: $dbr DatabaseBase
param: $res ResultWrapper



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1