*/
public function getQueryInfo() {
$dbr = wfGetDB( DB_SLAVE );
- $fakeTitle = $dbr->buildConcat( array(
+ $fakeTitle = $dbr->buildConcat( [
'img_media_type',
$dbr->addQuotes( ';' ),
'img_major_mime',
'COUNT(*)',
$dbr->addQuotes( ';' ),
'SUM( img_size )'
- ) );
- return array(
- 'tables' => array( 'image' ),
- 'fields' => array(
+ ] );
+ return [
+ 'tables' => [ 'image' ],
+ 'fields' => [
'title' => $fakeTitle,
'namespace' => NS_MEDIA, /* needs to be something */
'value' => '1'
- ),
- 'conds' => array(
+ ],
+ 'conds' => [
// WMF has a random null row in the db
'img_media_type IS NOT NULL'
- ),
- 'options' => array(
- 'GROUP BY' => array(
+ ],
+ 'options' => [
+ 'GROUP BY' => [
'img_media_type',
'img_major_mime',
'img_minor_mime',
- )
- )
- );
+ ]
+ ]
+ ];
}
/**
* @return Array Fields to sort by
*/
function getOrderFields() {
- return array( 'img_media_type', 'count(*)', 'img_major_mime', 'img_minor_mime' );
+ return [ 'img_media_type', 'count(*)', 'img_major_mime', 'img_minor_mime' ];
}
/**
* Output the results of the query.
*
- * @param $out OutputPage
- * @param $skin Skin (deprecated presumably)
- * @param $dbr IDatabase
- * @param $res ResultWrapper Results from query
- * @param $num integer Number of results
- * @param $offset integer Paging offset (Should always be 0 in our case)
+ * @param OutputPage $out
+ * @param Skin $skin (deprecated presumably)
+ * @param IDatabase $dbr
+ * @param ResultWrapper $res Results from query
+ * @param int $num Number of results
+ * @param int $offset Paging offset (Should always be 0 in our case)
*/
protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
$prevMediaType = null;
* Output closing </table>
*/
protected function outputTableEnd() {
- $this->getOutput()->addHtml( Html::closeElement( 'table' ) );
+ $this->getOutput()->addHTML( Html::closeElement( 'table' ) );
$this->getOutput()->addWikiText(
$this->msg( 'mediastatistics-bytespertype' )
->numParams( $this->totalPerType )
/**
* 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
+ * @param string $mime mime type (e.g. image/jpeg)
+ * @param int $count Number of images of this type
+ * @param int $totalBytes Total space for images of this type
*/
protected function outputTableRow( $mime, $count, $bytes ) {
$mimeSearch = SpecialPage::getTitleFor( 'MIMEsearch', $mime );
$row = Html::rawElement(
'td',
- array(),
+ [],
Linker::link( $mimeSearch, htmlspecialchars( $mime ) )
);
$row .= Html::element(
'td',
- array(),
+ [],
$this->getExtensionList( $mime )
);
$row .= Html::rawElement(
'td',
// Make sure js sorts it in numeric order
- array( 'data-sort-value' => $count ),
+ [ 'data-sort-value' => $count ],
$this->msg( 'mediastatistics-nfiles' )
->numParams( $count )
/** @todo Check to be sure this really should have number formatting */
$row .= Html::rawElement(
'td',
// Make sure js sorts it in numeric order
- array( 'data-sort-value' => $bytes ),
+ [ 'data-sort-value' => $bytes ],
$this->msg( 'mediastatistics-nbytes' )
->numParams( $bytes )
->sizeParams( $bytes )
->parse()
);
$this->totalPerType += $bytes;
- $this->getOutput()->addHTML( Html::rawElement( 'tr', array(), $row ) );
+ $this->getOutput()->addHTML( Html::rawElement( 'tr', [], $row ) );
}
/**
/**
* 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")
+ * @param string $mime mime type
+ * @return string Comma separated list of allowed extensions (e.g. ".ogg, .oga")
*/
private function getExtensionList( $mime ) {
$exts = MimeMagic::singleton()->getExtensionsForType( $mime );
$this->getOutput()->addHTML(
Html::openElement(
'table',
- array( 'class' => array(
+ [ 'class' => [
'mw-mediastats-table',
'mw-mediastats-table-' . strtolower( $mediaType ),
'sortable',
'wikitable'
- ) )
+ ] ]
)
);
$this->getOutput()->addHTML( $this->getTableHeaderRow() );
* @return String the header row of the able
*/
protected function getTableHeaderRow() {
- $headers = array( 'mimetype', 'extensions', 'count', 'totalbytes' );
+ $headers = [ 'mimetype', 'extensions', 'count', 'totalbytes' ];
$ths = '';
foreach ( $headers as $header ) {
$ths .= Html::rawElement(
'th',
- array(),
+ [],
// for grep:
// mediastatistics-table-mimetype, mediastatistics-table-extensions
// tatistics-table-count, mediastatistics-table-totalbytes
$this->msg( 'mediastatistics-table-' . $header )->parse()
);
}
- return Html::rawElement( 'tr', array(), $ths );
+ return Html::rawElement( 'tr', [], $ths );
}
/**
* Output a header for a new media type section
*
- * @param $mediaType string A media type (e.g. from the MEDIATYPE_xxx constants)
+ * @param string $mediaType A media type (e.g. from the MEDIATYPE_xxx constants)
*/
protected function outputMediaType( $mediaType ) {
$this->getOutput()->addHTML(
Html::element(
'h2',
- array( 'class' => array(
+ [ 'class' => [
'mw-mediastats-mediatype',
'mw-mediastats-mediatype-' . strtolower( $mediaType )
- ) ),
+ ] ],
// for grep
// mediastatistics-header-unknown, mediastatistics-header-bitmap,
// mediastatistics-header-drawing, mediastatistics-header-audio,
/**
* 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
+ * @param string $fakeTitle A string formatted as <media type>;<mime type>;<count>;<bytes>
+ * @return array The constituant parts of $fakeTitle
*/
private function splitFakeTitle( $fakeTitle ) {
return explode( ';', $fakeTitle, 4 );
* 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
+ * @param Skin $skin
+ * @param stdObject $result Result row
* @return bool|string|void
* @throws MWException
*/
/**
* Initialize total values so we can figure out percentages later.
*
- * @param $dbr IDatabase
- * @param $res ResultWrapper
+ * @param IDatabase $dbr
+ * @param ResultWrapper $res
*/
public function preprocessResults( $dbr, $res ) {
$this->totalCount = $this->totalBytes = 0;