Show extension name only if its checks are not empty.
authorRotem Liss <rotem@users.mediawiki.org>
Sun, 6 Jul 2008 11:12:02 +0000 (11:12 +0000)
committerRotem Liss <rotem@users.mediawiki.org>
Sun, 6 Jul 2008 11:12:02 +0000 (11:12 +0000)
maintenance/language/checkLanguage.inc

index 5681459..baa9619 100644 (file)
@@ -305,6 +305,22 @@ $detailText
 
 EOL;
        }
+
+       protected function isEmpty() {
+               $empty = true;
+               foreach( $this->results as $code => $results ) {
+                       foreach( $results as $check => $messages ) {
+                               if( !empty( $messages ) ) {
+                                       $empty = false;
+                                       break;
+                               }
+                       }
+                       if( !$empty ) {
+                               break;
+                       }
+               }
+               return $empty;
+       }
 }
 
 class CheckExtensionsCLI extends CheckLanguageCLI {
@@ -422,26 +438,28 @@ ENDS;
 
        protected function checkLanguage( $code ) {
                foreach( $this->extensions as $extension ) {
-                       echo $extension->name() . ":\n";
-
                        $this->L = $extension;
                        $this->results = array();
                        $this->results[$code] = parent::checkLanguage( $code );
 
-                       if( $this->level > 0 ) {
-                               switch( $this->output ) {
-                                       case 'plain':
-                                               $this->outputText();
-                                               break;
-                                       case 'wiki':
-                                               $this->outputWiki();
-                                               break;
-                                       default:
-                                               throw new MWException( "Invalid output type $this->output" );
+                       if( !$this->isEmpty() ) {
+                               echo $extension->name() . ":\n";
+
+                               if( $this->level > 0 ) {
+                                       switch( $this->output ) {
+                                               case 'plain':
+                                                       $this->outputText();
+                                                       break;
+                                               case 'wiki':
+                                                       $this->outputWiki();
+                                                       break;
+                                               default:
+                                                       throw new MWException( "Invalid output type $this->output" );
+                                       }
                                }
-                       }
 
-                       echo "\n";
+                               echo "\n";
+                       }
                }
        }
 }