* @copyright 2003-2013 PgPool Global Development Group * @version SVN: $Id$ */ require_once('common.php'); require_once('command.php'); /* --------------------------------------------------------------------- */ /* nodeStatus.php */ /* --------------------------------------------------------------------- */ // Check login status if (!isset($_SESSION[SESSION_LOGIN_USER])) { exit(); } // select buttons to each nodes depending on their status $isParallelMode = isParallelMode(); $isReplicationMode = isReplicationMode(); $isMasterSlaveMode = isMasterSlaveMode(); $configValue = readConfigParams(array('backend_hostname', 'backend_port')); if (!isset($configValue['backend_hostname'])) { return; } $backends_in_conf = $configValue['backend_hostname']; // Get nodes' status $nodeCount = NULL; $is_pgpool_running = DoesPgpoolPidExist(); if ($is_pgpool_running) { $nodeCount = getNodeCount(); } $has_not_loaded_node = FALSE; // Merge backends in pgpool.conf and them in pgpool // ex) when remove a backend but not reload yet if (count($backends_in_conf) $backend) { // Set buttons $nodeInfo[$i]['return'] = FALSE; $nodeInfo[$i]['disconnect'] = FALSE; $nodeInfo[$i]['promote'] = FALSE; $nodeInfo[$i]['recovery'] = FALSE; // The flag if postgres is active or sleeping $nodeInfo[$i]['is_active'] = NodeActive($i); // nodes recognized by pgpool if ($nodeCount != NULL/* && $i assign('help', basename( __FILE__, '.php')); $tpl->assign('refreshTime', _PGPOOL2_STATUS_REFRESH_TIME * 1000); $tpl->assign('nodeInfo', $nodeInfo); $tpl->assign('parallelMode', $isParallelMode); $tpl->assign('msgStopPgpool', $message['msgStopPgpool']); $tpl->assign('nodeCount', $nodeCount); $tpl->assign('has_not_loaded_node', $has_not_loaded_node); $tpl->assign('pgpoolIsRunning', $is_pgpool_running); $tpl->assign('is_superuser', (isset($_SESSION[SESSION_IS_SUPER_USER])) ? $_SESSION[SESSION_IS_SUPER_USER] : isSuperUser($_SESSION[SESSION_LOGIN_USER])); // Set params $configValue = readConfigParams('recovery_1st_stage'); $tpl->assign('params', $configValue); // Display $tpl->display('nodeStatus.tpl');