[Rt-commit] r14533 - rt/3.8/trunk/lib

ruz at bestpractical.com ruz at bestpractical.com
Fri Jul 25 19:08:46 EDT 2008


Author: ruz
Date: Fri Jul 25 19:08:46 2008
New Revision: 14533

Modified:
   rt/3.8/trunk/lib/RT.pm.in

Log:
* split changing of INC out from InitPlugins into InitPluginPaths

Modified: rt/3.8/trunk/lib/RT.pm.in
==============================================================================
--- rt/3.8/trunk/lib/RT.pm.in	(original)
+++ rt/3.8/trunk/lib/RT.pm.in	Fri Jul 25 19:08:46 2008
@@ -180,6 +180,8 @@
 
     CheckPerlRequirements();
 
+    InitPluginPaths();
+
     #Get a database connection
     ConnectToDatabase();
     InitSystemObjects();
@@ -411,7 +413,6 @@
     }
 }
 
-
 =head2 InitClasses
 
 Load all modules that define base classes.
@@ -561,43 +562,49 @@
     return \@PLUGINS;
 }
 
-=head2 InitPlugins
+=head2 InitPluginPaths
 
-Initialze all Plugins found in the RT configuration file, setting up their lib and HTML::Mason component roots.
+Push plugin's lib paths into @INC
 
 =cut
 
-sub InitPlugins {
-    my $self    = shift;
-    my @plugins;
-    use RT::Plugin;
-    foreach my $plugin (RT->Config->Get('Plugins')) {
-        next unless $plugin;
+sub InitPluginPaths {
+    my $self = shift;
+
+    foreach my $plugin (grep $_, RT->Config->Get('Plugins')) {
         my $plugindir = $plugin;
         $plugindir =~ s/::/-/g;
-        unless (-d $RT::LocalPluginPath."/$plugindir") {
-            $RT::Logger->crit("Plugin $plugindir not found in $RT::LocalPluginPath");
-        }
+        next unless -d $RT::LocalPluginPath."/$plugindir/lib";
 
         # Splice the plugin's lib dir into @INC;
         my @tmp_inc;
-
-
         for (@INC) {
             if ( $_ eq $RT::LocalLibPath) {
-                push @tmp_inc, $_, $RT::LocalPluginPath . "/$plugindir";
+                push @tmp_inc, $_, $RT::LocalPluginPath . "/$plugindir/lib";
             } else {
                 push @tmp_inc, $_;
             }
         }
-
         @INC = @tmp_inc;
+    }
+}
+
+=head2 InitPlugins
+
+Initialze all Plugins found in the RT configuration file, setting up their lib and HTML::Mason component roots.
+
+=cut
+
+sub InitPlugins {
+    my $self    = shift;
+    my @plugins;
+    require RT::Plugin;
+    foreach my $plugin (grep $_, RT->Config->Get('Plugins')) {
         $plugin->require;
         die $UNIVERSAL::require::ERROR if ($UNIVERSAL::require::ERROR);
         push @plugins, RT::Plugin->new(name =>$plugin);
     }
     return @plugins;
-
 }
 
 


More information about the Rt-commit mailing list