Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/controllers/DbexportController.php')
-rw-r--r--src/controllers/DbexportController.php51
1 files changed, 27 insertions, 24 deletions
diff --git a/src/controllers/DbexportController.php b/src/controllers/DbexportController.php
index 2b177f3b..b720b967 100644
--- a/src/controllers/DbexportController.php
+++ b/src/controllers/DbexportController.php
@@ -48,7 +48,7 @@ class DbexportController extends BaseController
// Obtain the pg_dump version number and check if the path is good
$version = [];
- preg_match('/(\\d+(?:\\.\\d+)?)(?:\\.\\d+)?.*$/', exec($exe.' --version'), $version);
+ preg_match('/(\\d+(?:\\.\\d+)?)(?:\\.\\d+)?.*$/', exec($exe . ' --version'), $version);
if (empty($version)) {
$this->prtrace('$exe', $exe, 'version', $version[1]);
@@ -97,23 +97,26 @@ class DbexportController extends BaseController
}
// Set environmental variables that pg_dump uses
- putenv('PGPASSWORD='.$server_info['password']);
- putenv('PGUSER='.$server_info['username']);
+ putenv('PGPASSWORD=' . $server_info['password']);
+ putenv('PGUSER=' . $server_info['username']);
$hostname = $server_info['host'];
if (null !== $hostname && '' != $hostname) {
- putenv('PGHOST='.$hostname);
+ putenv('PGHOST=' . $hostname);
}
$port = $server_info['port'];
if (null !== $port && '' != $port) {
- putenv('PGPORT='.$port);
+ putenv('PGPORT=' . $port);
}
-
+ $cmd = $exe;
// Build command for executing pg_dump. '-i' means ignore version differences.
- if (((float) $version[1]) < 9.5) {
- $cmd = $exe.' -i';
+ // deprecated
+ /*if (((float) $version[1]) < 9.5) {
+ $this->prtrace('version', $version);
+
+ $cmd = $exe . ' -i';
} else {
- $cmd = $exe;
- }
+ $cmd = $exe;
+ }*/
// we are PG 7.4+, so we always have a schema
if (isset($_REQUEST['schema'])) {
@@ -125,7 +128,7 @@ class DbexportController extends BaseController
switch ($_REQUEST['subject']) {
case 'schema':
// This currently works for 8.2+ (due to the orthoganl -t -n issue introduced then)
- $cmd .= ' -n '.$this->misc->escapeShellArg("\"{$f_schema}\"");
+ $cmd .= ' -n ' . $this->misc->escapeShellArg("\"{$f_schema}\"");
break;
case 'table':
@@ -138,13 +141,13 @@ class DbexportController extends BaseController
// Starting in 8.2, -n and -t are orthagonal, so we now schema qualify
// the table name in the -t argument and quote both identifiers
if (((float) $version[1]) >= 8.2) {
- $cmd .= ' -t '.$this->misc->escapeShellArg("\"{$f_schema}\".\"{$f_object}\"");
+ $cmd .= ' -t ' . $this->misc->escapeShellArg("\"{$f_schema}\".\"{$f_object}\"");
} else {
// If we are 7.4 or higher, assume they are using 7.4 pg_dump and
// set dump schema as well. Also, mixed case dumping has been fixed
// then..
- $cmd .= ' -t '.$this->misc->escapeShellArg($f_object)
- .' -n '.$this->misc->escapeShellArg($f_schema);
+ $cmd .= ' -t ' . $this->misc->escapeShellArg($f_object)
+ . ' -n ' . $this->misc->escapeShellArg($f_schema);
}
}
@@ -185,21 +188,21 @@ class DbexportController extends BaseController
}
if (!$dumpall) {
- putenv('PGDATABASE='.$_REQUEST['database']);
+ putenv('PGDATABASE=' . $_REQUEST['database']);
} else {
//$cmd .= ' --no-role-password';
putenv('PGDATABASE');
}
- /*$this->prtrace(
- 'ENV VARS', [
- 'PGUSER' => getenv('PGUSER'),
- 'PGPASSWORD' => getenv('PGPASSWORD'),
- 'PGHOST' => getenv('PGHOST'),
- 'PGPORT' => getenv('PGPORT'),
- 'PGDATABASE' => getenv('PGDATABASE'),
- ]
- );*/
+ $this->prtrace(
+ 'ENV VARS', [
+ 'PGUSER' => getenv('PGUSER'),
+ 'PGPASSWORD' => getenv('PGPASSWORD'),
+ 'PGHOST' => getenv('PGHOST'),
+ 'PGPORT' => getenv('PGPORT'),
+ 'PGDATABASE' => getenv('PGDATABASE'),
+ ]
+ );
$this->prtrace('cmd', $cmd);
// Execute command and return the output to the screen