diff options
author | ivan <ivan> | 2002-06-28 08:23:44 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-06-28 08:23:44 +0000 |
commit | 25747983ac27c3b804a2f15312c8c7b59769e014 (patch) | |
tree | f70b8bbabdfed3928485bbe7fb12ba2ea9279219 | |
parent | a9f62de2c99fea32f8a1b86e4da3766fc0ad2b53 (diff) |
fix multi-database installs, while hopefully keeping performance improvement
-rw-r--r-- | FS/FS/Record.pm | 8 | ||||
-rw-r--r-- | FS/FS/UID.pm | 4 |
2 files changed, 7 insertions, 5 deletions
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 |