From: jenkins-bot Date: Tue, 22 Dec 2015 14:04:34 +0000 (+0000) Subject: Merge "Make Special:MediaStatistics show a total count of file sizes" X-Git-Tag: 1.31.0-rc.0~8584 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=8a5b362c435a054918a2392bc9d470ff85992022;hp=426cadcf443ef6bc6be5d1784272f1fa506d9e95;p=lhc%2Fweb%2Fwiklou.git Merge "Make Special:MediaStatistics show a total count of file sizes" --- diff --git a/includes/specials/SpecialMediaStatistics.php b/includes/specials/SpecialMediaStatistics.php index e5ba8c60b5..aeebc42ddf 100644 --- a/includes/specials/SpecialMediaStatistics.php +++ b/includes/specials/SpecialMediaStatistics.php @@ -27,6 +27,14 @@ */ 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 ); @@ -123,6 +131,7 @@ class MediaStatisticsPage extends QueryPage { $this->outputTableEnd(); } $this->outputMediaType( $mediaType ); + $this->totalPerType = 0; $this->outputTableStart( $mediaType ); $prevMediaType = $mediaType; } @@ -130,6 +139,11 @@ class MediaStatisticsPage extends QueryPage { } if ( $prevMediaType !== null ) { $this->outputTableEnd(); + $this->getOutput()->addWikiText( + $this->msg( 'mediastatistics-allbytes' ) + ->numParams( $this->totalSize ) + ->text() + ); } } @@ -138,6 +152,12 @@ class MediaStatisticsPage extends QueryPage { */ protected function outputTableEnd() { $this->getOutput()->addHtml( Html::closeElement( 'table' ) ); + $this->getOutput()->addWikiText( + $this->msg( 'mediastatistics-bytespertype' ) + ->numParams( $this->totalPerType ) + ->text() + ); + $this->totalSize += $this->totalPerType; } /** @@ -180,7 +200,7 @@ class MediaStatisticsPage extends QueryPage { ->numParams( $this->makePercentPretty( $bytes / $this->totalBytes ) ) ->parse() ); - + $this->totalPerType += $bytes; $this->getOutput()->addHTML( Html::rawElement( 'tr', array(), $row ) ); } diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 000b4aec4c..3f761f6509 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -3859,6 +3859,8 @@ "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", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index d21718e385..dab2adc1d0 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -4034,6 +4034,8 @@ "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}}.",