[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[6331] trunk/LedgerSMB



Revision: 6331
          http://sourceforge.net/p/ledger-smb/code/6331
Author:   ehuelsmann
Date:     2014-01-01 17:13:30 +0000 (Wed, 01 Jan 2014)
Log Message:
-----------
Fix script loader issues:
* psql connected over local socket, even on localhost config in lsmb.
* empty user name due to $self->{user} reference (instead of 'username')
* clean up left over reference to $ENV{PGDATABASE}
* specify username and password on DBI->connect() call

Modified Paths:
--------------
    trunk/LedgerSMB/Database.pm
    trunk/LedgerSMB/Sysconfig.pm

Modified: trunk/LedgerSMB/Database.pm
===================================================================
--- trunk/LedgerSMB/Database.pm	2014-01-01 16:57:59 UTC (rev 6330)
+++ trunk/LedgerSMB/Database.pm	2014-01-01 17:13:30 UTC (rev 6331)
@@ -464,18 +464,19 @@
     # 
     # Hat tip:  irc user RhodiumToad on #postgresql -- CT
 
-    my $dbh = DBI->connect('dbi:Pg:dbname=postgres');
+    my $dbh = DBI->connect('dbi:Pg:dbname=postgres',
+			   $self->{username}, $self->{password});
 
     $dbh->{RaiseError} = 1;
     $dbh->{AutoCommit} = 1;
-    my $dbn = $dbh->quote_identifier($ENV{PGDATABASE});
+    my $dbn = $dbh->quote_identifier($self->{company_name});
     my $rc = $dbh->do("CREATE DATABASE $dbn WITH TEMPLATE template0 ENCODING 'UTF8'");
 
     $logger->trace("after create db \$rc=$rc");
     if (!$rc) {
         return $rc;
     }
-    $rc ||= $self->load_base_schema();
+    $rc = $self->load_base_schema();
 
      # TODO Add logging of errors/notices
 
@@ -554,9 +555,11 @@
 
     local %ENV;
 
-    $ENV{PGUSER} = $self->{user};
+    $ENV{PGUSER} = $self->{username};
     $ENV{PGPASSWORD} = $self->{password};
     $ENV{PGDATABASE} = $self->{company_name};
+    $ENV{PGHOST} = $LedgerSMB::Sysconfig::db_host;
+    $ENV{PGPORT} = $LedgerSMB::Sysconfig::db_port;
 
     open (LOG, '>>', $args->{log});
     if ($args->{errlog}) {

Modified: trunk/LedgerSMB/Sysconfig.pm
===================================================================
--- trunk/LedgerSMB/Sysconfig.pm	2014-01-01 16:57:59 UTC (rev 6330)
+++ trunk/LedgerSMB/Sysconfig.pm	2014-01-01 17:13:30 UTC (rev 6331)
@@ -188,8 +188,11 @@
 #log4perl.logger.LedgerSMB.ScriptLib.Company=TRACE
 #print STDERR localtime()." Sysconfig log4perl_config=$log4perl_config\n";
 
-$ENV{PGHOST} = $cfg->val('database', 'host');
-$ENV{PGPORT} = $cfg->val('database', 'port');
+our $db_host = $cfg->val('database', 'host');
+our $db_port = $cfg->val('database', 'port');
+
+$ENV{PGHOST} = $db_host;
+$ENV{PGPORT} = $db_port;
 our $default_db = $cfg->val('database', 'default_db');
 our $db_namespace = $cfg->val('database', 'db_namespace') || 'public';
 $ENV{PGSSLMODE} = $cfg->val('database', 'sslmode') 

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits