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

SF.net SVN: ledger-smb:[4119] branches/1.3



Revision: 4119
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4119&view=rev
Author:   tshvr
Date:     2011-12-01 11:15:51 +0000 (Thu, 01 Dec 2011)
Log Message:
-----------
adding notes,coding postgresql-9.1

Modified Paths:
--------------
    branches/1.3/LedgerSMB/Database.pm
    branches/1.3/ledgersmb.conf.default

Modified: branches/1.3/LedgerSMB/Database.pm
===================================================================
--- branches/1.3/LedgerSMB/Database.pm	2011-12-01 11:12:13 UTC (rev 4118)
+++ branches/1.3/LedgerSMB/Database.pm	2011-12-01 11:15:51 UTC (rev 4119)
@@ -37,6 +37,8 @@
 
 my $temp = $LedgerSMB::Sysconfig::tempdir;
 
+my $logger = Log::Log4perl->get_logger('LedgerSMB::Database');
+
 =item LedgerSMB::Database->new({dbname = $dbname, countrycode = $cc, chart_name = $name, company_name = $company, username = $username, password = $password})
 
 This function creates a new database management object with the specified
@@ -354,24 +356,30 @@
 
 sub create {
     my ($self) = @_;
-    
+    $logger->trace("trying to create db \$ENV{PG_CONTRIB_DIR}=$ENV{PG_CONTRIB_DIR}");
     # We have to use template0 because of issues that Debian has with database 
     # encoding.  Apparently that causes problems for us, so template0 must be
     # used.
     my $rc = system("createdb -T template0 -E UTF8 > $temp/dblog");
+    $logger->trace("after create db \$rc=$rc");
     if ($rc) {
         return $rc;
     }
-
-     my @contrib_scripts = qw(pg_trgm tsearch2 tablefunc);
-
+    my $rc2=0;
+    my @contrib_scripts = qw(pg_trgm tsearch2 tablefunc);
+    if($ENV{PG_CONTRIB_DIR})
+    { 
+     #postgres 9.1 this is done by create extension pg_trgm btree_gist ..
      for my $contrib (@contrib_scripts){
-         my $rc2;
          $rc2=system("psql -f $ENV{PG_CONTRIB_DIR}/$contrib.sql >> $temp/dblog_stdout 2>>$temp/dblog_stderr");
          $rc ||= $rc2
      }
      my $rc2 = system("psql -f $self->{source_dir}sql/Pg-database.sql >> $temp/dblog_stdout 2>>$temp/dblog_stderr");
-     
+    }
+    else
+    {
+     $logger->info("Skipping contrib_scripts @contrib_scripts");
+    }     
      $rc ||= $rc2;
 
      # TODO Add logging of errors/notices

Modified: branches/1.3/ledgersmb.conf.default
===================================================================
--- branches/1.3/ledgersmb.conf.default	2011-12-01 11:12:13 UTC (rev 4118)
+++ branches/1.3/ledgersmb.conf.default	2011-12-01 11:15:51 UTC (rev 4119)
@@ -79,6 +79,8 @@
 default_db = lsmb13
 host = localhost
 db_namespace = public
+#contrib_dir PG_CONTRIB_DIR 
+#with postgresql-9.1 this stuff is in /usr/share/postgresql/9.1/extension and is injected in database with create extension pg_trgm,btree_gist...
 contrib_dir = /usr/share/pgsql/contrib/
 # sslmode can be require, allow, prefer, or disable.  Defaults to prefer.
 sslmode = prefer

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