[Rt-commit] rt branch, 4.2/init-plugins-once, created. rt-4.1.17-62-gb9f1a63
Thomas Sibley
trs at bestpractical.com
Fri Jul 19 19:43:20 EDT 2013
The branch, 4.2/init-plugins-once has been created
at b9f1a63b0bb96db06252470e9255fd287cea8a91 (commit)
- Log -----------------------------------------------------------------
commit b9f1a63b0bb96db06252470e9255fd287cea8a91
Author: Thomas Sibley <trs at bestpractical.com>
Date: Fri Jul 19 16:40:12 2013 -0700
Only try to init plugins once when no plugins are in use
Previously every call to RT->Plugins would try to init plugins when no
plugins were in use. This saves some method calls, cwd calls, and @INC
munging.
diff --git a/lib/RT.pm b/lib/RT.pm
index 1138fa1..17ca471 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -48,6 +48,7 @@
use strict;
use warnings;
+use 5.010;
package RT;
@@ -647,14 +648,17 @@ You can define plugins by adding them to the @Plugins list in your RT_SiteConfig
=cut
-our @PLUGINS = ();
sub Plugins {
+ state @PLUGINS;
+ state $DID_INIT = 0;
+
my $self = shift;
- unless (@PLUGINS) {
+ unless ($DID_INIT) {
$self->InitPluginPaths;
@PLUGINS = $self->InitPlugins;
+ $DID_INIT++;
}
- return \@PLUGINS;
+ return [@PLUGINS];
}
=head2 PluginDirs
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list