X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FUID.pm;h=431efb16d154bf3de8c252c1dc3339d3286a2761;hb=4b5d4c82766ef1869d03df63fa1e2f0dd050cb6a;hp=356efa49c1153c3be1ad3e5a7b5565060fe3dfd8;hpb=37d83fa441f945be8f62ecb3bea3cc29c55aa181;p=freeside.git diff --git a/FS/FS/UID.pm b/FS/FS/UID.pm index 356efa49c..431efb16d 100644 --- a/FS/FS/UID.pm +++ b/FS/FS/UID.pm @@ -3,7 +3,7 @@ package FS::UID; use strict; use vars qw( @ISA @EXPORT_OK $DEBUG $me $cgi $dbh $freeside_uid $user - $conf_dir $secrets $datasrc $db_user $db_pass %callback @callback + $conf_dir $cache_dir $secrets $datasrc $db_user $db_pass %callback @callback $driver_name $AutoCommit $callback_hack $use_confcompat ); use subs qw( @@ -25,7 +25,8 @@ $me = '[FS::UID]'; $freeside_uid = scalar(getpwnam('freeside')); -$conf_dir = "%%%FREESIDE_CONF%%%"; +$conf_dir = "%%%FREESIDE_CONF%%%"; +$cache_dir = "%%%FREESIDE_CACHE%%%"; $AutoCommit = 1; #ours, not DBI $use_confcompat = 1; @@ -108,25 +109,26 @@ sub forksuidsetup { warn "$me forksuidsetup connected to database with handle $dbh\n" if $DEBUG; warn "$me forksuidsetup loading schema\n" if $DEBUG; - use FS::Schema qw(reload_dbdef); + use FS::Schema qw(reload_dbdef dbdef); reload_dbdef("$conf_dir/dbdef.$datasrc") unless $FS::Schema::setup_hack; warn "$me forksuidsetup deciding upon config system to use\n" if $DEBUG; - my $confcount = 0; + if ( ! $FS::Schema::setup_hack && dbdef->table('conf') ) { - my $sth = $dbh->prepare("SELECT COUNT(*) FROM conf"); - if ( $sth ) { - if ( $sth->execute ) { - $confcount = $sth->fetchrow_arrayref->[0]; + my $sth = $dbh->prepare("SELECT COUNT(*) FROM conf") or die $dbh->errstr; + $sth->execute or die $sth->errstr; + my $confcount = $sth->fetchrow_arrayref->[0]; + + if ($confcount) { + $use_confcompat = 0; + }else{ + warn "NO CONFIGURATION RECORDS FOUND"; } - } - if ($confcount) { - $use_confcompat = 0; - }else{ - warn "NO CONFIGURATION RECORDS FOUND"; + } else { + warn "NO CONFIGURATION TABLE FOUND"; } unless ( $callback_hack ) {