[Rt-commit] r13086 - in rt/branches/3.8-TESTING: . etc lib/RT

jesse at bestpractical.com jesse at bestpractical.com
Mon Jun 9 17:24:17 EDT 2008


Author: jesse
Date: Mon Jun  9 17:24:14 2008
New Revision: 13086

Modified:
   rt/branches/3.8-TESTING/   (props changed)
   rt/branches/3.8-TESTING/etc/RT_Config.pm.in
   rt/branches/3.8-TESTING/lib/RT.pm.in
   rt/branches/3.8-TESTING/lib/RT/Config.pm

Log:
 r32514 at 31b:  jesse | 2008-06-09 17:22:20 -0400
 * Move GraphViz, GD and GnuPG checks into RT/Config.pm
 * make config post-checks run after we have a db and logging
     - this means that in case of badness in the db or logging config, we don't have a hook to clean it up
 


Modified: rt/branches/3.8-TESTING/etc/RT_Config.pm.in
==============================================================================
--- rt/branches/3.8-TESTING/etc/RT_Config.pm.in	(original)
+++ rt/branches/3.8-TESTING/etc/RT_Config.pm.in	Mon Jun  9 17:24:14 2008
@@ -1300,20 +1300,6 @@
 =cut
 
 Set($CanonicalizeRedirectURLs, 0);
-
-=item C<$DisableGraphViz>
-
-=cut
-
-Set($DisableGraphViz, do { local $@; eval {require GraphViz; 1;} ? 0 : 1 } );
-
-=item C<$DisableGD>
-
-=cut
-
-Set($DisableGD, do { local $@; eval {require GD; 1;} ? 0 : 1 } );
-
-
 =item C<$EnableReminders>
 
 Hide links/portlets related to Reminders by setting this to 0

Modified: rt/branches/3.8-TESTING/lib/RT.pm.in
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT.pm.in	(original)
+++ rt/branches/3.8-TESTING/lib/RT.pm.in	Mon Jun  9 17:24:14 2008
@@ -159,27 +159,10 @@
     }
 
     my $gpgopts = $Config->Get('GnuPGOptions');
-    my $gpg = $Config->Get('GnuPG');
     unless ( File::Spec->file_name_is_absolute( $gpgopts->{homedir} ) ) {
         $gpgopts->{homedir} = File::Spec->catfile( $BasePath, $gpgopts->{homedir} );
     }
-        unless (-d $gpgopts->{homedir}  && -r _ ) { # no homedir, no gpg
-            warn "RT's GnuPG libraries couldn't successfully read your".
-            " configured GnuPG home directory (".$gpgopts->{homedir}
-            ."). PGP support has been disabled";
-            $gpg->{'Enable'} = 0;
-        }
-
     
-    if ($gpg->{'Enable'}) {
-        require RT::Crypt::GnuPG;
-        unless (RT::Crypt::GnuPG->Prove()) {
-            warn "RT's GnuPG libraries couldn't successfully execute gpg.".
-            " PGP support has been disabled";
-            $gpg->{'Enable'} = 0;
-        }
-    }
-
     RT::I18N->Init;
 }
 
@@ -200,6 +183,8 @@
     InitClasses();
     InitLogging(); 
     InitPlugins();
+    RT->Config->PostLoadCheck;
+
 }
 
 =head2 ConnectToDatabase

Modified: rt/branches/3.8-TESTING/lib/RT/Config.pm
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT/Config.pm	(original)
+++ rt/branches/3.8-TESTING/lib/RT/Config.pm	Mon Jun  9 17:24:14 2008
@@ -225,7 +225,7 @@
             return if $INC{'GraphViz.pm'};
             local $@;
             return if eval {require GraphViz; 1};
-            warn "You've enabled GraphViz, but we couldn't load the module: $@";
+            $RT::Logger->debug("You've enabled GraphViz, but we couldn't load the module: $@");
             $self->Set( DisableGraphViz => 1 );
         },
     },
@@ -238,13 +238,39 @@
             return if $INC{'GD.pm'};
             local $@;
             return if eval {require GD; 1};
-            warn "You've enabled GD, but we couldn't load the module: $@";
+            $RT::Logger->debug("You've enabled GD, but we couldn't load the module: $@");
             $self->Set( DisableGD => 1 );
         },
     },
     MailPlugins  => { Type => 'ARRAY' },
     GnuPG        => { Type => 'HASH' },
-    GnuPGOptions => { Type => 'HASH' },
+    GnuPGOptions => { Type => 'HASH',
+        PostLoadCheck => sub {
+            my $self = shift;
+    my $gpg = $self->Get('GnuPG');
+    my $gpgopts = $self->Get('GnuPGOptions');
+        unless (-d $gpgopts->{homedir}  && -r _ ) { # no homedir, no gpg
+            $RT::Logger->debug(
+             "RT's GnuPG libraries couldn't successfully read your".
+            " configured GnuPG home directory (".$gpgopts->{homedir}
+            ."). PGP support has been disabled");
+            $gpg->{'Enable'} = 0;
+        }
+
+    
+    if ($gpg->{'Enable'}) {
+        require RT::Crypt::GnuPG;
+        unless (RT::Crypt::GnuPG->Prove()) {
+            $RT::Logger->debug(
+            "RT's GnuPG libraries couldn't successfully execute gpg.".
+            " PGP support has been disabled");
+            $gpg->{'Enable'} = 0;
+        }
+    }
+
+        
+        
+        }},
 );
 my %OPTIONS = ();
 
@@ -294,7 +320,6 @@
     my @configs = $self->Configs;
     $self->InitConfig( File => $_ ) foreach @configs;
     $self->LoadConfig( File => $_ ) foreach @configs;
-    $self->PostLoadCheck;
     return;
 }
 
@@ -494,13 +519,13 @@
     my $type = $META{$name}->{'Type'} || 'SCALAR';
     if ( $type eq 'ARRAY' ) {
         $OPTIONS{$name} = [@_];
-        { no strict 'refs'; @{"RT::$name"} = (@_); }
+        { no warnings 'once'; no strict 'refs'; @{"RT::$name"} = (@_); }
     } elsif ( $type eq 'HASH' ) {
         $OPTIONS{$name} = {@_};
-        { no strict 'refs'; %{"RT::$name"} = (@_); }
+        { no warnings 'once';  no strict 'refs'; %{"RT::$name"} = (@_); }
     } else {
         $OPTIONS{$name} = shift;
-        { no strict 'refs'; ${"RT::$name"} = $OPTIONS{$name}; }
+        {no warnings 'once'; no strict 'refs'; ${"RT::$name"} = $OPTIONS{$name}; }
     }
     $META{$name}->{'Type'} = $type;
     return $self->_ReturnValue( $old, $type );


More information about the Rt-commit mailing list