Permalink
Browse files

Merge branch 'master' of git@github.com:xzilla/phppgadmin

  • Loading branch information...
2 parents ac57f59 + 891db96 commit 972068b7e2c24e78695b92d12f4f981d6b6900e4 Robert Treat committed Mar 27, 2009
Showing with 32 additions and 13 deletions.
  1. +2 −0 classes/Misc.php
  2. +1 −1 classes/database/Postgres.php
  3. +21 −12 dbexport.php
  4. +2 −0 lang/english.php
  5. +2 −0 lang/recoded/english.php
  6. +4 −0 themes/default/global.css
View
@@ -153,6 +153,8 @@ function printVal($str, $type = null, $params = array()) {
}
break;
case 'bytea':
+ $tag = 'div';
+ $class = 'pre';
$out = $data->escapeBytea($str);
break;
case 'pre':
@@ -7416,7 +7416,7 @@ function getStatsTableTuples($table) {
$this->clean($table);
$sql = "SELECT * FROM pg_stat_all_tables
- WHERE schemaname=\'{$this->_schema}\' AND relname='{$table}'";
+ WHERE schemaname='{$this->_schema}' AND relname='{$table}'";
return $this->selectSet($sql);
}
View
@@ -13,8 +13,28 @@
$_no_output = true;
include_once('./libraries/lib.inc.php');
+ // Are we doing a cluster-wide dump or just a per-database dump
+ $dumpall = ($_REQUEST['subject'] == 'server');
+
// Check that database dumps are enabled.
- if ($misc->isDumpEnabled()) {
+ if ($misc->isDumpEnabled($dumpall)) {
+
+ $server_info = $misc->getServerInfo();
+
+ // Get the path of the pg_dump/pg_dumpall executable
+ $exe = $misc->escapeShellCmd($server_info[$dumpall ? 'pg_dumpall_path' : 'pg_dump_path']);
+
+ // Obtain the pg_dump version number and check if the path is good
+ $version = array();
+ preg_match("/(\d+(?:\.\d+)?)(?:\.\d+)?.*$/", exec($exe . " --version"), $version);
+
+ if (empty($version)) {
+ if ($dumpall)
+ printf($lang['strbadpgdumpallpath'], $server_info['pg_dumpall_path']);
+ else
+ printf($lang['strbadpgdumppath'], $server_info['pg_dump_path']);
+ exit;
+ }
// Make it do a download, if necessary
switch($_REQUEST['output']){
@@ -40,7 +60,6 @@
}
// Set environmental variables that pg_dump uses
- $server_info = $misc->getServerInfo();
putenv('PGPASSWORD=' . $server_info['password']);
putenv('PGUSER=' . $server_info['username']);
$hostname = $server_info['host'];
@@ -52,12 +71,6 @@
putenv('PGPORT=' . $port);
}
- // Are we doing a cluster-wide dump or just a per-database dump
- $dumpall = ($_REQUEST['subject'] == 'server');
-
- // Get the path og the pg_dump/pg_dumpall executable
- $exe = $misc->escapeShellCmd($server_info[$dumpall ? 'pg_dumpall_path' : 'pg_dump_path']);
-
// Build command for executing pg_dump. '-i' means ignore version differences.
$cmd = $exe . " -i";
@@ -69,10 +82,6 @@
break;
case 'table':
case 'view':
- // Obtain the pg_dump version number
- $version = array();
- preg_match("/(\d+(?:\.\d+)?)(?:\.\d+)?.*$/", exec($exe . " --version"), $version);
-
// 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 ) {
View
@@ -180,6 +180,8 @@
$lang['strcannotdumponwindows'] = 'Dumping of complex table and schema names on Windows is not supported.';
$lang['strinvalidserverparam'] = 'Attempt to connect with invalid server parameter, possibly someone is trying to hack your system.';
$lang['strnoserversupplied'] = 'No server supplied!';
+ $lang['strbadpgdumppath'] = 'Export error: Failed to execute pg_dump (given path in your conf/config.inc.php : %s). Please, fix this path in your configuration and relog.';
+ $lang['strbadpgdumpallpath'] = 'Export error: Failed to execute pg_dumpall (given path in your conf/config.inc.php : %s). Please, fix this path in your configuration and relog.';
// Tables
$lang['strtable'] = 'Table';
View
@@ -180,6 +180,8 @@
$lang['strcannotdumponwindows'] = 'Dumping of complex table and schema names on Windows is not supported.';
$lang['strinvalidserverparam'] = 'Attempt to connect with invalid server parameter, possibly someone is trying to hack your system.';
$lang['strnoserversupplied'] = 'No server supplied!';
+ $lang['strbadpgdumppath'] = 'Export error: Failed to execute pg_dump (given path in your conf/config.inc.php : %s). Please, fix this path in your configuration and relog.';
+ $lang['strbadpgdumpallpath'] = 'Export error: Failed to execute pg_dumpall (given path in your conf/config.inc.php : %s). Please, fix this path in your configuration and relog.';
// Tables
$lang['strtable'] = 'Table';
@@ -417,3 +417,7 @@ border:1px solid #D9D95F;
.normal_field {
}
+
+.pre {
+white-space:pre;
+}

0 comments on commit 972068b

Please sign in to comment.