jumping between areas.
* Much improved grant/revoke feature
* Allow creating and viewing composite types
+* pg_dumpall integration. Now you can download the entire cluster via
+ phpPgAdmin.
Translations
* Arabic from Zaki
/**
* Manage databases within a server
*
- * $Id: all_db.php,v 1.31 2004/07/19 10:21:36 jollytoad Exp $
+ * $Id: all_db.php,v 1.32 2004/08/04 07:44:02 chriskl Exp $
*/
// Include application functions
global $PHP_SELF, $lang, $_reload_drop_database;
if ($confirm) {
+ $misc->printNav('server','databases');
$misc->printTitle(array($lang['strdatabases'], $misc->printVal($_REQUEST['db']), $lang['strdrop']), 'drop_database');
echo "<p>", sprintf($lang['strconfdropdatabase'], $misc->printVal($_REQUEST['db'])), "</p>\n";
echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
// Fetch all tablespaces from the database
if ($data->hasTablespaces()) $tablespaces = &$data->getTablespaces();
+ $misc->printNav('server','databases');
$misc->printTitle(array($lang['strdatabases'], $lang['strcreatedatabase']), 'create_database');
$misc->printMsg($msg);
+
echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
echo "<table>\n";
echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strname']}</th>\n";
}
}
+ /**
+ * Displays options for cluster download
+ */
+ function doExport($msg = '') {
+ global $data, $misc;
+ global $PHP_SELF, $lang;
+
+ $misc->printNav('server','export');
+ $misc->printTitle(array($lang['strdatabases'], $lang['strexport']));
+ $misc->printMsg($msg);
+
+ echo "<form action=\"dbexport.php\" method=\"post\">\n";
+ echo "<table>\n";
+ echo "<tr><th class=\"data\">{$lang['strformat']}</th><th class=\"data\" colspan=\"2\">{$lang['stroptions']}</th></tr>\n";
+ // Data only
+ echo "<tr><th class=\"data left\" rowspan=\"2\">";
+ echo "<input type=\"radio\" name=\"what\" value=\"dataonly\" checked=\"checked\" />{$lang['strdataonly']}</th>\n";
+ echo "<td>{$lang['strformat']}</td>\n";
+ echo "<td><select name=\"d_format\">\n";
+ echo "<option value=\"copy\">COPY</option>\n";
+ echo "<option value=\"sql\">SQL</option>\n";
+ echo "</select>\n</td>\n</tr>\n";
+ echo "<td>{$lang['stroids']}</td><td><input type=\"checkbox\" name=\"d_oids\" /></td>\n</tr>\n";
+ // Structure only
+ echo "<tr><th class=\"data left\"><input type=\"radio\" name=\"what\" value=\"structureonly\" />{$lang['strstructureonly']}</th>\n";
+ echo "<td>{$lang['strdrop']}</td><td><input type=\"checkbox\" name=\"s_clean\" /></td>\n</tr>\n";
+ // Structure and data
+ echo "<tr><th class=\"data left\" rowspan=\"3\">";
+ echo "<input type=\"radio\" name=\"what\" value=\"structureanddata\" />{$lang['strstructureanddata']}</th>\n";
+ echo "<td>{$lang['strformat']}</td>\n";
+ echo "<td><select name=\"sd_format\">\n";
+ echo "<option value=\"copy\">COPY</option>\n";
+ echo "<option value=\"sql\">SQL</option>\n";
+ echo "</select>\n</td>\n</tr>\n";
+ echo "<td>{$lang['strdrop']}</td><td><input type=\"checkbox\" name=\"sd_clean\" /></td>\n</tr>\n";
+ echo "<td>{$lang['stroids']}</td><td><input type=\"checkbox\" name=\"sd_oids\" /></td>\n</tr>\n";
+ echo "</table>\n";
+
+ echo "<h3>{$lang['stroptions']}</h3>\n";
+ echo "<p><input type=\"radio\" name=\"output\" value=\"show\" checked=\"checked\" />{$lang['strshow']}\n";
+ echo "<br/><input type=\"radio\" name=\"output\" value=\"download\" />{$lang['strdownload']}</p>\n";
+
+ echo "<p><input type=\"hidden\" name=\"action\" value=\"export\" />\n";
+ echo "<p><input type=\"hidden\" name=\"mode\" value=\"cluster\" />\n";
+ echo $misc->form;
+ echo "<input type=\"submit\" value=\"{$lang['strexport']}\" /></p>\n";
+ echo "</form>\n";
+ }
+
/**
* Show default list of databases in the server
*/
global $data, $conf, $misc;
global $PHP_SELF, $lang;
+ $misc->printNav('server','databases');
$misc->printTitle(array($lang['strdatabases']), 'managing_databases');
$misc->printMsg($msg);
}
$misc->printHeader($lang['strdatabases']);
- $misc->printBody();
- $misc->printNav('server','databases');
+ $misc->printBody();
switch ($action) {
+ case 'export':
+ doExport();
+ break;
case 'save_create':
if (isset($_POST['cancel'])) doDefault();
else doSaveCreate();
/**
* Class to hold various commonly used functions
*
- * $Id: Misc.php,v 1.83 2004/07/22 12:47:38 jollytoad Exp $
+ * $Id: Misc.php,v 1.84 2004/08/04 07:44:03 chriskl Exp $
*/
class Misc {
'url' => "tablespaces.php",
'hide' => (!$data->hasTablespaces()),
),
+ 'export' => array (
+ 'title' => $lang['strexport'],
+ 'url' => "all_db.php?action=export",
+ 'hide' => (!$this->isDumpEnabled()),
+ ),
);
case 'database':
),
'privileges' => array (
'title' => $lang['strprivileges'],
- 'url' => "privileges.php?{$vars}&type=database&object=" . urlencode($_REQUEST['database']),
+ // Handle either 'object' or 'database' being set
+ 'url' => "privileges.php?{$vars}&type=database&object=" . urlencode((isset($_REQUEST['database']) ? $_REQUEST['database'] : $_REQUEST['object'])),
'hide' => (!isset($data->privlist['database'])),
),
'languages' => array (
/**
* Manage schemas within a database
*
- * $Id: database.php,v 1.57 2004/08/04 02:07:02 chriskl Exp $
+ * $Id: database.php,v 1.58 2004/08/04 07:44:03 chriskl Exp $
*/
// Include application functions
echo "<br /><input type=\"radio\" name=\"output\" value=\"gzipped\" />{$lang['strdownloadgzipped']}</p>\n";
echo "<p><input type=\"hidden\" name=\"action\" value=\"export\" />\n";
+ echo "<p><input type=\"hidden\" name=\"mode\" value=\"database\" />\n";
echo $misc->form;
echo "<input type=\"submit\" value=\"{$lang['strexport']}\" /></p>\n";
echo "</form>\n";
* Does an export to the screen or as a download. This checks to
* see if they have pg_dump set up, and will use it if possible.
*
- * $Id: dataexport.php,v 1.15 2004/06/07 15:39:38 chriskl Exp $
+ * $Id: dataexport.php,v 1.16 2004/08/04 07:44:03 chriskl Exp $
*/
$extensions = array(
// instead of custom dump code
if ($misc->isDumpEnabled()
&& ($_REQUEST['d_format'] == 'copy' || $_REQUEST['d_format'] == 'sql')) {
- $url = 'dbexport.php?database=' . urlencode($_REQUEST['database']);
+ $url = 'dbexport.php?mode=database&database=' . urlencode($_REQUEST['database']);
$url .= '&what=' . urlencode($_REQUEST['what']);
$url .= '&table=' . urlencode($_REQUEST['table']);
if ($data->hasSchemas()) $url .= '&schema=' . urlencode($_REQUEST['schema']);
// Check to see if they have pg_dump set up and if they do, use that
// instead of custom dump code
if ($misc->isDumpEnabled()) {
- $url = 'dbexport.php?database=' . urlencode($_REQUEST['database']);
+ $url = 'dbexport.php?mode=database&database=' . urlencode($_REQUEST['database']);
$url .= '&what=' . urlencode($_REQUEST['what']);
$url .= '&table=' . urlencode($_REQUEST['table']);
if ($data->hasSchemas()) $url .= '&schema=' . urlencode($_REQUEST['schema']);
// Check to see if they have pg_dump set up and if they do, use that
// instead of custom dump code
if ($misc->isDumpEnabled()) {
- $url = 'dbexport.php?database=' . urlencode($_REQUEST['database']);
+ $url = 'dbexport.php?mode=database&database=' . urlencode($_REQUEST['database']);
$url .= '&what=' . urlencode($_REQUEST['what']);
$url .= '&table=' . urlencode($_REQUEST['table']);
if ($data->hasSchemas()) $url .= '&schema=' . urlencode($_REQUEST['schema']);
* Does an export of a database or a table (via pg_dump)
* to the screen or as a download.
*
- * $Id: dbexport.php,v 1.11 2004/06/06 06:34:28 chriskl Exp $
+ * $Id: dbexport.php,v 1.12 2004/08/04 07:44:03 chriskl Exp $
*/
// Include application functions
// Prepare command line arguments
$hostname = $conf['servers'][$_SESSION['webdbServerID']]['host'];
$port = $conf['servers'][$_SESSION['webdbServerID']]['port'];
- $database = escapeshellarg($_REQUEST['database']);
-
- // Build command for executing pg_dump
- $cmd = escapeshellcmd($conf['servers'][$_SESSION['webdbServerID']]['pg_dump_path']) . " -i";
+
+ // Check if we're doing a cluster-wide dump or just a per-database dump
+ if ($_REQUEST['mode'] == 'database') {
+ // Build command for executing pg_dump. '-i' means ignore version differences.
+ $cmd = escapeshellcmd($conf['servers'][$_SESSION['webdbServerID']]['pg_dump_path']) . " -i";
+ }
+ else {
+ // Build command for executing pg_dump. '-i' means ignore version differences.
+ $cmd = escapeshellcmd($conf['servers'][$_SESSION['webdbServerID']]['pg_dumpall_path']) . " -i";
+ }
+
if ($hostname !== null && $hostname != '') {
$cmd .= " -h " . escapeshellarg($hostname);
}
}
// Check for a table specified
- if (isset($_REQUEST['table'])) {
+ if (isset($_REQUEST['table']) && $_REQUEST['mode'] == 'database') {
// 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..
}
// Check for GZIP compression specified
- if ($_REQUEST['output'] == 'gzipped') {
+ if ($_REQUEST['output'] == 'gzipped' && $_REQUEST['mode'] == 'database') {
$cmd .= " -Z 9";
}
break;
}
- $cmd .= " {$database}";
+ if ($_REQUEST['mode'] == 'database') {
+ $cmd .= " " . escapeshellarg($_REQUEST['database']);
+ }
// Execute command and return the output to the screen
passthru($cmd);