From dc3384b76fdbab5be5f3c3326e00cc1a8666c0bf Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 16 Aug 2005 13:03:46 +0000 Subject: [PATCH] * Cut down on the time the redundant() function takes, not takes ~2sec but took ~1min before. --- maintenance/transstat.php | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/maintenance/transstat.php b/maintenance/transstat.php index d49d21e50c..b042944157 100644 --- a/maintenance/transstat.php +++ b/maintenance/transstat.php @@ -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 -- 2.20.1