From 3db4021a4622f1950a87659df725e3f05677b88f Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Tue, 5 Jul 2011 09:46:58 -0500 Subject: [PATCH] allow upgrading a specific site or list of sites --- lib/WebGUI/Command/upgrade.pm | 16 ++++++++++++---- lib/WebGUI/Upgrade.pm | 9 ++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/WebGUI/Command/upgrade.pm b/lib/WebGUI/Command/upgrade.pm index 500d504a4..f065c6e42 100644 --- a/lib/WebGUI/Command/upgrade.pm +++ b/lib/WebGUI/Command/upgrade.pm @@ -29,6 +29,7 @@ sub opt_spec { [ 'backupdir=s', 'Directory to store database backups' ], [ 'mysql=s', 'mysql command line client to use' ], [ 'mysqldump=s', 'mysqldump command line client to use' ], + [ 'configFile=s@', 'Config file to upgrade. Multiple config files can be specified. If not specified, all available config files are used.' ], ); } @@ -98,9 +99,14 @@ sub run_upgrade { backupPath => $opt->{backupdir}, ) : (), ); - $upgrade->upgradeSites; + if ($opt->{configfile}) { + $upgrade->upgradeSites($opt->{configFile}); + } + else { + $upgrade->upgradeSites; + } - print < +=item C<--configFile www.example.com.conf> -Shows this documentation, then exits. +Upgrade a specific config file. Can be specified multiple times +to upgrade multiple sites. If not specified, all sites will be +upgraded. =back diff --git a/lib/WebGUI/Upgrade.pm b/lib/WebGUI/Upgrade.pm index aa17e12aa..7b91f2010 100644 --- a/lib/WebGUI/Upgrade.pm +++ b/lib/WebGUI/Upgrade.pm @@ -180,16 +180,19 @@ has _files_run => ( =head1 METHODS -=head2 upgradeSites +=head2 upgradeSites ( [ $configFiles ] ) Upgrades all available sites to match the current WebGUI codebase. +=head3 $configFiles + +An optional array reference of config file names. + =cut sub upgradeSites { my $self = shift; - require Carp; - my @configs = WebGUI::Paths->siteConfigs; + my @configs = $_[0] ? @{ $_[0] } : WebGUI::Paths->siteConfigs; my $i = 0; for my $configFile (@configs) { $i++;