[Rt-commit] rt branch, 4.2/lifecycles-sanity-check-dies-on-rt3-upgrade, created. rt-4.2.10rc1-2-g6289088
? sunnavy
sunnavy at bestpractical.com
Wed Feb 25 13:51:19 EST 2015
The branch, 4.2/lifecycles-sanity-check-dies-on-rt3-upgrade has been created
at 628908832df9cb946f8eba19f3d2f9447aefeb70 (commit)
- Log -----------------------------------------------------------------
commit dd3a67be087dc5d187bcd342b5a996c4153936aa
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Feb 26 01:51:30 2015 +0800
in case there is no Lifecycle column in db
this could happen when user are upgrading from RT 3
diff --git a/lib/RT/Lifecycle.pm b/lib/RT/Lifecycle.pm
index 6abfd0a..9668bfd 100644
--- a/lib/RT/Lifecycle.pm
+++ b/lib/RT/Lifecycle.pm
@@ -627,9 +627,21 @@ sub FillCache {
my $map = RT->Config->Get('Lifecycles') or return;
- for my $name ( RT::Queues->new( RT->SystemUser )->DistinctFieldValues( 'Lifecycle' ) ) {
- unless ( $map->{$name} ) {
- warn "Lifecycle $name is missing in %Lifecycles config";
+ {
+ my @lifecycles;
+
+ # if users are upgrading from 3.* where we don't have lifecycle column yet,
+ # this could die. we also don't want to frighten them by the errors out
+ eval {
+ local $RT::Logger = Log::Dispatch->new;
+ @lifecycles = RT::Queues->new( RT->SystemUser )->DistinctFieldValues( 'Lifecycle' );
+ };
+ unless ( $@ ) {
+ for my $name ( @lifecycles ) {
+ unless ( $map->{$name} ) {
+ warn "Lifecycle $name is missing in %Lifecycles config";
+ }
+ }
}
}
commit 628908832df9cb946f8eba19f3d2f9447aefeb70
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Feb 26 02:10:30 2015 +0800
no need to warning out if lifecycle value is undef
because we automatically rollback it to 'default'.
this usually happen on rt3 -> rt4 upgrade when lifecyle column is created
(in 3.9.7) but the value "default" hasn't been set to it yet(till 4.0.7).
diff --git a/lib/RT/Lifecycle.pm b/lib/RT/Lifecycle.pm
index 9668bfd..3c786a6 100644
--- a/lib/RT/Lifecycle.pm
+++ b/lib/RT/Lifecycle.pm
@@ -634,7 +634,7 @@ sub FillCache {
# this could die. we also don't want to frighten them by the errors out
eval {
local $RT::Logger = Log::Dispatch->new;
- @lifecycles = RT::Queues->new( RT->SystemUser )->DistinctFieldValues( 'Lifecycle' );
+ @lifecycles = grep { defined } RT::Queues->new( RT->SystemUser )->DistinctFieldValues( 'Lifecycle' );
};
unless ( $@ ) {
for my $name ( @lifecycles ) {
-----------------------------------------------------------------------
More information about the rt-commit
mailing list