we don't need to check if they have a json config file anymore
This commit is contained in:
parent
27b3a4d644
commit
fe734f2359
2 changed files with 0 additions and 41 deletions
|
|
@ -20,7 +20,6 @@ use DBI;
|
|||
use File::Path;
|
||||
use Getopt::Long;
|
||||
use JSON;
|
||||
use Parse::PlainConfig;
|
||||
use WebGUI::Config;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Utility;
|
||||
|
|
@ -160,23 +159,6 @@ our (%upgrade, %config);
|
|||
|
||||
## 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);
|
||||
my $configs = WebGUI::Config->readAllConfigs($webguiRoot);
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue