*/
class MediaStatisticsPage extends QueryPage {
protected $totalCount = 0, $totalBytes = 0;
+ /**
+ * @var integer $totalPerType Combined file size of all files in a section
+ */
+ protected $totalPerType = 0;
+ /**
+ * @var integer $totalSize Combined file size of all files
+ */
+ protected $totalSize = 0;
function __construct( $name = 'MediaStatistics' ) {
parent::__construct( $name );
$this->outputTableEnd();
}
$this->outputMediaType( $mediaType );
+ $this->totalPerType = 0;
$this->outputTableStart( $mediaType );
$prevMediaType = $mediaType;
}
}
if ( $prevMediaType !== null ) {
$this->outputTableEnd();
+ $this->getOutput()->addWikiText(
+ $this->msg( 'mediastatistics-allbytes' )
+ ->numParams( $this->totalSize )
+ ->text()
+ );
}
}
*/
protected function outputTableEnd() {
$this->getOutput()->addHtml( Html::closeElement( 'table' ) );
+ $this->getOutput()->addWikiText(
+ $this->msg( 'mediastatistics-bytespertype' )
+ ->numParams( $this->totalPerType )
+ ->text()
+ );
+ $this->totalSize += $this->totalPerType;
}
/**
->numParams( $this->makePercentPretty( $bytes / $this->totalBytes ) )
->parse()
);
-
+ $this->totalPerType += $bytes;
$this->getOutput()->addHTML( Html::rawElement( 'tr', array(), $row ) );
}
"mediastatistics-summary": "Statistics about uploaded file types. This only includes the most recent version of a file. Old or deleted versions of files are excluded.",
"mediastatistics-nfiles": "$1 ($2%)",
"mediastatistics-nbytes": "{{PLURAL:$1|$1 byte|$1 bytes}} ($2; $3%)",
+ "mediastatistics-bytespertype": "Total file size for this section: $1 bytes.",
+ "mediastatistics-allbytes": "Total file size for all files: $1 bytes.",
"mediastatistics-table-mimetype": "MIME type",
"mediastatistics-table-extensions": "Possible extensions",
"mediastatistics-table-count": "Number of files",
"mediastatistics-summary": "Used to explain that this page only does statistics over current versions of files. \"Old\" versions of files and deleted files are not counted.",
"mediastatistics-nfiles": "{{optional}}\nEntry in table on [[Special:MediaStatistics]] that gives total number of files. $1 - number of files. $2 - percentage of total files that is this type (percent will be formatted to have about 3 interesting digits. e.g. 0.121 or 10.2)",
"mediastatistics-nbytes": "Combined space of this type of file. Bytes and \"human units\" are shown so that users can better get a sense of magnitude when making comparisons.\n*$1 - total space in bytes.\n*$2 - total space in \"human units\" (i.e. KB, MB, GB, etc)\n*$3 - What percentage of the space all uploads take up does this file take up.",
+ "mediastatistics-bytespertype": "Combined space of one section of [[Special:MediaStatistics]]. \n*$1 - total space in bytes",
+ "mediastatistics-allbytes": "Combined space of all uploaded files. \n*$1 - total space in bytes",
"mediastatistics-table-mimetype": "Header for table on Special:MediaStatistics. Column that lists MIME types (The values in this column will look like 'image/jpeg', and be linked to Special:MIMESearch).",
"mediastatistics-table-extensions": "Header for column in tables on [[Special:MediaStatistics]] that lists possible extensions for a given file type. (The values in this column will be a comma separated list of file extensions, such as '.webm' or '.png, .apng').",
"mediastatistics-table-count": "Column header on Special:MediaStatistics for the number of files column. The headers in this column use {{msg-mw|mediastatistics-nfiles}}.",