* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres73.php,v 1.144 2005/06/16 14:40:12 chriskl Exp $
+ * $Id: Postgres73.php,v 1.145 2005/06/22 14:21:08 chriskl Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
* @return All schemas, sorted alphabetically - but with PUBLIC first (if it exists)
*/
function &getSchemas() {
- global $conf;
+ global $conf, $slony;
- if (!$conf['show_system']) $and = "AND nspname NOT LIKE 'pg\\\\_%'";
+ if (!$conf['show_system']) {
+ $and = "AND nspname NOT LIKE 'pg\\\\_%'";
+ if (isset($slony)) {
+ $temp = $slony->slony_schema;
+ $this->clean($temp);
+ $and .= " AND npsname != '{$temp}'";
+ }
+ }
else $and = "AND nspname !~ '^pg_t(emp_[0-9]+|oast)$'";
$sql = "SELECT pn.nspname, pu.usename AS nspowner, pg_catalog.obj_description(pn.oid, 'pg_namespace') AS nspcomment
FROM pg_catalog.pg_namespace pn, pg_catalog.pg_user pu
/**
* PostgreSQL 8.0 support
*
- * $Id: Postgres80.php,v 1.14 2005/06/16 14:40:12 chriskl Exp $
+ * $Id: Postgres80.php,v 1.15 2005/06/22 14:21:08 chriskl Exp $
*/
include_once('./classes/database/Postgres74.php');
* @return All schemas, sorted alphabetically
*/
function &getSchemas() {
- global $conf;
-
- if (!$conf['show_system']) $and = "AND nspname NOT LIKE 'pg\\\\_%' AND nspname != 'information_schema'";
+ global $conf, $slony;
+
+ if (!$conf['show_system']) {
+ $and = "AND nspname NOT LIKE 'pg\\\\_%' AND nspname != 'information_schema'";
+ if (isset($slony) && $slony->isEnabled()) {
+ $temp = $slony->slony_schema;
+ $this->clean($temp);
+ $and .= " AND nspname != '{$temp}'";
+ }
+
+ }
else $and = "AND nspname !~ '^pg_t(emp_[0-9]+|oast)$'";
$sql = "SELECT pn.nspname, pu.usename AS nspowner, pg_catalog.obj_description(pn.oid, 'pg_namespace') AS nspcomment
FROM pg_catalog.pg_namespace pn, pg_catalog.pg_user pu
/**
* A class that implements the Slony 1.0.x support plugin
*
- * $Id: Slony.php,v 1.2 2005/06/16 14:40:12 chriskl Exp $
+ * $Id: Slony.php,v 1.3 2005/06/22 14:21:08 chriskl Exp $
*/
include_once('./classes/plugins/Plugin.php');
class Slony extends Plugin {
- var $config = 'slony.inc.php';
- var $category = 'Replication';
var $slony_version;
var $slony_schema;
var $slony_cluster;
var $slony_owner;
var $slony_comment;
+ var $enabled = null;
/**
* Constructor
* @return True if Slony is installed, false otherwise.
*/
function isEnabled() {
+ // Access cache
+ if ($this->enabled !== null) return $enabled;
+ else $this->enabled = false;
+
global $data;
// Slony needs schemas
if ($version === -1) return false;
else {
$this->slony_version = $version;
+ $this->enabled = true;
return true;
}
}
* Central phpPgAdmin configuration. As a user you may modify the
* settings here for your particular configuration.
*
- * $Id: config.inc.php-dist,v 1.41 2005/02/16 10:27:44 jollytoad Exp $
+ * $Id: config.inc.php-dist,v 1.42 2005/06/22 14:21:09 chriskl Exp $
*/
// An example server. Create as many of these as you wish,
$conf['servers'][0]['pg_dump_path'] = '/usr/bin/pg_dump';
$conf['servers'][0]['pg_dumpall_path'] = '/usr/bin/pg_dumpall';
+ // Slony (www.slony.info) support?
+ $conf['servers'][0]['slony_support'] = false;
+
// Example for a second server (PostgreSQL for Windows)
//$conf['servers'][1]['desc'] = 'Test Server';
//$conf['servers'][1]['host'] = '127.0.0.1';
//$conf['servers'][1]['defaultdb'] = 'template1';
//$conf['servers'][1]['pg_dump_path'] = 'C:\\Program Files\\PostgreSQL\\8.0\\bin\\pg_dump.exe';
//$conf['servers'][1]['pg_dumpall_path'] = 'C:\\Program Files\\PostgreSQL\\8.0\\bin\\pg_dumpall.exe';
+ //$conf['servers'][1]['slony_support'] = false;
// Default language for the login screen if there's no translation
// matching user's browser request. Eg: 'english', 'polish', etc.
* Don't modify anything below this line *
*****************************************/
- $conf['version'] = 14;
+ $conf['version'] = 15;
?>
/**
* Manage schemas within a database
*
- * $Id: database.php,v 1.69 2005/06/16 14:40:10 chriskl Exp $
+ * $Id: database.php,v 1.70 2005/06/22 14:21:07 chriskl Exp $
*/
// Include application functions
$misc->printTreeXML($schemas, $attrs);
$tabs = $misc->getNavTabs('database');
- $tabs['slony'] = array (
- 'title' => 'Slony',
- 'url' => 'plugin_slony.php',
- 'urlvars' => array('action' => 'clusters_properties'),
- 'hide' => false,
- 'help' => ''
- );
+ // Show slony node if enabled on this database
+ if (isset($slony)) {
+ $tabs['slony'] = array (
+ 'title' => 'Slony',
+ 'url' => 'plugin_slony.php',
+ 'urlvars' => array('action' => 'clusters_properties'),
+ 'hide' => false,
+ 'help' => ''
+ );
+ }
$items =& $misc->adjustTabsForTree($tabs);
}
function doSubTree() {
- global $misc, $data, $lang, $slony;
+ global $misc, $data, $lang;
$tabs = $misc->getNavTabs('schema');
/**
* Function library read in upon startup
*
- * $Id: lib.inc.php,v 1.97 2005/06/20 16:16:42 jollytoad Exp $
+ * $Id: lib.inc.php,v 1.98 2005/06/22 14:21:09 chriskl Exp $
*/
include_once('decorator.inc.php');
include_once('./lang/translations.php');
// Configuration file version. If this is greater than that in config.inc.php, then
// the app will refuse to run. This and $conf['version'] should be incremented whenever
// backwards incompatible changes are made to config.inc.php-dist.
- $conf['base_version'] = 14;
+ $conf['base_version'] = 15;
// Always include english.php, since it's the master language file
if (!isset($conf['default_lang'])) $conf['default_lang'] = 'english';
$lang['appcharset'] = $dbEncoding;
}
- // XXX: THIS IS A TEMPORARY HACK TO GET SLONY OBJECT LOADED
- include('./classes/plugins/Slony.php');
- $slony = new Slony();
- if ($slony->isEnabled()) {
- $plugins = array(&$slony);
+ // Load Slony if required
+ if ($_server_info['slony_support']) {
+ include('./classes/plugins/Slony.php');
+ $slony = new Slony();
}
- else $plugins = array();
-
}
?>