can't edit SELECT results by oid
investigate phpPgInfo
-Fix
----
-
-* Does dropping a database work at all?
-
+Need to fix:
+* Variables and processes views for < 7.3
Databases
---------
-* Fix failure to drop database even tho seemingly no-one is connected to it
+* -Fix failure to drop database even tho seemingly no-one is connected to it (chriskl, bryan)
* Add alter database for 7.3+
* Dump database using pg_dump streaming
* -Cluster support
* Vacuum & analyze (half done)
* ORDER BY in Select function
-* Unify Select and Browse functions
+* -Unify Select and Browse functions (chriskl)
Views
-----
Settings
--------
-* Postgres 7.3 returns SHOW ALL as a proper result set - makes it easy to do a phpMyAdmin style 'view settings'.
+* -Postgres 7.3 returns SHOW ALL as a proper result set - makes it easy to do a phpMyAdmin style 'view settings'.
Miscellaneous
-------------
/**
* Class to hold various commonly used functions
*
- * $Id: Misc.php,v 1.50 2003/12/10 16:03:30 chriskl Exp $
+ * $Id: Misc.php,v 1.51 2003/12/13 09:28:46 chriskl Exp $
*/
class Misc {
// Send XHTML headers, or regular HTML headers
if (isset($conf['use_xhtml']) && $conf['use_xhtml']) {
echo "<?xml version=\"1.0\" encoding=\"", htmlspecialchars($lang['appcharset']), "\"?>\n";
- echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd\">\n";\r
+ echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd\">\n";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
} else {
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
echo "<table class=\"navbar\" border=\"0\" width=\"100%\" cellpadding=\"5\" cellspacing=\"3\"><tr>\n";
// Only show schemas if available
if ($data->hasSchemas()) {
- echo "<td width=\"20%\"><a href=\"database.php?{$vars}\">{$lang['strschemas']}</a></td>\n";
+ echo "<td width=\"14%\"><a href=\"database.php?{$vars}\">{$lang['strschemas']}</a></td>\n";
}
// Only show database privs if available
if (isset($data->privlist['database'])) {
- echo "<td width=\"20%\"><a href=\"privileges.php?{$vars}&type=database&object=", urlencode($_REQUEST['database']), "\">{$lang['strprivileges']}</a></td>\n";
+ echo "<td width=\"14%\"><a href=\"privileges.php?{$vars}&type=database&object=", urlencode($_REQUEST['database']), "\">{$lang['strprivileges']}</a></td>\n";
}
- echo "<td width=\"20%\"><a href=\"database.php?{$vars}&action=sql\">{$lang['strsql']}</a></td>\n";
- echo "<td width=\"20%\"><a href=\"database.php?{$vars}&action=find\">{$lang['strfind']}</a></td>\n";
- echo "<td width=\"20%\"><a href=\"database.php?{$vars}&action=admin\">{$lang['stradmin']}</a></td>\n";
+ echo "<td width=\"14%\"><a href=\"database.php?{$vars}&action=sql\">{$lang['strsql']}</a></td>\n";
+ echo "<td width=\"14%\"><a href=\"database.php?{$vars}&action=find\">{$lang['strfind']}</a></td>\n";
+ echo "<td width=\"14%\"><a href=\"database.php?{$vars}&action=variables\">{$lang['strvariables']}</a></td>\n";
+ echo "<td width=\"14%\"><a href=\"database.php?{$vars}&action=processes\">{$lang['strprocesses']}</a></td>\n";
+ echo "<td width=\"14%\"><a href=\"database.php?{$vars}&action=admin\">{$lang['stradmin']}</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.165 2003/12/10 16:03:30 chriskl Exp $
+ * $Id: Postgres.php,v 1.166 2003/12/13 09:28:46 chriskl Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
return $this->selectRow($sql);
}
+ /**
+ * Returns all available variable information.
+ * @return A recordset
+ */
+ function &getVariables() {
+ $sql = "SHOW ALL";
+
+ return $this->selectSet($sql);
+ }
+
+ /**
+ * Returns all available process information.
+ * @param $database (optional) Find only connections to specified database
+ * @return A recordset
+ */
+ function &getProcesses($database = null) {
+ if ($database === null)
+ $sql = "SELECT * FROM pg_stat_activity ORDER BY datname, usename, procpid";
+ else {
+ $this->clean($database);
+ $sql = "SELECT * FROM pg_stat_activity WHERE datname='{$database}' ORDER BY usename, procpid";
+ }
+
+ return $this->selectSet($sql);
+ }
+
/**
* Returns the current database encoding
* @return The encoding. eg. SQL_ASCII, UTF-8, etc.
/**
* Manage schemas within a database
*
- * $Id: database.php,v 1.26 2003/12/10 16:03:29 chriskl Exp $
+ * $Id: database.php,v 1.27 2003/12/13 09:28:46 chriskl Exp $
*/
// Include application functions
}
}
+ /**
+ * Show the current status of all database variables
+ */
+ function doVariables() {
+ global $PHP_SELF, $data, $misc;
+ global $lang;
+
+ // Fetch the variables from the database
+ $variables = &$data->getVariables();
+
+ $misc->printDatabaseNav();
+ echo "<h2>", $misc->printVal($_REQUEST['database']), ": {$lang['strvariables']}</h2>\n";
+
+ if ($variables->recordCount() > 0) {
+ echo "<table>\n";
+ echo "<tr><th class=\"data\">{$lang['strname']}</th><th class=\"data\">{$lang['strsetting']}</th></tr>\n";
+ $i = 0;
+ while (!$variables->EOF) {
+ $id = (($i % 2) == 0 ? '1' : '2');
+ echo "<tr>";
+ echo "<td class=\"data{$id}\">", $misc->printVal($variables->f['name']), "</td>";
+ echo "<td class=\"data{$id}\">", $misc->printVal($variables->f['setting']), "</td>";
+ echo "</tr>\n";
+ $variables->moveNext();
+ $i++;
+ }
+ echo "</table>\n";
+ }
+ else {
+ echo "<p>{$lang['strnodata']}</p>\n";
+ }
+ }
+
+ /**
+ * Show all current database connections and any queries they
+ * are running.
+ */
+ function doProcesses() {
+ global $PHP_SELF, $data, $misc;
+ global $lang;
+
+ // Fetch the processes from the database
+ $processes = &$data->getProcesses($_REQUEST['database']);
+
+ $misc->printDatabaseNav();
+ echo "<h2>", $misc->printVal($_REQUEST['database']), ": {$lang['strprocesses']}</h2>\n";
+
+ if ($processes->recordCount() > 0) {
+ echo "<table>\n";
+ echo "<tr><th class=\"data\">{$lang['strusername']}</th><th class=\"data\">{$lang['strprocess']}</th>";
+ echo "<th class=\"data\">{$lang['strsql']}</th></tr>\n";
+ $i = 0;
+ while (!$processes->EOF) {
+ $id = (($i % 2) == 0 ? '1' : '2');
+ echo "<tr>";
+ echo "<td class=\"data{$id}\">", $misc->printVal($processes->f['usename']), "</td>";
+ echo "<td class=\"data{$id}\">", $misc->printVal($processes->f['procpid'], false, 'int4'), "</td>";
+ echo "<td class=\"data{$id}\">", $misc->printVal($processes->f['current_query']), "</td>";
+ echo "</tr>\n";
+ $processes->moveNext();
+ $i++;
+ }
+ echo "</table>\n";
+ }
+ else {
+ echo "<p>{$lang['strnodata']}</p>\n";
+ }
+ }
+
/**
* Allow database administration and tuning tasks
*/
case 'confirm_drop':
doDrop(true);
break;
+ case 'variables':
+ doVariables();
+ break;
+ case 'processes':
+ doProcesses();
+ break;
default:
doDefault();
break;
* English language file for phpPgAdmin. Use this as a basis
* for new translations.
*
- * $Id: english.php,v 1.120 2003/10/28 04:02:15 chriskl Exp $
+ * $Id: english.php,v 1.121 2003/12/13 09:28:46 chriskl Exp $
*/
// Language and character set
$lang['strinfo'] = 'Info';
$lang['stroids'] = 'OIDs';
$lang['stradvanced'] = 'Advanced';
+ $lang['strvariables'] = 'Variables';
+ $lang['strprocess'] = 'Process';
+ $lang['strprocesses'] = 'Processes';
+ $lang['strsetting'] = 'Setting';
// Error handling
$lang['strnoframes'] = 'You need a frames-enabled browser to use this application.';
* English language file for phpPgAdmin. Use this as a basis
* for new translations.
*
- * $Id: english.php,v 1.72 2003/10/28 04:02:16 chriskl Exp $
+ * $Id: english.php,v 1.73 2003/12/13 09:28:46 chriskl Exp $
*/
// Language and character set
$lang['strinfo'] = 'Info';
$lang['stroids'] = 'OIDs';
$lang['stradvanced'] = 'Advanced';
+ $lang['strvariables'] = 'Variables';
+ $lang['strprocess'] = 'Process';
+ $lang['strprocesses'] = 'Processes';
+ $lang['strsetting'] = 'Setting';
// Error handling
$lang['strnoframes'] = 'You need a frames-enabled browser to use this application.';