changed the upgrade system to die after fatal errors

This commit is contained in:
JT Smith 2004-03-07 21:02:46 +00:00
parent d8e2ac364b
commit ad681cad1e
3 changed files with 17 additions and 1 deletions

View file

@ -96,4 +96,6 @@ webgui.
- Added a view privileges setting to each forum.
- Bugfix [ 822805 ] Emptying trash can cause fatal error
(Thanks to Steve Simms.)
- Changed the upgrade system to stop after an error so the sys admin can fix
the problem before continuing.

View file

@ -1,5 +1,4 @@
#!/usr/bin/perl
use lib "../../lib";
use File::Path;
use Getopt::Long;

View file

@ -221,6 +221,7 @@ foreach my $config (keys %config) {
print "OK\n" unless ($quiet);
} else {
print "Failed!\n" unless ($quiet);
fatalError();
}
}
print "\tUpgrading to ".$upgrade{$upgrade}{to}."..." unless ($quiet);
@ -232,12 +233,14 @@ foreach my $config (keys %config) {
print "OK\n" unless ($quiet);
} else {
print "Failed!\n" unless ($quiet);
fatalError();
}
if ($upgrade{$upgrade}{pl} ne "") {
my $cmd = $perl." ".$upgrade{$upgrade}{pl}." --configFile=".$config;
$cmd .= " --quiet" if ($quiet);
if (system($cmd)) {
print "\tProcessing upgrade executable failed!\n";
fatalError();
}
}
$config{$config}{version} = $upgrade{$upgrade}{to};
@ -291,6 +294,18 @@ sub checkVersion {
}
}
#-----------------------------------------
sub fatalError {
print <<STOP;
The upgrade process failed and has stopped so you can either restore
from backup, or attempt to fix the problem and continue.
STOP
exit;
}
#-----------------------------------------
sub _parseDSN {
my($dsn, $args) = @_;