*/
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();
+ // add total size of all files
+ $this->outputMediaType( 'total' );
+ $this->getOutput()->addWikiText(
+ $this->msg( 'mediastatistics-allbytes' )
+ ->numParams( $this->totalSize )
+ ->sizeParams( $this->totalSize )
+ ->text()
+ );
}
}
*/
protected function outputTableEnd() {
$this->getOutput()->addHtml( Html::closeElement( 'table' ) );
+ $this->getOutput()->addWikiText(
+ $this->msg( 'mediastatistics-bytespertype' )
+ ->numParams( $this->totalPerType )
+ ->sizeParams( $this->totalPerType )
+ ->numParams( $this->makePercentPretty( $this->totalPerType / $this->totalBytes ) )
+ ->text()
+ );
+ $this->totalSize += $this->totalPerType;
}
/**
->numParams( $this->makePercentPretty( $bytes / $this->totalBytes ) )
->parse()
);
-
+ $this->totalPerType += $bytes;
$this->getOutput()->addHTML( Html::rawElement( 'tr', array(), $row ) );
}