Disable conf_cache by default, enable it only when safe to do so
authorJason Terry <jterry@bluehost.com>
Tue, 17 Feb 2015 16:50:56 +0000 (09:50 -0700)
committerIvan Kohler <ivan@freeside.biz>
Wed, 25 Feb 2015 02:54:53 +0000 (18:54 -0800)
Conflicts:
FS/FS/Conf.pm

FS/FS/Conf.pm
htetc/handler.pl

index 855c9f4..e204747 100644 (file)
@@ -1,7 +1,9 @@
 package FS::Conf;
 
 use strict;
-use vars qw($base_dir @config_items @base_items @card_types $DEBUG $conf_cache);
+use vars qw( $base_dir @config_items @base_items @card_types $DEBUG
+             $conf_cache $conf_cache_enabled
+           );
 use Carp;
 use IO::File;
 use File::Basename;
@@ -121,6 +123,7 @@ sub _config {
   my($self,$name,$agentnum,$agentonly)=@_;
   my $hashref = { 'name' => $name };
   local $FS::Record::conf = undef;  # XXX evil hack prevents recursion
+  $conf_cache = undef unless $conf_cache_enabled;  # use cache only when it is safe to do so
   my $cv;
   my @a = (
     ($agentnum || ()),
index 3c68e83..18108ab 100644 (file)
@@ -6,6 +6,9 @@ use strict;
 use warnings;
 use FS::Mason qw( mason_interps );
 use FS::Trace;
+use FS::Conf;
+
+$FS::Conf::conf_cache_enabled = 1; # enable FS::Conf caching for performance
 
 if ( %%%RT_ENABLED%%% ) {