[Rt-commit] rt branch, 4.2/sanity-check-lifecycles, created. rt-4.2.9-41-g8212599

? sunnavy sunnavy at bestpractical.com
Wed Dec 3 11:14:40 EST 2014


The branch, 4.2/sanity-check-lifecycles has been created
        at  82125998e3fc38931d412f7825aa6078876d6bf7 (commit)

- Log -----------------------------------------------------------------
commit 82125998e3fc38931d412f7825aa6078876d6bf7
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Dec 3 23:04:54 2014 +0800

    check lifecycle settings on loading config
    
    so we can error it out on server start to warn admins
    
    Fixes: I#28352

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 4329fdb..a198954 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -982,6 +982,22 @@ our %META;
             Message => "The LogoImageWidth configuration option did not affect display, and has been removed; please remove it from your RT_SiteConfig.pm",
         },
     },
+    Lifecycles => {
+        Type            => 'HASH',
+        PostLoadCheck   => sub {
+            my $self  = shift;
+            if ( RT->SystemUser ) { # in case nodb is set in tests
+                my $queues     = RT::Queues->new( RT->SystemUser );
+                my @lifecycles = $queues->DistinctFieldValues( 'Lifecycle' );
+                my $config     = $self->Get( 'Lifecycles' );
+                for my $lifecycle ( @lifecycles ) {
+                    unless ( $config->{$lifecycle} ) {
+                        RT->Logger->error( qq{lifecycle "$lifecycle" is missing in %Lifecycles config} );
+                    }
+                }
+            }
+        },
+    },
 );
 my %OPTIONS = ();
 my @LOADED_CONFIGS = ();

-----------------------------------------------------------------------


More information about the rt-commit mailing list