From: chriskl Date: Wed, 13 Apr 2005 08:33:01 +0000 (+0000) Subject: backport: fix dumping (again) on postgresql 8 for windows X-Git-Tag: REL_3-5-3~1 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=fda1e6bcfdd5ff6dcbf89e3ec304d59d6eeb3a5d;p=phppgadmin.git backport: fix dumping (again) on postgresql 8 for windows --- diff --git a/HISTORY b/HISTORY index 533eb100..82b09ebe 100644 --- a/HISTORY +++ b/HISTORY @@ -10,6 +10,8 @@ Bugs * Reload browser after executing arbitrary SQL * Fix browser in RTL languages * Fix inability to drop database using the drop link +* Fix last internal oid for PostgreSQL 8.0 +* Fix (again) dumping on v8 for windows, exclude dumping some objects. Version 3.5.2 ------------- diff --git a/classes/Misc.php b/classes/Misc.php index c8b6bd09..54cb6377 100644 --- a/classes/Misc.php +++ b/classes/Misc.php @@ -2,7 +2,7 @@ /** * Class to hold various commonly used functions * - * $Id: Misc.php,v 1.95.2.1 2004/12/06 03:07:17 chriskl Exp $ + * $Id: Misc.php,v 1.95.2.2 2005/04/13 08:33:01 chriskl Exp $ */ class Misc { @@ -1117,11 +1117,18 @@ * @return The escaped string */ function escapeShellArg($str) { - global $data; + global $data, $lang; if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $data->fieldClean($str); - return '"' . $str . '"'; + // Due to annoying PHP bugs, shell arguments cannot be escaped + // (command simply fails), so we cannot allow complex objects + // to be dumped. + if (ereg('^[_.[:alnum:]]+$', $str)) + return $str; + else { + echo $lang['strcannotdumponwindows']; + exit; + } } else return escapeshellarg($str); diff --git a/dbexport.php b/dbexport.php index da96fc94..2601b863 100644 --- a/dbexport.php +++ b/dbexport.php @@ -3,7 +3,7 @@ * Does an export of a database or a table (via pg_dump) * to the screen or as a download. * - * $Id: dbexport.php,v 1.14.2.5 2005/03/04 02:32:44 chriskl Exp $ + * $Id: dbexport.php,v 1.14.2.6 2005/04/13 08:33:01 chriskl Exp $ */ // Prevent timeouts @@ -39,14 +39,21 @@ break; } - // Set environmental variable for user and password that pg_dump uses + // Set environmental variables that pg_dump uses putenv('PGPASSWORD=' . $_SESSION['webdbPassword']); putenv('PGUSER=' . $_SESSION['webdbUsername']); - - // Prepare command line arguments $hostname = $conf['servers'][$_SESSION['webdbServerID']]['host']; + if ($hostname !== null && $hostname != '') { + putenv('PGHOST=' . $hostname); + } $port = $conf['servers'][$_SESSION['webdbServerID']]['port']; - + if ($port !== null && $port != '') { + putenv('PGPORT=' . $port); + } + if ($_REQUEST['mode'] == 'database') { + putenv('PGDATABASE=' . $_REQUEST['database']); + } + // Check if we're doing a cluster-wide dump or just a per-database dump if ($_REQUEST['mode'] == 'database') { // Get path of the pg_dump executable. @@ -60,13 +67,6 @@ // Build command for executing pg_dump. '-i' means ignore version differences. $cmd = $exe . " -i"; - if ($hostname !== null && $hostname != '') { - $cmd .= " -h " . $misc->escapeShellArg($hostname); - } - if ($port !== null && $port != '') { - $cmd .= " -p " . $misc->escapeShellArg($port); - } - // Check for a table specified if (isset($_REQUEST['table']) && $_REQUEST['mode'] == 'database') { @@ -114,10 +114,6 @@ break; } - if ($_REQUEST['mode'] == 'database') { - $cmd .= " " . $misc->escapeShellArg($_REQUEST['database']); - } - // Execute command and return the output to the screen passthru($cmd); } diff --git a/lang/english.php b/lang/english.php index c213c73d..db66cf17 100755 --- a/lang/english.php +++ b/lang/english.php @@ -4,7 +4,7 @@ * English language file for phpPgAdmin. Use this as a basis * for new translations. * - * $Id: english.php,v 1.167 2004/11/02 11:39:52 soranzo Exp $ + * $Id: english.php,v 1.167.2.1 2005/04/13 08:33:01 chriskl Exp $ */ // Language and character set @@ -145,6 +145,7 @@ $lang['strnouploads'] = 'File uploads are disabled.'; $lang['strimporterror'] = 'Import error.'; $lang['strimporterrorline'] = 'Import error on line %s.'; + $lang['strcannotdumponwindows'] = 'Dumping of complex table and schema names on Windows is not supported. Please see the FAQ.'; // Tables $lang['strtable'] = 'Table'; diff --git a/lang/recoded/english.php b/lang/recoded/english.php index 8336cc21..b56b6662 100644 --- a/lang/recoded/english.php +++ b/lang/recoded/english.php @@ -4,7 +4,7 @@ * English language file for phpPgAdmin. Use this as a basis * for new translations. * - * $Id: english.php,v 1.120 2004/11/02 11:39:52 soranzo Exp $ + * $Id: english.php,v 1.120.2.1 2005/04/13 08:33:02 chriskl Exp $ */ // Language and character set @@ -145,6 +145,7 @@ $lang['strnouploads'] = 'File uploads are disabled.'; $lang['strimporterror'] = 'Import error.'; $lang['strimporterrorline'] = 'Import error on line %s.'; + $lang['strcannotdumponwindows'] = 'Dumping of complex table and schema names on Windows is not supported. Please see the FAQ.'; // Tables $lang['strtable'] = 'Table';