[freeside-commits] freeside/FS/FS UID.pm,1.32.2.1,1.32.2.2
Ivan,,,
ivan at wavetail.420.am
Wed Jun 3 12:53:03 PDT 2009
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv26697
Modified Files:
Tag: FREESIDE_1_7_BRANCH
UID.pm
Log Message:
add a hack to set default schema, cf. http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration:PostgreSQL_Schema
Index: UID.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/UID.pm,v
retrieving revision 1.32.2.1
retrieving revision 1.32.2.2
diff -u -d -r1.32.2.1 -r1.32.2.2
--- UID.pm 14 Aug 2008 11:54:10 -0000 1.32.2.1
+++ UID.pm 3 Jun 2009 19:53:00 -0000 1.32.2.2
@@ -2,9 +2,9 @@
use strict;
use vars qw(
- @ISA @EXPORT_OK $cgi $dbh $freeside_uid $user
- $conf_dir $cache_dir $secrets $datasrc $db_user $db_pass %callback @callback
- $driver_name $AutoCommit
+ @ISA @EXPORT_OK $cgi $freeside_uid $user $conf_dir $cache_dir
+ $secrets $datasrc $db_user $db_pass $schema $dbh $driver_name
+ $AutoCommit %callback @callback
);
use subs qw(
getsecrets cgisetotaker
@@ -116,12 +116,24 @@
}
sub myconnect {
- DBI->connect( getsecrets(@_), { 'AutoCommit' => 0,
- 'ChopBlanks' => 1,
- 'ShowErrorStatement' => 1,
- }
- )
+ my $handle = DBI->connect( getsecrets(@_), { 'AutoCommit' => 0,
+ 'ChopBlanks' => 1,
+ 'ShowErrorStatement' => 1,
+ }
+ )
or die "DBI->connect error: $DBI::errstr\n";
+
+ if ( $schema ) {
+ use DBIx::DBSchema::_util qw(_load_driver ); #quelle hack
+ my $driver = _load_driver($handle);
+ if ( $driver =~ /^Pg/ ) {
+ no warnings 'redefine';
+ eval "sub DBIx::DBSchema::DBD::${driver}::default_db_schema {'$schema'}";
+ die $@ if $@;
+ }
+ }
+
+ $handle;
}
=item install_callback
@@ -290,10 +302,13 @@
$secrets = 'secrets';
}
- ($datasrc, $db_user, $db_pass) = $conf->config($secrets)
+ ($datasrc, $db_user, $db_pass, $schema) = $conf->config($secrets)
or die "Can't get secrets: $secrets: $!\n";
- $FS::Conf::default_dir = $conf_dir. "/conf.$datasrc";
undef $driver_name;
+
+ no warnings 'once';
+ $FS::Conf::default_dir = $conf_dir. "/conf.$datasrc";
+
($datasrc, $db_user, $db_pass);
}
More information about the freeside-commits
mailing list