From 208ea281b7809d1b92c24983581936abbff72cc7 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 31 Dec 2008 00:20:54 +0000 Subject: [PATCH] Fix sbin/upgrade.pl so that it handles forking upgrade scripts without overwriting the config file changes in earlier upgrade scripts. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Config.pm | 18 ++++++++++++++++++ sbin/upgrade.pl | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index ddef11ece..c4b7a9884 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -19,6 +19,7 @@ - fixed #9352: Account activation message MIA - fixed #9046: Wiki tabs all combined (David Delikat) - refixed #9147: Misspellings in Account + - fixed #9348: Required Upgrade Step Not Documented - 7.6.0 7.6.7 - fixed #9263: Thingy possibleValues processing, and List type autodetection. diff --git a/lib/WebGUI/Config.pm b/lib/WebGUI/Config.pm index ec594ee74..ce8c6f639 100644 --- a/lib/WebGUI/Config.pm +++ b/lib/WebGUI/Config.pm @@ -64,6 +64,24 @@ These subroutines are available from this package: #------------------------------------------------------------------- +=head2 clearCache ( ) + +Clear the cache of in-memory configuration files. This is required by the upgrade script, which +forks to run each upgrade. When the child is reaped, the original is untouched, so that the +next script in the line recieves an old, in-memory config, essentially undoing any config +changes in the first upgrade script. + +This is a class method. + +=cut + +sub clearCache { + my $class = shift; + %config = (); +} + +#------------------------------------------------------------------- + =head2 getCookieName ( ) Returns the cookie name defined in the config file. Returns "wgSession" if one isn't defined. diff --git a/sbin/upgrade.pl b/sbin/upgrade.pl index 3302100d3..4fb9b6016 100644 --- a/sbin/upgrade.pl +++ b/sbin/upgrade.pl @@ -243,10 +243,12 @@ foreach my $filename (keys %config) { print "\tProcessing upgrade executable failed!\n"; fatalError(); } + ##Do a dummy load of the config + WebGUI::Config->clearCache(); } $config{$filename}{version} = $upgrade{$upgrade}{to}; $notRun = 0; - sleep 1; # Sleep a second to avoid adding asset revisions too quickly + sleep 1; # Sleep a second to avoid adding asset revisions too quickly } my $session = WebGUI::Session->open($webguiRoot,$filename); print "\tSetting site upgrade completed..." unless ($quiet);