MediaWiki  REL1_24
MediaStatisticsPage Class Reference
Inheritance diagram for MediaStatisticsPage:
Collaboration diagram for MediaStatisticsPage:

List of all members.

Public Member Functions

 __construct ($name= 'MediaStatistics')
 formatResult ($skin, $result)
 This method isn't used, since we override outputResults, but we need to implement since abstract in parent class.
 getOrderFields ()
 How to sort the results.
 getQueryInfo ()
 Query to do.
 isExpensive ()
 Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
 preprocessResults ($dbr, $res)
 Initialize total values so we can figure out percentages later.

Public Attributes

 $totalBytes = 0

Protected Member Functions

 getGroupName ()
 What group to put the page in.
 getTableHeaderRow ()
 Get (not output) the header row for the table.
 makePercentPretty ($decimal)
 outputMediaType ($mediaType)
 Output a header for a new media type section.
 outputResults ($out, $skin, $dbr, $res, $num, $offset)
 Output the results of the query.
 outputTableEnd ()
 Output closing
 outputTableRow ($mime, $count, $bytes)
 Output a row of the stats table.
 outputTableStart ($mediaType)
 Output the start of the table.

Protected Attributes

 $totalCount = 0

Private Member Functions

 getExtensionList ($mime)
 Given a mime type, return a comma separated list of allowed extensions.
 splitFakeTitle ($fakeTitle)
 parse the fake title format that this special page abuses querycache with.

Detailed Description

Definition at line 28 of file SpecialMediaStatistics.php.


Constructor & Destructor Documentation

MediaStatisticsPage::__construct ( name = 'MediaStatistics')

Definition at line 31 of file SpecialMediaStatistics.php.

References $name.


Member Function Documentation

MediaStatisticsPage::formatResult ( skin,
result 
)

This method isn't used, since we override outputResults, but we need to implement since abstract in parent class.

Parameters:
$skinSkin
$resultstdObject Result row

Reimplemented from QueryPage.

Definition at line 306 of file SpecialMediaStatistics.php.

Given a mime type, return a comma separated list of allowed extensions.

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

Definition at line 199 of file SpecialMediaStatistics.php.

References $ext, $mime, as, SpecialPage\getLanguage(), and MimeMagic\singleton().

Referenced by outputTableRow().

What group to put the page in.

Returns:
string

Reimplemented from SpecialPage.

Definition at line 295 of file SpecialMediaStatistics.php.

How to sort the results.

It's important that img_media_type come first, otherwise the tables will be fragmented.

Returns:
Array Fields to sort by

Reimplemented from QueryPage.

Definition at line 93 of file SpecialMediaStatistics.php.

References array().

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.

Reimplemented from QueryPage.

Definition at line 56 of file SpecialMediaStatistics.php.

References $dbr, array(), and wfGetDB().

Get (not output) the header row for the table.

Returns:
String the header row of the able

Definition at line 238 of file SpecialMediaStatistics.php.

References array(), as, SpecialPage\msg(), and Html\rawElement().

Referenced by outputTableStart().

Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.

$wgDisableQueryPages causes all query pages to be declared expensive. Some query pages are always expensive.

Returns:
bool

Reimplemented from QueryPage.

Definition at line 39 of file SpecialMediaStatistics.php.

MediaStatisticsPage::makePercentPretty ( decimal) [protected]
Parameters:
float$decimalA decimal percentage (ie for 12.3%, this would be 0.123)
Returns:
String The percentage formatted so that 3 significant digits are shown.

Definition at line 182 of file SpecialMediaStatistics.php.

Referenced by outputTableRow().

MediaStatisticsPage::outputMediaType ( mediaType) [protected]

Output a header for a new media type section.

Parameters:
$mediaTypestring A media type (e.g. from the MEDIATYPE_xxx constants)

Definition at line 259 of file SpecialMediaStatistics.php.

References array(), Html\element(), SpecialPage\getOutput(), SpecialPage\msg(), and text.

Referenced by outputResults().

MediaStatisticsPage::outputResults ( out,
skin,
dbr,
res,
num,
offset 
) [protected]

Output the results of the query.

Parameters:
$outOutputPage
$skinSkin (deprecated presumably)
$dbrDatabaseBase
$resResultWrapper Results from query
$numinteger Number of results
$offsetinteger Paging offset (Should always be 0 in our case)

Reimplemented from QueryPage.

Definition at line 107 of file SpecialMediaStatistics.php.

References $mime, $res, $totalBytes, $totalCount, as, list, outputMediaType(), outputTableEnd(), outputTableRow(), outputTableStart(), and splitFakeTitle().

Output closing

Definition at line 131 of file SpecialMediaStatistics.php.

References Html\closeElement(), and SpecialPage\getOutput().

Referenced by outputResults().

MediaStatisticsPage::outputTableRow ( mime,
count,
bytes 
) [protected]

Output a row of the stats table.

Parameters:
$mimeString mime type (e.g. image/jpeg)
$countinteger Number of images of this type
$totalBytesinteger Total space for images of this type

Definition at line 142 of file SpecialMediaStatistics.php.

References $count, $mime, array(), Html\element(), getExtensionList(), SpecialPage\getOutput(), SpecialPage\getTitleFor(), Linker\link(), makePercentPretty(), SpecialPage\msg(), and Html\rawElement().

Referenced by outputResults().

MediaStatisticsPage::outputTableStart ( mediaType) [protected]

Output the start of the table.

Including opening

and first

with column headers.

Definition at line 218 of file SpecialMediaStatistics.php.

References array(), SpecialPage\getOutput(), getTableHeaderRow(), and Html\openElement().

Referenced by outputResults().

Initialize total values so we can figure out percentages later.

Parameters:
$dbrDatabaseBase
$resResultWrapper

Reimplemented from QueryPage.

Definition at line 316 of file SpecialMediaStatistics.php.

References $count, $res, as, list, and splitFakeTitle().

MediaStatisticsPage::splitFakeTitle ( fakeTitle) [private]

parse the fake title format that this special page abuses querycache with.

Parameters:
$fakeTitleString A string formatted as <media type>="">;<mime type>="">;<count>;<bytes>
Returns:
Array The constituant parts of $fakeTitle

Definition at line 287 of file SpecialMediaStatistics.php.

Referenced by outputResults(), and preprocessResults().


Member Data Documentation

MediaStatisticsPage::$totalBytes = 0

Definition at line 29 of file SpecialMediaStatistics.php.

Referenced by outputResults().

MediaStatisticsPage::$totalCount = 0 [protected]

Definition at line 29 of file SpecialMediaStatistics.php.

Referenced by outputResults().


The documentation for this class was generated from the following file: