25 public function __construct() {
26 parent::__construct();
27 $this->addDescription(
'Script to show number of edits per language for all message groups.' );
30 '(optional) Show given number of language codes (default: 10)',
36 '(optional) Calculate for given number of days (default: 7)',
42 '(optional) Include bot edits'
46 '(optional) Comma separated list of namespace IDs',
50 $this->requireExtension(
'Translate' );
53 public function execute() {
54 $hours = ( $this->getOption(
'days' ) ?: 7 ) * 24;
55 $top = (int)$this->getOption(
'top' ) ?: 10;
56 $bots = $this->hasOption(
'bots' );
59 if ( $this->hasOption(
'ns' ) ) {
60 $input = explode(
',', $this->getOption(
'ns' ) );
62 foreach ( $input as $namespace ) {
63 if ( is_numeric( $namespace ) ) {
64 $namespaces[] = $namespace;
72 $rows = TranslateUtils::translationChanges( $hours, $bots, $namespaces );
78 foreach ( $rows as $_ ) {
80 if ( $_->rc_user_text === FuzzyBot::getName() ) {
84 [ , $code ] = TranslateUtils::figureMessage( $_->rc_title );
86 if ( !isset( $codes[$code] ) ) {
98 foreach ( $codes as $code => $num ) {
99 if ( $i++ === $top ) {
103 $this->output(
"$code\t$num\n" );