summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-09-19 14:32:11 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-09-19 14:32:11 +0000
commit0111f4d0b9c8260476f32d05d536bd2e04f918e5 (patch)
treeb0bd0fe001d079d3a7aca9e232a29d61d616d551 /LedgerSMB
parent2641c04880527e50d659bdecddb6162c8c977526 (diff)
If db superuser is now omitted, will try to create the dataset without
creating the database or language first. This can be useful in shared hosting environments. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@119 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rwxr-xr-xLedgerSMB/User.pm28
1 files changed, 16 insertions, 12 deletions
diff --git a/LedgerSMB/User.pm b/LedgerSMB/User.pm
index b4cfca78..8a2e362d 100755
--- a/LedgerSMB/User.pm
+++ b/LedgerSMB/User.pm
@@ -308,15 +308,17 @@ sub dbcreate {
&dbconnect_vars($form, $form->{dbdefault});
# The below line connects to Template1 or another template file in order
# to create the db. One must disconnect and reconnect later.
- my $superdbh = DBI->connect(
- $form->{dbconnect},
+ if ($form->{dbsuperuser}){
+ my $superdbh = DBI->connect(
+ $form->{dbconnect},
$form->{dbsuperuser},
$form->{dbsuperpasswd}
- ) or $form->dberror;
- my $query = qq|$dbcreate{$form->{dbdriver}}|;
- $superdbh->do($query) || $form->dberror($query);
+ ) or $form->dberror;
+ my $query = qq|$dbcreate{$form->{dbdriver}}|;
+ $superdbh->do($query) || $form->dberror($query);
- $superdbh->disconnect;
+ $superdbh->disconnect;
+ }
#Reassign for the work below
&dbconnect_vars($form, $form->{db});
@@ -326,19 +328,21 @@ sub dbcreate {
$form->{dbuser},
$form->{dbpasswd}
) or $form->dberror;
- my $superdbh = DBI->connect(
+ if ($form->{dbsuperuser}){
+ my $superdbh = DBI->connect(
$form->{dbconnect},
$form->{dbsuperuser},
$form->{dbsuperpasswd}
- ) or $form->dberror;
+ ) or $form->dberror;
# JD: We need to check for plpgsql, if it isn't there create it, if we can't error
# Good chance I will have to do this twice as I get used to the way the code is
# structured
- my %langcreate = ( 'Pg' => qq|CREATE LANGUAGE plpgsql|);
- my $query = qq|$langcreate{$form->{dbdriver}}|;
- $superdbh->do($query);
-
+ my %langcreate = ( 'Pg' => qq|CREATE LANGUAGE plpgsql|);
+ my $query = qq|$langcreate{$form->{dbdriver}}|;
+ $superdbh->do($query);
+ $superdbh->disconnect;
+ }
# create the tables
my $dbdriver = ($form->{dbdriver} =~ /Pg/) ? 'Pg' : $form->{dbdriver};