From 8240cb081019b781ea50e5cad84089754ad316c4 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Thu, 14 Jun 2007 21:30:30 +0000 Subject: Bug 345100: Remove obsolete parameters and "officially" turn on custom bug status workflow - Patch by Frédéric Buclin r=gerv a=justdave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/Config.pm | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'Bugzilla/Config.pm') diff --git a/Bugzilla/Config.pm b/Bugzilla/Config.pm index 85c9d6dec..fe58e0282 100644 --- a/Bugzilla/Config.pm +++ b/Bugzilla/Config.pm @@ -199,18 +199,16 @@ sub update_params { # --- REMOVE OLD PARAMS --- - my @oldparams; + my %oldparams; # Remove any old params, put them in old-params.txt foreach my $item (keys %$param) { if (!grep($_ eq $item, map ($_->{'name'}, @param_list))) { - local $Data::Dumper::Terse = 1; - local $Data::Dumper::Indent = 0; - push (@oldparams, [$item, Data::Dumper->Dump([$param->{$item}])]); + $oldparams{$item} = $param->{$item}; delete $param->{$item}; } } - if (@oldparams) { + if (scalar(keys %oldparams)) { my $op_file = new IO::File('old-params.txt', '>>', 0600) || die "old-params.txt: $!"; @@ -218,11 +216,14 @@ sub update_params { " and so have been\nmoved from your parameters file into", " old-params.txt:\n"; - foreach my $p (@oldparams) { - my ($item, $value) = @$p; - print $op_file "\n\n$item:\n$value\n"; - print $item; - print ", " unless $item eq $oldparams[$#oldparams]->[0]; + local $Data::Dumper::Terse = 1; + local $Data::Dumper::Indent = 0; + + my $comma = ""; + foreach my $item (keys %oldparams) { + print $op_file "\n\n$item:\n" . Data::Dumper->Dump([$oldparams{$item}]) . "\n"; + print "${comma}$item"; + $comma = ", "; } print "\n"; $op_file->close; @@ -250,6 +251,10 @@ sub update_params { } write_params($param); + + # Return deleted params and values so that checksetup.pl has a chance + # to convert old params to new data. + return %oldparams; } sub write_params { -- cgit v1.2.3-24-g4f1b