/**
* A class that implements the Slony 1.0.x support plugin
*
- * $Id: Slony.php,v 1.1.2.22 2005/06/12 14:36:25 chriskl Exp $
+ * $Id: Slony.php,v 1.1.2.23 2005/06/15 14:32:58 chriskl Exp $
*/
include_once('./classes/plugins/Plugin.php');
return $data->execute($sql);
}
+ /**
+ * Executes schema changing DDL set on nodes
+ */
+ function executeReplicationSet($set_id, $script) {
+ global $data;
+
+ $schema = $this->slony_schema;
+ $data->fieldClean($schema);
+ $data->clean($set_id);
+ $data->clean($script);
+
+ $sql = "SELECT \"{$schema}\".ddlscript('{$set_id}', '{$script}')";
+
+ return $data->execute($sql);
+ }
+
// TABLES
/**
* English language file for phpPgAdmin. Use this as a basis
* for new translations.
*
- * $Id: english.php,v 1.176.2.4 2005/06/11 08:20:08 chriskl Exp $
+ * $Id: english.php,v 1.176.2.5 2005/06/15 14:32:58 chriskl Exp $
*/
// Language and character set
$lang['strtablespacealtered'] = 'Tablespace altered.';
$lang['strtablespacealteredbad'] = 'Tablespace alteration failed.';
- // Slony clusters
+ // Slony clusters
$lang['strnoclusters'] = 'No clusters found.';
- $lang['strconfdropcluster'] = 'Are you sure you want to drop cluster "%s"?';
+ $lang['strconfdropcluster'] = 'Are you sure you want to drop cluster "%s"?';
$lang['strclusterdropped'] = 'Cluster dropped.';
$lang['strclusterdroppedbad'] = 'Cluster drop failed.';
-
+ $lang['strinitcluster'] = 'Initialize Cluster';
+ $lang['strclustercreated'] = 'Cluster initialized.';
+ $lang['strclustercreatedbad'] = 'Cluster initialization failed.';
+ $lang['strclusterneedsname'] = 'You must give a name for the cluster.';
+ $lang['strclusterneedsnodeid'] = 'You must give an ID for the local node.';
+
// Slony nodes
$lang['strnodes'] = 'Nodes';
$lang['strnonodes'] = 'No nodes found.';
$lang['stractive'] = 'Active';
$lang['strnodecreated'] = 'Node created.';
$lang['strnodecreatedbad'] = 'Node creation failed.';
- $lang['strconfdropnode'] = 'Are you sure you want to drop node "%s"?';
+ $lang['strconfdropnode'] = 'Are you sure you want to drop node "%s"?';
$lang['strnodedropped'] = 'Node dropped.';
$lang['strnodedroppedbad'] = 'Node drop failed';
-
+ $lang['strfailover'] = 'Failover';
+ $lang['strnodefailedover'] = 'Node failed over.';
+ $lang['strnodefailedoverbad'] = 'Node fail over fail.';
+
// Slony paths
$lang['strpaths'] = 'Paths';
$lang['strnopaths'] = 'No paths found.';
$lang['strpathneedsconnretry'] = 'You must give the number of seconds to wait before retry to connect.';
$lang['strpathcreated'] = 'Path created.';
$lang['strpathcreatedbad'] = 'Path creation failed.';
- $lang['strconfdroppath'] = 'Are you sure you want to drop path "%s"?';
+ $lang['strconfdroppath'] = 'Are you sure you want to drop path "%s"?';
$lang['strpathdropped'] = 'Path dropped.';
$lang['strpathdroppedbad'] = 'Path drop failed.';
$lang['strnolistens'] = 'No listens found.';
$lang['strcreatelisten'] = 'Create listen';
$lang['strlistencreated'] = 'Listen created.';
- $lang['strlistencreatedbad'] = 'Listen creation failed.';
- $lang['strconfdroplisten'] = 'Are you sure you want to drop listen "%s"?';
+ $lang['strlistencreated'] = 'Listen creation failed.';
+ $lang['strconfdroplisten'] = 'Are you sure you want to drop listen "%s"?';
$lang['strlistendropped'] = 'Listen dropped.';
$lang['strlistendroppedbad'] = 'Listen drop failed.';
$lang['strrepsetdropped'] = 'Replication set dropped.';
$lang['strrepsetdroppedbad'] = 'Replication set drop failed.';
$lang['strmerge'] = 'Merge';
- $lang['strmergeinto'] = 'Merge into';
+ $lang['strmergeinto'] = 'Merge Into';
$lang['strrepsetmerged'] = 'Replication sets merged.';
$lang['strrepsetmergedbad'] = 'Replication sets merge failed.';
$lang['strmove'] = 'Move';
- $lang['strneworigin'] = 'New origin';
+ $lang['strneworigin'] = 'New Origin';
$lang['strrepsetmoved'] = 'Replication set moved.';
$lang['strrepsetmovedbad'] = 'Replication set move failed.';
$lang['strnewrepset'] = 'New replication set';
+ $lang['strlock'] = 'Lock';
+ $lang['strlocked'] = 'Locked';
+ $lang['strunlock'] = 'Unlock';
+ $lang['strconflockrepset'] = 'Are you sure you want to lock replication set "%s"?';
+ $lang['strrepsetlocked'] = 'Replication set locked.';
+ $lang['strrepsetlockedbad'] = 'Replication set lock failed.';
+ $lang['strconfunlockrepset'] = 'Are you sure you want to unlock replication set "%s"?';
+ $lang['strrepsetunlocked'] = 'Replication set unlocked.';
+ $lang['strrepsetunlockedbad'] = 'Replication set unlock failed.';
+ $lang['strexecute'] = 'Execute';
+ $lang['stronlyonnode'] = 'Only on node';
+ $lang['strddlscript'] = 'DDL Script';
+ $lang['strscriptneedsbody'] = 'You must supply a script to be executed on all nodes.';
+ $lang['strscriptexecuted'] = 'Replication set DDL script executed.';
+ $lang['strscriptexecutedbad'] = 'Failed executing replication set DDL script.';
// Slony subscriptions
$lang['strsubscriptions'] = 'Subscriptions';
$lang['strnosubscriptions'] = 'No subscriptions found.';
// Miscellaneous
- $lang['strtopbar'] = '%s running on %s:%s -- You are logged in as user "%s", %s';
+ $lang['strtopbar'] = '%s running on %s:%s -- You are logged in as user "%s", %s';
$lang['strtimefmt'] = 'jS M, Y g:iA';
$lang['strhelp'] = 'Help';
$lang['strhelpicon'] = '?';
* English language file for phpPgAdmin. Use this as a basis
* for new translations.
*
- * $Id: english.php,v 1.128.2.5 2005/06/12 14:36:26 chriskl Exp $
+ * $Id: english.php,v 1.128.2.6 2005/06/15 14:32:58 chriskl Exp $
*/
// Language and character set
$lang['strconfunlockrepset'] = 'Are you sure you want to unlock replication set "%s"?';
$lang['strrepsetunlocked'] = 'Replication set unlocked.';
$lang['strrepsetunlockedbad'] = 'Replication set unlock failed.';
+ $lang['strexecute'] = 'Execute';
+ $lang['stronlyonnode'] = 'Only on node';
+ $lang['strddlscript'] = 'DDL Script';
+ $lang['strscriptneedsbody'] = 'You must supply a script to be executed on all nodes.';
+ $lang['strscriptexecuted'] = 'Replication set DDL script executed.';
+ $lang['strscriptexecutedbad'] = 'Failed executing replication set DDL script.';
// Slony subscriptions
$lang['strsubscriptions'] = 'Subscriptions';
/**
* Slony database tab plugin
*
- * $Id: plugin_slony.php,v 1.1.2.22 2005/06/12 14:36:25 chriskl Exp $
+ * $Id: plugin_slony.php,v 1.1.2.23 2005/06/15 14:32:58 chriskl Exp $
*/
// Include application functions
echo "\t<tr>\n\t\t<th class=\"data left\">{$lang['strcomment']}</th>\n";
echo "\t\t<td class=\"data1\"><textarea name=\"no_comment\" rows=\"3\" cols=\"32\" wrap=\"virtual\">",
htmlspecialchars($_POST['no_comment']), "</textarea></td>\n\t</tr>\n";
-
- echo "\t</tr>\n";
echo "</table>\n";
echo "<p>\n";
echo "<input type=\"hidden\" name=\"action\" value=\"save_create_cluster\" />\n";
'title' => $lang['strmove'],
'url' => "plugin_slony.php?{$misc->href}&action=move_set&",
'vars' => array('set_id' => 'set_id')
+ ),
+ 'execute' => array(
+ 'title' => $lang['strexecute'],
+ 'url' => "plugin_slony.php?{$misc->href}&action=execute_set&",
+ 'vars' => array('set_id' => 'set_id')
)
);
echo "<a class=\"navlink\" href=\"{$PHP_SELF}?action=confirm_lock_set&{$misc->href}&set_id={$_REQUEST['set_id']}\">{$lang['strlock']}</a> |\n";
echo "<a class=\"navlink\" href=\"{$PHP_SELF}?action=confirm_unlock_set&{$misc->href}&set_id={$_REQUEST['set_id']}\">{$lang['strunlock']}</a> |\n";
echo "<a class=\"navlink\" href=\"{$PHP_SELF}?action=merge_set&{$misc->href}&set_id={$_REQUEST['set_id']}\">{$lang['strmerge']}</a> |\n";
- echo "<a class=\"navlink\" href=\"{$PHP_SELF}?action=move_set&{$misc->href}&set_id={$_REQUEST['set_id']}\">{$lang['strmove']}</a></p>\n";
+ echo "<a class=\"navlink\" href=\"{$PHP_SELF}?action=move_set&{$misc->href}&set_id={$_REQUEST['set_id']}\">{$lang['strmove']}</a> |\n";
+ echo "<a class=\"navlink\" href=\"{$PHP_SELF}?action=execute_set&{$misc->href}&set_id={$_REQUEST['set_id']}\">{$lang['strexecute']}</a></p>\n";
}
/**
doMoveReplicationSet(true, $lang['strrepsetmovedbad']);
}
}
+
+ /**
+ * Displays a screen where they can enter a DDL script to
+ * be executed on all or a particular node, for this set.
+ */
+ function doExecuteReplicationSet($confirm, $msg = '') {
+ global $slony, $misc;
+ global $PHP_SELF, $lang;
+ if ($confirm) {
+ if (!isset($_POST['script'])) $_POST['script'] = '';
+
+ $nodes = $slony->getNodes();
+
+ $misc->printTrail('slony_sets');
+ $misc->printTitle($lang['strexecute']);
+ $misc->printMsg($msg);
+
+ echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
+ echo $misc->form;
+ echo "<table>\n";
+ /* Slony 1.1 only
+ echo "\t<tr>\n\t\t<th class=\"data left\">{$lang['stronlyonnode']}</th>\n";
+ echo "<td class=\"data1\" colspan=\"3\"><select name=\"only_on_node\">";
+ echo "<option value=\"0\"></option>\n";
+ while (!$nodes->EOF) {
+ echo "<option value=\"{$nodes->f['no_id']}\"", ($_POST['only_on_node'] == $nodes->f['no_id'] ? ' selected="selected"' : ''), ">";
+ echo htmlspecialchars($nodes->f['no_comment']), "</option>\n";
+ $nodes->moveNext();
+ }
+ echo "</select></td></tr>\n";
+ */
+ echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strddlscript']}</th>\n";
+ echo "\t\t<td class=\"data1\"><textarea name=\"script\" rows=\"20\" cols=\"40\" wrap=\"virtual\">",
+ htmlspecialchars($_POST['script']), "</textarea></td>\n\t</tr>\n";
+ echo "</table>\n";
+ echo "<p>\n";
+ echo "<input type=\"hidden\" name=\"action\" value=\"save_execute_set\" />\n";
+ echo "<input type=\"hidden\" name=\"set_id\" value=\"", htmlspecialchars($_REQUEST['set_id']), "\" />\n";
+ echo "<input type=\"submit\" value=\"{$lang['strexecute']}\" />\n";
+ echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />\n";
+ echo "</p>\n";
+ echo "</form>\n";
+ }
+ else {
+ if (trim($_POST['script']) == '') {
+ doExecuteReplicationSet(true, $lang['strscriptneedsbody']);
+ return;
+ }
+
+ $status = $slony->executeReplicationSet($_POST['set_id'], $_POST['script']);
+ if ($status == 0)
+ doReplicationSet($lang['strscriptexecuted']);
+ else
+ doExecuteReplicationSet(true, $lang['strscriptexecutedbad']);
+ }
+ }
+
// TABLES
/**
case 'move_set':
doMoveReplicationSet(true);
break;
+ case 'save_execute_set':
+ if (isset($_POST['cancel'])) doReplicationSet();
+ else doExecuteReplicationSet(false);
+ break;
+ case 'execute_set':
+ doExecuteReplicationSet(true);
+ break;
case 'tables_properties':
doTables();
break;