[freeside-commits] freeside/FS/FS UID.pm,1.36,1.37
Ivan,,,
ivan at wavetail.420.am
Mon Mar 3 17:49:51 PST 2008
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv13922
Modified Files:
UID.pm
Log Message:
argh, don't load up a user until the other initialization is done
Index: UID.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/UID.pm,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- UID.pm 12 Jul 2007 21:08:02 -0000 1.36
+++ UID.pm 4 Mar 2008 01:49:49 -0000 1.37
@@ -2,7 +2,7 @@
use strict;
use vars qw(
- @ISA @EXPORT_OK $cgi $dbh $freeside_uid $user
+ @ISA @EXPORT_OK $DEBUG $me $cgi $dbh $freeside_uid $user
$conf_dir $secrets $datasrc $db_user $db_pass %callback @callback
$driver_name $AutoCommit $callback_hack $use_confcompat
);
@@ -20,6 +20,9 @@
getotaker dbh datasrc getsecrets driver_name myconnect
use_confcompat);
+$DEBUG = 0;
+$me = '[FS::UID]';
+
$freeside_uid = scalar(getpwnam('freeside'));
$conf_dir = "%%%FREESIDE_CONF%%%";
@@ -76,6 +79,7 @@
sub forksuidsetup {
$user = shift;
my $olduser = $user;
+ warn "$me forksuidsetup starting for $user\n" if $DEBUG;
if ( $FS::CurrentUser::upgrade_hack ) {
$user = 'fs_bootstrap';
@@ -95,39 +99,46 @@
croak "Not running uid freeside!" unless checkeuid();
+ warn "$me forksuidsetup connecting to database\n" if $DEBUG;
if ( $FS::CurrentUser::upgrade_hack && $olduser ) {
$dbh = &myconnect($olduser);
} else {
$dbh = &myconnect();
}
+ 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);
reload_dbdef("$conf_dir/dbdef.$datasrc")
unless $FS::Schema::setup_hack;
- FS::CurrentUser->load_user($user);
+ warn "$me forksuidsetup deciding upon config system to use\n" if $DEBUG;
- if ($dbh && ! $callback_hack) {
- my $sth = $dbh->prepare("SELECT COUNT(*) FROM conf") or die $dbh->errstr;
- $sth->execute or die $sth->errstr;
- my $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";
}
- unless($callback_hack) {
+ unless ( $callback_hack ) {
+ warn "$me calling callbacks\n" if $DEBUG;
foreach ( keys %callback ) {
&{$callback{$_}};
# breaks multi-database installs # delete $callback{$_}; #run once
}
&{$_} foreach @callback;
+ } else {
+ warn "$me skipping callbacks (callback_hack set)\n" if $DEBUG;
}
+ warn "$me forksuidsetup loading user\n" if $DEBUG;
+ FS::CurrentUser->load_user($user);
+
$dbh;
}
More information about the freeside-commits
mailing list