r37159 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r37158‎ | r37159 | r37160 >
Date:11:12, 6 July 2008
Author:rotem
Status:old
Tags:
Comment:
Show extension name only if its checks are not empty.
Modified paths:
  • /trunk/phase3/maintenance/language/checkLanguage.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/checkLanguage.inc
@@ -305,6 +305,22 @@
306306
307307 EOL;
308308 }
 309+
 310+ protected function isEmpty() {
 311+ $empty = true;
 312+ foreach( $this->results as $code => $results ) {
 313+ foreach( $results as $check => $messages ) {
 314+ if( !empty( $messages ) ) {
 315+ $empty = false;
 316+ break;
 317+ }
 318+ }
 319+ if( !$empty ) {
 320+ break;
 321+ }
 322+ }
 323+ return $empty;
 324+ }
309325 }
310326
311327 class CheckExtensionsCLI extends CheckLanguageCLI {
@@ -422,26 +438,28 @@
423439
424440 protected function checkLanguage( $code ) {
425441 foreach( $this->extensions as $extension ) {
426 - echo $extension->name() . ":\n";
427 -
428442 $this->L = $extension;
429443 $this->results = array();
430444 $this->results[$code] = parent::checkLanguage( $code );
431445
432 - if( $this->level > 0 ) {
433 - switch( $this->output ) {
434 - case 'plain':
435 - $this->outputText();
436 - break;
437 - case 'wiki':
438 - $this->outputWiki();
439 - break;
440 - default:
441 - throw new MWException( "Invalid output type $this->output" );
 446+ if( !$this->isEmpty() ) {
 447+ echo $extension->name() . ":\n";
 448+
 449+ if( $this->level > 0 ) {
 450+ switch( $this->output ) {
 451+ case 'plain':
 452+ $this->outputText();
 453+ break;
 454+ case 'wiki':
 455+ $this->outputWiki();
 456+ break;
 457+ default:
 458+ throw new MWException( "Invalid output type $this->output" );
 459+ }
442460 }
 461+
 462+ echo "\n";
443463 }
444 -
445 - echo "\n";
446464 }
447465 }
448466 }

Status & tagging log