[Rt-commit] rt branch, 4.2/plugin-directive-for-siteconfig, created. rt-4.1.5-6-g694aabc

Alex Vandiver alexmv at bestpractical.com
Thu Dec 6 15:42:30 EST 2012


The branch, 4.2/plugin-directive-for-siteconfig has been created
        at  694aabcd06655c3e45f1c757b0f07f09c99c46ce (commit)

- Log -----------------------------------------------------------------
commit 694aabcd06655c3e45f1c757b0f07f09c99c46ce
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Dec 6 15:41:30 2012 -0500

    Add a Plugin() command for use in RT_SiteConfig.pm
    
    This works around the awkwardness of saying "Add a @Plugins line, or
    modify your existing line," and simply turns it into "Add the following
    line"

diff --git a/etc/RT_SiteConfig.pm b/etc/RT_SiteConfig.pm
index 05cdb0b..683f2b7 100755
--- a/etc/RT_SiteConfig.pm
+++ b/etc/RT_SiteConfig.pm
@@ -20,7 +20,7 @@ Set( $rtname, 'example.com');
 
 # You must install Plugins on your own, this is only an example
 # of the correct syntax to use when activating them.
-# There should only be one @Plugins declaration in your config file.
-#Set(@Plugins,(qw(RT::Extension::QuickDelete RT::Extension::CommandByMail)));
+# Plugin( "RT::Extension::QuickDelete" );
+# Plugin( "RT::Extension::CommandByMail" );
 
 1;
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 723d753..5f821fa 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -919,6 +919,19 @@ sub _LoadConfig {
                 Extension  => $is_ext,
             );
         };
+        local *Plugin = sub {
+            my (@new_plugins) = @_;
+            my ( $pack, $file, $line ) = caller;
+            return $self->SetFromConfig(
+                Option     => \@RT::Plugins,
+                Value      => [@RT::Plugins, @new_plugins],
+                Package    => $pack,
+                File       => $file,
+                Line       => $line,
+                SiteConfig => $is_site,
+                Extension  => $is_ext,
+            );
+        };
         my @etc_dirs = ($RT::LocalEtcPath);
         push @etc_dirs, RT->PluginDirs('etc') if $is_ext;
         push @etc_dirs, $RT::EtcPath, @INC;

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


More information about the Rt-commit mailing list