added upgrade for config file

This commit is contained in:
JT Smith 2003-03-16 21:46:08 +00:00
parent b227952e96
commit 369cade685
3 changed files with 163 additions and 11 deletions

View file

@ -35,6 +35,9 @@ save you many hours of grief.
background-color: #dddddd;
}
See the WebGUI help system about "Styles, Using" for more
information and examples.
* If you have downloaded and installed the HttpProxy wobject from
the contributions then you will need to delete it prior to
upgrading or the database upgrade will fail. To remove it
@ -57,19 +60,33 @@ save you many hours of grief.
* The discussions on USS and Articles have been turned off. They'll
need to be manually turned back on.
* The setting "cachePages" has been removed from the config file. It
has been moved to the content settings page inside the UI.
* The wobject API has changed significantly. It is backward
compatible for the time being, but if you're building custom
wobjects, you should migrate them to the new API. Doing so
will likely reduce a lot of the code in your wobject as an
added benefit.
* The setting "cacheInternational" has been removed from the config
file. The international messages are now automatically cached
if caching is available.
* If you do not use the automatic upgrade utility, you'll also need
to take note of the following gotchas:
* After upgrading please remove the SyndicatedContent.pm file from
sbin/Hourly as it is no longer required, and will cause
problems if it is not removed.
* The setting "cachePages" has been removed from the config
file. It has been moved to the content settings page
inside the UI.
* imageCollateralImport.pl has been replaced by collateralImport.pl.
Please delete imageCollateralImport.pl.
* The setting "cacheInternational" has been removed from the
config file. The international messages are now
automatically cached if caching is available.
* After upgrading please remove the SyndicatedContent.pm
file from sbin/Hourly as it is no longer required,
and will cause problems if it is not removed.
* imageCollateralImport.pl has been replaced by
collateralImport.pl. Please delete
imageCollateralImport.pl.
* The config file syntax has changed. Update your config
file to match etc/WebGUI.conf.original.
5.1.0

View file

@ -0,0 +1,127 @@
#!/usr/bin/perl
use lib "../../lib";
use Data::Config;
use Getopt::Long;
use Parse::PlainConfig;
use strict;
use WebGUI::Utility;
my $configFile;
my $quiet;
GetOptions(
'configFile=s'=>\$configFile,
'quiet'=>\$quiet
);
print "\tUpdating config file.\n" unless ($quiet);
my $pathToConfig = '../../etc/'.$configFile;
my $dataconfig = new Data::Config $pathToConfig;
my $plainconfig = Parse::PlainConfig->new('DELIM' => '=', 'PURGE' => 1);
my ($excludeWobject, $excludeMacro, $excludeAuthentication);
foreach my $key ($dataconfig->param) {
if ($key eq "excludeWobject") {
$excludeWobject = $dataconfig->param($key);
} elsif ($key eq "excludeMacro") {
$excludeMacro = $dataconfig->param($key);
} elsif ($key eq "excludeAuthentication") {
$excludeAuthentication = $dataconfig->param($key);
} elsif ($key eq "cachePages" || $key eq "cacheInternational") {
#do nothing
} else {
$plainconfig->set($key=>$dataconfig->param($key));
}
}
opendir (DIR,"../../lib/WebGUI/Wobject") or die "Can't find Wobjects.";
my @wobjectList = readdir(DIR);
closedir(DIR);
$excludeWobject =~ s/ //g;
my @excludeList = split(/,/,$excludeWobject);
my @wobjects;
foreach my $wobject (@wobjectList) {
if ($wobject =~ /(.*?)\.pm$/) {
$wobject = $1;
unless (isIn($wobject, @excludeList)) {
push(@wobjects,$wobject);
}
}
}
$plainconfig->set("wobjects"=>\@wobjects);
opendir (DIR,"../../lib/WebGUI/Macro") or die "Can't find Macros.";
my @macroList = readdir(DIR);
closedir(DIR);
$excludeMacro =~ s/ //g;
@excludeList = split(/,/,$excludeMacro);
my %macros;
foreach my $macro (@macroList) {
if ($macro =~ /(.*?)\.pm$/) {
$macro = $1;
unless (isIn($macro, @excludeList)) {
my @alias = split(/_/,$macro);
if ($alias[0] eq "Splat") {
$alias[0] = "*";
} elsif ($alias[0] eq "Slash") {
$alias[0] = "/";
} elsif ($alias[0] eq "Backslash") {
$alias[0] = '\\\\';
} elsif ($alias[0] eq "Question") {
$alias[0] = "?";
} elsif ($alias[0] eq "At") {
$alias[0] = "\@";
} elsif ($alias[0] eq "Hash") {
$alias[0] = "#";
}
$macros{$alias[0]} = $macro;
}
}
}
$plainconfig->set("macros"=>\%macros);
opendir (DIR,"../../lib/WebGUI/Authentication") or die "Can't find Auth Methods.";
my @authMethodList = readdir(DIR);
closedir(DIR);
$excludeAuthentication =~ s/ //g;
@excludeList = split(/,/,$excludeAuthentication);
push (@excludeList,"SMB");
my @authMethods;
foreach my $authMethod (@authMethodList) {
if ($authMethod =~ /(.*?)\.pm$/) {
$authMethod = $1;
unless (isIn($authMethod, @excludeList)) {
push(@authMethods,$authMethod);
}
}
}
$plainconfig->set("authMethods"=>\@authMethods);
$plainconfig->write($pathToConfig,3);
print "\tRemoving unneeded files.\n" unless ($quiet);
unlink("../../sbin/Hourly/SyndicatedContent.pm");
unlink("../../sbin/imageCollateralImport.pl");

View file

@ -139,12 +139,13 @@ closedir(DIR);
foreach $file (@files) {
if ($file =~ /upgrade_(\d+\.\d+\.\d+)-(\d+\.\d+\.\d+)\.(\w+)/) {
if (checkVersion($1)) {
$upgrade{$1}{dir} = $dir;
if ($3 eq "sql") {
print "\tFound upgrade script from $1 to $2.\n" unless ($quiet);
$upgrade{$1}{sql} = $dir.$file;
} elsif ($3 eq "pl") {
print "\tFound upgrade executable from $1 to $2.\n" unless ($quiet);
$upgrade{$1}{pl} = $dir.$file;
$upgrade{$1}{pl} = $file;
}
$upgrade{$1}{from} = $1;
$upgrade{$1}{to} = $2;
@ -223,6 +224,13 @@ foreach $config (keys %config) {
} else {
print "Failed!\n" unless ($quiet);
}
if ($upgrade{$upgrade}{pl} ne "") {
my $cmd = "cd ../docs/upgrades;perl ".$upgrade{$upgrade}{pl}." --configFile=".$config;
$cmd .= " --quiet" if ($quiet);
if (system($cmd)) {
print "\tProcessing upgrade executable failed!\n";
}
}
$config{$config}{version} = $upgrade{$upgrade}{to};
$notRun = 0;
}