* Cut down on the time the redundant() function takes, not takes ~2sec but took
authorÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Tue, 16 Aug 2005 13:03:46 +0000 (13:03 +0000)
committerÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Tue, 16 Aug 2005 13:03:46 +0000 (13:03 +0000)
  ~1min before.

maintenance/transstat.php

index d49d21e..b042944 100644 (file)
@@ -30,9 +30,6 @@ Usage: php transstat.php [--help] [--output:csv|text|wiki] [--noredundant]
                     * 'wiki' : MediaWiki syntax.
                     * 'text' : Text with tabs.
                      Default output is 'wiki'
-  --noredundant : do NOT calculate redundant (takes some time)
-
-
 END;
 }
 
@@ -104,20 +101,15 @@ class csvStatsOutput extends statsOutput {
 }
 
 
-/** FIXME: This takes an obscene amount of time */
-if(isset($options['noredundant'])) {
-       function redundant(&$arr) { return 'NC'; }
-} else {
-       function redundant(&$arr) {
-               global $wgAllMessagesEn;
-               
-               $redundant = 0;
-               foreach(array_keys($arr) as $key) {
-                       if ( ! array_key_exists( $key, $wgAllMessagesEn) )
-                               ++$redundant;
-               }
-               return $redundant;
+function redundant(&$arr) {
+       global $wgAllMessagesEn;
+       
+       $redundant = 0;
+       foreach(array_keys($arr) as $key) {
+               if ( @$wgAllMessagesEn[$key] === null )
+                       ++$redundant;
        }
+       return $redundant;
 }
 
 // Select an output engine