// pgpool-II
define('PGPOOL_OFFICIAL_SITE', 'http://www.pgpool.net/');
+// pgpoolAdmin
+define('PGPOOLADMIN_HOST', exec('hostname -f'));
+
// node status in "pcp_node_info" result
// http://www.pgpool.net/pgpool-web/pgpool-II/doc/pgpool-ja.html#pcp_node_info
define('NODE_ACTIVE_NO_CONNECT', 1);
/* --------------------------------------------------------------------- */
case 'startPgpool':
- _startPgpool();
+ if (_startPgpool()) {
+ header("Location: " . $_SERVER['PHP_SELF']);
+ }
break;
case 'stopPgpool':
- _stopPgpool();
+ if (_stopPgpool()) {
+ header("Location: " . $_SERVER['PHP_SELF']);
+ }
break;
case 'restartPgpool':
- _restartPgpool();
+ if (_restartPgpool()) {
+ header("Location: " . $_SERVER['PHP_SELF']);
+ }
break;
case 'reloadPgpool':
function _startPgpool()
{
global $tpl;
+ $rtn = FALSE;
$args = _setStartArgs();
$result = execPcp('PCP_START_PGPOOL', $args);
} else {
if (_waitForPidFile()) {
$pgpoolStatus = 'pgpool start succeed';
+ $rtn = TRUE;
} else {
$pgpoolStatus = 'pgpool start failed. pgpool.pid not found';
}
$tpl->assign('pgpoolStatus', $pgpoolStatus);
$tpl->assign('pgpoolMessage', $pgpoolMessage);
+
+ return $rtn;
}
/** Stop pgpool */
{
global $_POST;
global $tpl;
+ $rtn = FALSE;
$m = $_POST['stop_mode'];
} else {
if (_waitForNoPidFile()) {
$pgpoolStatus = 'pgpool stop succeed';
+ $rtn = TRUE;
} else {
$pgpoolStatus = 'pgpool stop failed. pgpool.pid exists.';
}
$tpl->assign('pgpoolStatus', $pgpoolStatus);
}
+
+ return $rtn;
}
/** Restart pgpool */
{
global $_POST;
global $tpl;
+ $rtn = FALSE;
// Stop pgpool
$m = $_POST['stop_mode'];
} else {
if (_waitForPidFile()) {
$pgpoolStatus = 'pgpool restart succeed';
+ $rtn = TRUE;
} else {
$pgpoolStatus = 'pgpool restart failed. pgpool.pid not found';
}
$tpl->assign('pgpoolStatus', $pgpoolStatus);
$tpl->assign('pgpoolMessage', $pgpoolMessage);
+
+ return $rtn;
}
/** Execute PCP command with node number */
{* pgpool's version *}
{* --------------------------------------------------------------------- *}
- <h2>pgpool-II Version</h2>
- {$smarty.const._PGPOOL2_VERSION}
-
- <p>login user: {$login_user}</p>
- <p>is_superuser: {if $is_superuser}yes{else}no{/if}</p>
+ <h2>pgpoolAdmin</h2>
+ <ul>
+ <li>This is pgpoolAdmin on {$smarty.const.PGPOOLADMIN_HOST}</li>
+ <li>For pgpool-II {$smarty.const._PGPOOL2_VERSION}.</li>
+ <li>Login
+ <ul>
+ <li>login user: {$login_user}</li>
+ <li>superuser: {if $is_superuser == NULL}unknown (Connection error)
+ {elseif $is_superuser == TRUE}yes{else}no{/if}
+ </li>
+ </ul>
+ </li>
+ </ul>
{* --------------------------------------------------------------------- *}
{* Status Info Buttons *}