[Rt-commit] r10281 - in rt/branches/3.7-RTIR-RELENG/lib: .

ruz at bestpractical.com ruz at bestpractical.com
Thu Jan 10 16:58:03 EST 2008


Author: ruz
Date: Thu Jan 10 16:58:02 2008
New Revision: 10281

Modified:
   rt/branches/3.7-RTIR-RELENG/lib/RT.pm.in
   rt/branches/3.7-RTIR-RELENG/lib/RT/Config.pm

Log:
* add InitCallbacks so extensions can push things from the config

Modified: rt/branches/3.7-RTIR-RELENG/lib/RT.pm.in
==============================================================================
--- rt/branches/3.7-RTIR-RELENG/lib/RT.pm.in	(original)
+++ rt/branches/3.7-RTIR-RELENG/lib/RT.pm.in	Thu Jan 10 16:58:02 2008
@@ -52,7 +52,7 @@
 
 use File::Spec ();
 
-use vars qw($Config $System $SystemUser $Nobody $Handle $Logger);
+use vars qw($Config $System $SystemUser $Nobody $Handle $Logger %InitCallbacks);
 
 our $VERSION = '@RT_VERSION_MAJOR at .@RT_VERSION_MINOR at .@RT_VERSION_PATCH@';
 
@@ -140,7 +140,8 @@
     ConnectToDatabase();
     InitSystemObjects();
     InitClasses();
-    InitLogging(); 
+    InitLogging();
+    $_->() foreach @{ $InitCallbacks{'Init'} || [] };
 }
 
 =head2 ConnectToDatabase
@@ -414,6 +415,7 @@
         RT::ObjectCustomFieldValue
         RT::Attribute
     );
+    $_->() foreach @{ $InitCallbacks{'InitClasses'} || [] };
 }
 
 =head2 InitSystemObjects
@@ -436,6 +438,8 @@
 
     require RT::System;
     $System = new RT::System;
+
+    $_->() foreach @{ $InitCallbacks{'InitSystemObjects'} || [] };
 }
 
 =head1 CLASS METHODS

Modified: rt/branches/3.7-RTIR-RELENG/lib/RT/Config.pm
==============================================================================
--- rt/branches/3.7-RTIR-RELENG/lib/RT/Config.pm	(original)
+++ rt/branches/3.7-RTIR-RELENG/lib/RT/Config.pm	Thu Jan 10 16:58:02 2008
@@ -279,6 +279,10 @@
                 Extension  => $is_ext,
             );
         };
+        local *Register = sub {
+            my ($type, $cb) = @_;
+            push @{ $RT::InitCallbacks{ $type } ||=[] }, $cb;
+        };
         local @INC = ($RT::LocalEtcPath, $RT::EtcPath, @INC);
         require $args{'File'};
     };


More information about the Rt-commit mailing list