[Fusionforge-commits] r12093 - branches/Branch_5_1/src/cronjobs

Roland Mas lolando at libremir.placard.fr.eu.org
Fri Jan 28 14:17:34 CET 2011


Author: lolando
Date: 2011-01-28 14:17:34 +0100 (Fri, 28 Jan 2011)
New Revision: 12093

Modified:
   branches/Branch_5_1/src/cronjobs/backup_site.php
Log:
Consider host and port of DB in backup_site cronjob [#206]

Modified: branches/Branch_5_1/src/cronjobs/backup_site.php
===================================================================
--- branches/Branch_5_1/src/cronjobs/backup_site.php	2011-01-28 12:18:58 UTC (rev 12092)
+++ branches/Branch_5_1/src/cronjobs/backup_site.php	2011-01-28 13:17:34 UTC (rev 12093)
@@ -28,6 +28,8 @@
 $database=forge_get_config('database_name');
 $username=forge_get_config('database_user');
 $password=forge_get_config('database_password');
+$host=forge_get_config('database_host');
+$port=forge_get_config('database_port');
 
 $datetime=date('Y-m-d'); //we will use this to concatenate it with the tar filename
 
@@ -66,7 +68,15 @@
 
 $output = "";
 $err = "";
- at exec('echo -n -e "'.$password.'\n" | pg_dump -U '.$username.' -v -Ft -b 2>&1 '.$database.' > '.$sys_path_to_backup.'db-'.$database.'-tmp-'.$datetime.'.tar ',$output,$retval);   //proceed with db dump
+$dump_cmd = 'pg_dump -U ' . $username;
+if ($host != '') {
+	$dump_cmd .= ' -h ' . $host;
+}
+if ($file != '') {
+	$dump_cmd .= ' -p ' . $port;
+}
+$dump_cmd .= ' -v -Ft -b '.$database;
+ at exec('echo -n -e "'.$password.'\n" | '.$dump_cmd.' 2>&1 > '.$sys_path_to_backup.'db-'.$database.'-tmp-'.$datetime.'.tar ',$output,$retval);   //proceed with db dump
 if($retval!=0){
 	$err.= implode("\n", $output);
 }




More information about the Fusionforge-commits mailing list