we don't need to check if they have a json config file anymore

This commit is contained in:
JT Smith 2007-07-31 20:18:09 +00:00
parent 27b3a4d644
commit fe734f2359
2 changed files with 0 additions and 41 deletions

View file

@ -102,7 +102,6 @@ checkModule("HTML::Highlight",0.20);
checkModule("HTML::TagFilter",0.07); checkModule("HTML::TagFilter",0.07);
checkModule("HTML::Template",2.9); checkModule("HTML::Template",2.9);
checkModule("HTML::Template::Expr",0.05,2); checkModule("HTML::Template::Expr",0.05,2);
checkModule("Parse::PlainConfig",1.1);
checkModule("XML::RSSLite",0.11); checkModule("XML::RSSLite",0.11);
checkModule("JSON",0.991); checkModule("JSON",0.991);
checkModule("Config::JSON","1.0.3"); checkModule("Config::JSON","1.0.3");

View file

@ -20,7 +20,6 @@ use DBI;
use File::Path; use File::Path;
use Getopt::Long; use Getopt::Long;
use JSON; use JSON;
use Parse::PlainConfig;
use WebGUI::Config; use WebGUI::Config;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Utility; use WebGUI::Utility;
@ -160,23 +159,6 @@ our (%upgrade, %config);
## Find site configs. ## Find site configs.
print "\nTesting site config versions...\n" unless ($quiet);
opendir(DIR,"../etc");
my @files = readdir(DIR);
closedir(DIR);
foreach my $file (@files) {
next unless ($file =~ m/\.conf$/);
next if ($file eq "spectre.conf" || $file eq "log.conf");
my $configFile = "../etc/".$file;
open(FILE,"<".$configFile);
my $line = <FILE>;
close(FILE);
unless ($line =~ m/JSON 1/) {
print "\tConverting ".$file." from PlainConfig to JSON\n" unless ($quiet);
convertPlainconfigToJson($configFile);
}
}
print "\nGetting site configs...\n" unless ($quiet); print "\nGetting site configs...\n" unless ($quiet);
my $configs = WebGUI::Config->readAllConfigs($webguiRoot); my $configs = WebGUI::Config->readAllConfigs($webguiRoot);
foreach my $filename (keys %{$configs}) { foreach my $filename (keys %{$configs}) {
@ -427,25 +409,3 @@ sub _parseDSN {
} }
#-----------------------------------------
sub convertPlainconfigToJson {
my $configFile = shift;
my $pp = Parse::PlainConfig->new('DELIM' => '=', 'FILE' => $configFile, 'PURGE' => 1);
my %config = ();
foreach my $param ($pp->directives) {
my $value = $pp->get($param);
if (isIn($param, qw(sitename templateParsers assets utilityAssets assetContainers authMethods shippingPlugins paymentPlugins))) {
if (ref $value ne "ARRAY") {
$value = [$value];
}
} elsif (isIn($param, qw(assetAddPrivilege macros))) {
if (ref $value ne "HASH") {
$value = {};
}
}
$config{$param} = $value;
}
open(FILE,">".$configFile);
print FILE "# config-file-type: JSON 1\n".objToJson(\%config, {pretty => 1, indent => 4, autoconv=>0, skipinvalid=>1});
close(FILE);
}