backport: fix dumping (again) on postgresql 8 for windows
authorchriskl <chriskl>
Wed, 13 Apr 2005 08:33:01 +0000 (08:33 +0000)
committerchriskl <chriskl>
Wed, 13 Apr 2005 08:33:01 +0000 (08:33 +0000)
HISTORY
classes/Misc.php
dbexport.php
lang/english.php
lang/recoded/english.php

diff --git a/HISTORY b/HISTORY
index 533eb100550381485821d704ad49b32e8096b84b..82b09ebe4a0ef7099dd605a6d05e799cbc2309b7 100644 (file)
--- 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
 -------------
index c8b6bd09e8438fa5a297e63aae77d08ea50aad45..54cb6377b0df62b19e2a4f4645a1f8676e9e5f0e 100644 (file)
@@ -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 {
                 * @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);
index da96fc94c7763e04e722f8284928b32650ad8ba6..2601b863b9cd19147c0c6d4efed8d5be48c3aca7 100644 (file)
@@ -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
                                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.
                // 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') {
                        
                                break;
                }
                
-               if ($_REQUEST['mode'] == 'database') {
-                       $cmd .= " " . $misc->escapeShellArg($_REQUEST['database']);
-               }
-
                // Execute command and return the output to the screen
                passthru($cmd);
        }
index c213c73d6798b5e0064796b8ec9f0aa48e5ea50c..db66cf176d759206c4830fadae16ffc9059dbaf7 100755 (executable)
@@ -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
        $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';
index 8336cc21dbbd79aa8b9d7ee2bb10f76ff103ba78..b56b6662b45dc3883fc93482c5e3596fa129b5dc 100644 (file)
@@ -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
        $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';