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

SF.net SVN: ledger-smb:[3165] trunk/LedgerSMB/Initiate.pm



Revision: 3165
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3165&view=rev
Author:   einhverfr
Date:     2011-05-22 23:35:56 +0000 (Sun, 22 May 2011)

Log Message:
-----------
Committing patch 2945481

Modified Paths:
--------------
    trunk/LedgerSMB/Initiate.pm

Modified: trunk/LedgerSMB/Initiate.pm
===================================================================
--- trunk/LedgerSMB/Initiate.pm	2011-05-22 22:39:43 UTC (rev 3164)
+++ trunk/LedgerSMB/Initiate.pm	2011-05-22 23:35:56 UTC (rev 3165)
@@ -211,7 +211,7 @@
 	my @chartgififiles=LedgerSMB::Initiate->merge_chart_gifi_valid_exist($form);   # check sql/coa/charts and sql/coa/gifi files
 
 	my @totalexecutable_files;
-	push(@totalexecutable_files,@contrib);
+#	push(@totalexecutable_files,@contrib);
 	push(@totalexecutable_files,@postsql);
 	push(@totalexecutable_files,@sqlmodules);
 	push(@totalexecutable_files,@chartgififiles);
@@ -245,6 +245,7 @@
             $form->{dbhost},$form->{dbport}));
 
 	LedgerSMB::Initiate->create_database($form); 
+	LedgerSMB::Initiate->run_scripts_as_superuser($form,..hidden..);
 
     # Now connect to the newly created database as the admin user
     # This connection is used for all subsequent operations
@@ -592,13 +593,29 @@
 }
 
 
+sub run_scripts_as_superuser
+{
 
+	my ($self,$form,$files)..hidden..;
 
+    $ENV{PGDATABASE} = $form->{database};
+    $ENV{PGHOST}     = $form->{dbhost};
+    $ENV{PGPORT}     = $form->{dbport};
+    $ENV{PGUSER}     = $form->{username};
+    $ENV{PGPASSWORD} = $form->{password};
 
+	foreach $dbfile(@$files)
+	{
+		$logger->debug("Loading $dbfile");
+        system("psql < $dbfile");
+	}
+}
 
 
 
 
+
+
 sub read_directory
 {
 


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