* Aggregate and opclass support for < 7.3
* The getType function needs to be ported to 7.2 and 7.3 classes to add
pretty type name and schema support
+* Add query start time to processes view for 7.4+
+* Report login errors
4. If you run your PHP installation in safe mode, in order that the database
dump feature can work correctly, you need to set the 'safe_mode_allowed_env_vars'
- php.ini variable to include the PGPASSWORD environmental variable.
+ php.ini variable to include the PGPASSWORD environmental variable and the
+ safe_mode_exec_dir to include /usr/local/bin.
+
+ eg. safe_mode_allowed_env_vars = PHP_,PGPASSWORD
+ safe_mode_exec_dir = /usr/bin
+
+ Given that you usually don't want to allow everything in /usr/bin to
+ be executed, you might want to copy the pg_dump and pg_dumpall utilities
+ to a directory by themselves.
Also, you will need to ensure that your 'pg_dump' and 'pg_dumpall' utilities
- are executable by the PHP process.
+ are executable by the PHP process, if you want dump support in phpPgAdmin.
5. Enable the statistics collector in PostgreSQL. phpPgAdmin will display
table and index performance and usage statistics if you have enabled the
following lines in your postgresql.conf and enable them:
stats_start_collector = true
- stats_command_string = true
- stats_block_level = true
- stats_row_level = true
+ stats_command_string = true
+ stats_block_level = true
+ stats_row_level = true
6. Browse to the phpPgAdmin installation using a web browser. You might
need cookies enabled for phpPgAdmin to work.
* Vacuum & analyze (half done)
* -ORDER BY in Select function (can do so after the fact now - chriskl)
* -Unify Select and Browse functions (chriskl)
+* Add option for showing table size counts
Views
-----
/**
* Class to hold various commonly used functions
*
- * $Id: Misc.php,v 1.56 2003/12/30 03:09:29 chriskl Exp $
+ * $Id: Misc.php,v 1.57 2004/01/29 07:30:12 chriskl Exp $
*/
class Misc {
function Misc() {
}
+ /**
+ * Checks if dumps are properly set up
+ * @param $all (optional) True to check pg_dumpall, false to just check pg_dump
+ * @return True, dumps are set up, false otherwise
+ */
+ function isDumpEnabled($all = false) {
+ global $conf;
+
+ if ($all)
+ return ($conf['servers'][$_SESSION['webdbServerID']]['pg_dumpall_path'] !== null
+ && $conf['servers'][$_SESSION['webdbServerID']]['pg_dumpall_path'] != '');
+ else
+ return ($conf['servers'][$_SESSION['webdbServerID']]['pg_dump_path'] !== null
+ && $conf['servers'][$_SESSION['webdbServerID']]['pg_dump_path'] != '');
+ }
+
/**
* Checks whether a login is allowed
* @return True if login is allowed to be used
echo "<td width=\"13%\"><a href=\"privileges.php?{$vars}&type=database&object=", urlencode($_REQUEST['database']), "\">{$lang['strprivileges']}</a></td>\n";
}
// Check that database dumps are enabled.
- if ($conf['pg_dump_path'] !== null && $conf['pg_dump_path'] != '') {
+ if ($this->isDumpEnabled()) {
echo "<td width=\"13%\"><a href=\"database.php?{$vars}&action=export\">{$lang['strexport']}</a></td>\n";
}
echo "</tr></table>\n";
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres.php,v 1.177 2004/01/18 11:09:12 chriskl Exp $
+ * $Id: Postgres.php,v 1.178 2004/01/29 07:30:12 chriskl Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
return $this->execute($sql);
}
- /**
- * Dumps a database
- */
- function dbDump($database) {
- global $appDumper;
-
- $database = escapeshellarg($database);
-
- passthru("/usr/local/bin/pg_dump {$database}");
- }
-
// Table functions
/**
* Central phpPgAdmin configuration. As a user you may modify the
* settings here for your particular configuration.
*
- * $Id: config.inc.php-dist,v 1.31 2003/12/13 16:15:48 chriskl Exp $
+ * $Id: config.inc.php-dist,v 1.32 2004/01/29 07:30:12 chriskl Exp $
*/
// An example server. Create as many of these as you wish,
// indexed from zero upwards.
- $conf['servers'][0]['desc'] = 'PostgreSQL'; // Display name for server
- $conf['servers'][0]['host'] = ''; // Hostname or IP address for server.
- // Null or '' indicates UNIX domain
- // socket.
- $conf['servers'][0]['port'] = 5432; // Database port on server
- $conf['servers'][0]['defaultdb'] = 'template1'; // Default database to connect to.
- // Only change this if your administrator
- // has disabled connections to template1.
+
+ // Display name for the server on the login screen
+ $conf['servers'][0]['desc'] = 'PostgreSQL';
+
+ // Hostname or IP address for server. Use '' for UNIX domain socket.
+ $conf['servers'][0]['host'] = '';
+
+ // Database port on server (5432 is the PostgreSQL default)
+ $conf['servers'][0]['port'] = 5432;
+
+ // Change the default database only if you cannot connect to template1
+ $conf['servers'][0]['defaultdb'] = 'template1';
+
+ // Specify the path to the database dump utilities for this server.
+ // You can set these to '' if no dumper is available.
+ $conf['servers'][0]['pg_dump_path'] = '/usr/bin/pg_dump';
+ $conf['servers'][0]['pg_dumpall_path'] = '/usr/bin/pg_dumpall';
// Example for a second server
- //$conf['servers'][1]['desc'] = 'Dev Server';
+ //$conf['servers'][1]['desc'] = 'Test Server';
//$conf['servers'][1]['host'] = '192.168.0.1';
//$conf['servers'][1]['port'] = 5432;
//$conf['servers'][1]['defaultdb'] = 'template1';
+ //$conf['servers'][1]['pg_dump_path'] = 'c:/cygwin/bin/pg_dump.exe';
+ //$conf['servers'][1]['pg_dumpall_path'] = '';
// Default language setting. eg 'english', 'polish', etc.
$conf['default_lang'] = 'english';
- // If extra login security is true, then logins via phpPgAdmin with no password
- // or certain usernames (pgsql, postgres, root, administrator) will be denied.
- // Only turn this off once you have read the FAQ and understand how to change
- // PostgreSQL's pg_hba.conf to enable passworded local connections.
+ // If extra login security is true, then logins via phpPgAdmin with no
+ // password or certain usernames (pgsql, postgres, root, administrator)
+ // will be denied. Only turn this off once you have read the FAQ and
+ // understand how to change PostgreSQL's pg_hba.conf to enable
+ // passworded local connections.
$conf['extra_login_security'] = true;
// Only show owned databases?
- // Note: This will simply hide other databases in the list - this does not
- // in any way prevent your users from seeing other database by other means.
- // (eg. Run 'SELECT * FROM pg_database' in the SQL area.)
+ // Note: This will simply hide other databases in the list - this does
+ // not in any way prevent your users from seeing other database by
+ // other means. (eg. Run 'SELECT * FROM pg_database' in the SQL area.)
$conf['owned_only'] = false;
- // Display "advanced" objects? Setting this to true will show types, operators
- // conversions, languages and casts in phpPgAdmin. These objects are rarely
- // administered and can clutter the interface.
+ // Display "advanced" objects? Setting this to true will show types,
+ // operators conversions, languages and casts in phpPgAdmin. These
+ // objects are rarely administered and can clutter the interface.
$conf['show_advanced'] = false;
// Display "system" objects?
$conf['show_system'] = false;
- // Display reports feature?
+ // Display reports feature? For this feature to work, you must
+ // install the reports database as explained in the INSTALL file.
$conf['show_reports'] = true;
// Only show owned reports?
- // Note: This does not prevent people from accessing other reports by other
- // means.
+ // Note: This does not prevent people from accessing other reports by
+ // other means.
$conf['owned_reports_only'] = false;
- // Allow database and cluster dumps?
- // Note: Set this to the fully qualified path name for your pg_dump
- // and pg_dumpall utilities. If you set them to '' or null, then the
- // feature will be disabled. Read the INSTALL file for more
- // information. Usual Win32 Cygwin dir is 'c:/cygwin/bin/pg_dump.exe'
- $conf['pg_dump_path'] = '/usr/bin/pg_dump';
- $conf['pg_dumpall_path'] = '/usr/bin/pg_dumpall';
-
// Minimum length users can set their password to.
$conf['min_password_length'] = 1;
* 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.10 2003/12/31 15:44:27 soranzo Exp $
+ * $Id: dataexport.php,v 1.11 2004/01/29 07:30:11 chriskl Exp $
*/
$extensions = array(
case 'dataonly':
// Check to see if they have pg_dump set up and if they do, use that
// instead of custom dump code
- if ($conf['pg_dump_path'] !== null && $conf['pg_dump_path'] != ''
+ if ($misc->isDumpEnabled()
&& ($_REQUEST['d_format'] == 'copy' || $_REQUEST['d_format'] == 'sql')) {
$url = 'dbexport.php?database=' . urlencode($_REQUEST['database']);
$url .= '&what=' . urlencode($_REQUEST['what']);
case 'structureonly':
// Check to see if they have pg_dump set up and if they do, use that
// instead of custom dump code
- if ($conf['pg_dump_path'] !== null && $conf['pg_dump_path'] != '') {
+ if ($misc->isDumpEnabled()) {
$url = 'dbexport.php?database=' . urlencode($_REQUEST['database']);
$url .= '&what=' . urlencode($_REQUEST['what']);
$url .= '&table=' . urlencode($_REQUEST['table']);
case 'structureanddata':
// Check to see if they have pg_dump set up and if they do, use that
// instead of custom dump code
- if ($conf['pg_dump_path'] !== null && $conf['pg_dump_path'] != '') {
+ if ($misc->isDumpEnabled()) {
$url = 'dbexport.php?database=' . urlencode($_REQUEST['database']);
$url .= '&what=' . urlencode($_REQUEST['what']);
$url .= '&table=' . urlencode($_REQUEST['table']);
* Does an export of a database to the screen or as a download.
* Can also dump a specific table of a database.
*
- * $Id: dbexport.php,v 1.6 2003/12/31 15:44:27 soranzo Exp $
+ * $Id: dbexport.php,v 1.7 2004/01/29 07:30:11 chriskl Exp $
*/
// Include application functions
include_once('./libraries/lib.inc.php');
// Check that database dumps are enabled.
- if ($conf['pg_dump_path'] !== null && $conf['pg_dump_path'] != '') {
+ if ($misc->isDumpEnabled()) {
// Make it do a download, if necessary
switch($_REQUEST['output']){
$database = escapeshellarg($_REQUEST['database']);
// Build command for executing pg_dump
- $cmd = escapeshellcmd($conf['pg_dump_path']) . " -i -U {$username}";
+ $cmd = escapeshellcmd($conf['servers'][$_SESSION['webdbServerID']]['pg_dump_path']) . " -i -U {$username}";
if ($hostname !== null && $hostname != '') {
$cmd .= " -h " . escapeshellarg($hostname);
}