BUG Backup restore for windows

This commit is contained in:
Dany De Bontridder 2008-10-07 19:08:44 +00:00
parent 9fd761afaa
commit ec252a5df4
3 changed files with 19 additions and 10 deletions

View file

@ -64,14 +64,14 @@ if ( strpos($inc_path,";") != 0 ) {
$os=0; /* $os is 0 for unix */
} else {
$new_path=$inc_path.':../../include:addon';
$os=1; /* $os is 0 for windos */
$os=1; /* $os is 1 for windos */
}
set_include_path($new_path);
require_once('config_file.php');
/* The config file is created here */
if (isset($_POST['save_config'])) {
$url=config_file_create($_POST);
$url=config_file_create($_POST,1,$os);
}

View file

@ -39,9 +39,9 @@ if ($User->admin != 1) {
* \brief Make and restore backup
*/
/* For windows we need to set the path correctly */
if ( isset(PG_PATH)) {
if ( defined ('PG_PATH') )
putenv("PATH=",PG_PATH);
}
if ( isset ($_REQUEST['sa']) ) {
if ( ! isset ($_REQUEST['d']) ||
! isset($_REQUEST['t']))

View file

@ -88,7 +88,7 @@ function config_file_form($p_array=null)
*\see
*\todo
*/
function config_file_create($p_array,$from_setup=1) {
function config_file_create($p_array,$from_setup=1,$os=0) {
extract ($p_array);
$add=($from_setup==1)?'..'.DIRECTORY_SEPARATOR:'';
$hFile= fopen($add.'..'.DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'config.inc.php','w');
@ -100,11 +100,20 @@ function config_file_create($p_array,$from_setup=1) {
fputs($hFile,"\n\r");
fputs($hFile, 'define("PG_PATH","'.$cpath'");');
fputs($hFile,"\n\r");
fputs($hFile, 'define("PG_RESTORE","'.$cpath.DIRECTORY_SEPARATOR.'pg_restore ");');
fputs($hFile,"\n\r");
fputs($hFile, 'define("PG_DUMP","'.$cpath.DIRECTORY_SEPARATOR.'pg_dump ");');
fputs($hFile,"\n\r");
fputs($hFile, 'define ("PSQL","'.$cpath.DIRECTORY_SEPARATOR.'psql");');
if ( $os == 0 ) {
fputs($hFile, 'define("PG_RESTORE","'.$cpath.DIRECTORY_SEPARATOR.'pg_restore ");');
fputs($hFile,"\n\r");
fputs($hFile, 'define("PG_DUMP","'.$cpath.DIRECTORY_SEPARATOR.'pg_dump ");');
fputs($hFile,"\n\r");
fputs($hFile, 'define ("PSQL","'.$cpath.DIRECTORY_SEPARATOR.'psql");');
}
else {
fputs($hFile, 'define("PG_RESTORE","pg_restore.exe");');
fputs($hFile,"\n\r");
fputs($hFile, 'define("PG_DUMP","pg_dump.exe");');
fputs($hFile,"\n\r");
fputs($hFile, 'define ("PSQL","psql.exe");');
}
fputs($hFile,"\n\r");
fputs($hFile, 'define ("phpcompta_user","'.$cuser.'");');
fputs($hFile,"\n\r");