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

SF.net SVN: ledger-smb: [1035] branches/1.2/LedgerSMB



Revision: 1035
          http://svn.sourceforge.net/ledger-smb/?rev=1035&view=rev
Author:   linuxpoet
Date:     2007-04-06 15:45:59 -0700 (Fri, 06 Apr 2007)

Log Message:
-----------
initial setup of backuppath with default to . Also adjusted to use correct db connect globals

Modified Paths:
--------------
    branches/1.2/LedgerSMB/AM.pm
    branches/1.2/LedgerSMB/Sysconfig.pm

Modified: branches/1.2/LedgerSMB/AM.pm
===================================================================
--- branches/1.2/LedgerSMB/AM.pm	2007-04-06 22:27:58 UTC (rev 1034)
+++ branches/1.2/LedgerSMB/AM.pm	2007-04-06 22:45:59 UTC (rev 1035)
@@ -1254,8 +1254,8 @@
 	if ($form->{file} =~ /^(.:)*?\/|:|\.\.\/|^\//){
 		$form->error("Directory transversal not allowed.");
 	}
-	if ($form->{file} =~ /^${LedgerSMB::Sysconfig::userspath}\//){
-		$form->error("Not allowed to access ${LedgerSMB::Sysconfig::userspath}/ with this method");
+	if ($form->{file} =~ /^${LedgerSMB::Sysconfig::backuppath}\//){
+		$form->error("Not allowed to access ${LedgerSMB::Sysconfig::backuppath}/ with this method");
 	}
 	my $whitelisted = 0;
 	for (@allowedsuff){
@@ -1604,7 +1604,7 @@
 	$t[4] = substr("0$t[4]", -2);
 
 	my $boundary = time;
-	my $tmpfile = "${LedgerSMB::Sysconfig::userspath}/$boundary.$myconfig->{dbname}-$form->{dbversion}-$t[5]$t[4]$t[3].sql";
+	my $tmpfile = "${LedgerSMB::Sysconfig::backuppath}/$boundary.$globalDBname-$form->{dbversion}-$t[5]$t[4]$t[3].sql";
 	$tmpfile .= ".gz" if ${LedgerSMB::Sysconfig::gzip};
 	$form->{OUT} = "$tmpfile";
 
@@ -1623,14 +1623,14 @@
 	my $suffix = "";
 
 	if ($form->{media} eq 'email') {
-		print OUT `pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} -Fc $myconfig->{dbname}`;
+		print OUT `pg_dump -U $globalDBUserName -h $globalDBhost -Fc -p $globalDBport $globalDBname`;
 		close OUT;
 		use LedgerSMB::Mailer;
 		$mail = new Mailer;
 
 		$mail->{to} = qq|"$myconfig->{name}" <$myconfig->{email}>|;
 		$mail->{from} = qq|"$myconfig->{name}" <$myconfig->{email}>|;
-		$mail->{subject} = "LedgerSMB Backup / $myconfig->{dbname}-$form->{dbversion}-$t[5]$t[4]$t[3].sql$suffix";
+		$mail->{subject} = "LedgerSMB Backup / $globalDBname-$form->{dbversion}-$t[5]$t[4]$t[3].sql$suffix";
 		@{ $mail->{attachments} } = ($tmpfile);
 		$mail->{version} = $form->{version};
 		$mail->{fileid} = "$boundary.";
@@ -1650,8 +1650,7 @@
 
 		print OUT qq|Content-Type: application/file;\n| .
 		qq|Content-Disposition: attachment; filename="$myconfig->{dbname}-$form->{dbversion}-$t[5]$t[4]$t[3].sql$suffix"\n\n|;
-		print OUT `pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} -Fc $myconfig->{dbname}`;
-
+		print OUT `pg_dump -U $globalDBUserName -h $globalDBhost -Fc -p $globalDBport $globalDBname`;
 	}
 
 	unlink "$tmpfile";

Modified: branches/1.2/LedgerSMB/Sysconfig.pm
===================================================================
--- branches/1.2/LedgerSMB/Sysconfig.pm	2007-04-06 22:27:58 UTC (rev 1034)
+++ branches/1.2/LedgerSMB/Sysconfig.pm	2007-04-06 22:45:59 UTC (rev 1035)
@@ -37,6 +37,9 @@
 # Temporary files stored at"
 $tempdir = ($ENV{TEMP} || '/tmp');
 
+# Backup path
+$backuppath = $tempdir;
+
 # member file
 $memberfile = "users/members";
 


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