From: ivan Date: Fri, 28 Jun 2002 08:23:44 +0000 (+0000) Subject: fix multi-database installs, while hopefully keeping performance improvement X-Git-Tag: freeside_1_4_0_beta1~48 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=25747983ac27c3b804a2f15312c8c7b59769e014 fix multi-database installs, while hopefully keeping performance improvement --- diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index f7c3a41c8..7d5ff0582 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -2,7 +2,7 @@ package FS::Record; use strict; use vars qw( $dbdef_file $dbdef $setup_hack $AUTOLOAD @ISA @EXPORT_OK $DEBUG - $me ); + $me %dbdef_cache ); use subs qw(reload_dbdef); use Exporter; use Carp qw(carp cluck croak confess); @@ -1130,8 +1130,10 @@ I<$FS::Record::setup_hack> is true. Returns a DBIx::DBSchema object. sub reload_dbdef { my $file = shift || $dbdef_file; - $dbdef = load DBIx::DBSchema $file - or die "can't load database schema from $file"; + $dbdef = exists $dbdef_cache{$file} + ? $dbdef_cache{$file} + : $dbdef_cache{$file} = DBIx::DBSchema->load( $file ) + or die "can't load database schema from $file"; } =item dbdef diff --git a/FS/FS/UID.pm b/FS/FS/UID.pm index 87830cb04..b1e590f2f 100644 --- a/FS/FS/UID.pm +++ b/FS/FS/UID.pm @@ -92,7 +92,7 @@ sub forksuidsetup { foreach ( keys %callback ) { &{$callback{$_}}; - delete $callback{$_}; #run once + # breaks multi-database installs # delete $callback{$_}; #run once } $dbh; @@ -256,7 +256,7 @@ coderef into the hash %FS::UID::callback : =head1 VERSION -$Id: UID.pm,v 1.15 2002-06-14 09:19:33 ivan Exp $ +$Id: UID.pm,v 1.16 2002-06-28 08:23:44 ivan Exp $ =head1 BUGS