* is" without express or implied warranty.
*
- * @copyright 2003-2013 PgPool Global Development Group
+ * @copyright 2003-2015 PgPool Global Development Group
* @version CVS: $Id$
*/
* @param srgs $num
* @return array
*/
-function execPcp($command, $num = '')
+function execPcp($command, $extra_args)
{
$pcpStatus = array (
'0' => 'SUCCESS',
$param = readPcpInfo();
$param['hostname'] = _PGPOOL2_PCP_HOSTNAME;
- $args = " " . PCP_TIMEOUT.
- " " . $param['hostname'] .
- " " . $param['pcp_port'] .
- " ". $_SESSION[SESSION_LOGIN_USER] .
- " '" . $_SESSION[SESSION_LOGIN_USER_PASSWORD] . "' " .
- $num;
+ if (3.5 <= _PGPOOL2_VERSION) {
+ // Check /home/apache/.pcppass (If error, exit here)
+ checkPcppass();
+
+ $args = sprintf(' -w -h %s -p %d -U %s',
+ $param['hostname'], $param['pcp_port'],
+ $_SESSION[SESSION_LOGIN_USER]
+ );
+
+ foreach ($extra_args as $arg_name => $val) {
+ $args .= " -{$arg_name} {$val}";
+ }
+
+ } else {
+ $args = " " . PCP_TIMEOUT.
+ " " . $param['hostname'] .
+ " " . $param['pcp_port'] .
+ " ". $_SESSION[SESSION_LOGIN_USER] .
+ " '" . $_SESSION[SESSION_LOGIN_USER_PASSWORD] . "' " .
+ implode($extra_args, ' ');
+ }
switch ($command) {
case 'PCP_NODE_COUNT':
default:
return array($pspStatus[1] => $pspStatus[1]);
}
+
return array($pcpStatus[$return_var] => $ret);
}
global $tpl;
// execute "pcp_node_info" command
- // ex) host1 5432 1 1073741823.500000
- $result = execPcp('PCP_NODE_INFO', $i);
+ $result = execPcp('PCP_NODE_INFO', array('n' => $i));
if (!array_key_exists('SUCCESS', $result)) {
- $errorCode = 'e1003';
- $tpl->assign('errorCode', $errorCode);
+ $tpl->assign('errorCode', 'e1003');
+ $tpl->assign('result', $result);
$tpl->display('innerError.tpl');
exit();
}
return $rtn;
}
+
+function checkPcppass()
+{
+ global $message, $tpl;
+
+ $proc_user_info = posix_getpwuid(posix_geteuid());
+ $pcppass_file = "{$proc_user_info['dir']}/.pcppass";
+
+ $detail = NULL;
+ if (! is_file($pcppass_file)) {
+ $detail = $message['errFileNotFound'];
+ } elseif (fileowner($pcppass_file) != $proc_user_info['uid']) {
+ $detail = $message['errInvalidOwner'];
+ } elseif (substr(sprintf('%o', fileperms($pcppass_file)), -4) != '0600') {
+ $detail = $message['errInvalidPermission'];
+ }
+
+ if ($detail) {
+ $tpl->assign('errorCode', 'e1014');
+ $tpl->assign('detail', $detail);
+ $tpl->display('innerError.tpl');
+ exit();
+ }
+}
?>
* is" without express or implied warranty.
*
- * @copyright 2003-2013 PgPool Global Development Group
+ * @copyright 2003-2015 PgPool Global Development Group
* @version CVS: $Id$
*/
$action = $_POST['action'];
}
+// Check templates_c
$templates_c = dirname(dirname(__FILE__) . '/') . '/templates_c';
if (!is_writable($templates_c)) {
$templates_c = $templates_c . ' write denied';
} else {
unset($templates_c);
}
+
+// Chech pgmgt.conf
$conf = dirname(dirname(__FILE__) . '/') . '/conf/pgmgt.conf.php';
if (!is_writable($conf)) {
$conf = $conf . ' write denied';
</div>
<div id="content">
<h2>Welcome to pgpool-II Administration Tool</h2>
- <h3><? echo $message['strDirectoryCheck'] ?></h3>
+ <h3><?php echo $message['strDirectoryCheck'] ?></h3>
<form action="checkDirectory.php" method="post" name="CheckPath" id="CheckPath">
<?php
if($error) {
* is" without express or implied warranty.
*
- * @copyright 2003-2013 PgPool Global Development Group
+ * @copyright 2003-2015 PgPool Global Development Group
* @version CVS: $Id$
*/
}
$msgPgpoolConfigFile = '';
-if (!@is_file($pgpool2_config_file)) {
+if (! @is_file($pgpool2_config_file)) {
$msgPgpoolConfigFile = 'File not found';
$error = TRUE;
} else {
}
$msgPasswordFile = '';
-if (!@is_file($password_file)) {
+if (! @is_file($password_file)) {
$msgPasswordFile = 'File not found';
$error = TRUE;
} else {
}
$msgPgpoolCommand = '';
-if (!@is_file($pgpool_command)) {
+if (! @is_file($pgpool_command)) {
$msgPgpoolCommand = 'pgpool command not found';
$error = TRUE;
} elseif (!is_executable($pgpool_command)) {
$error = TRUE;
}
-// check args of pgpool comand
+// check args of pgpool command
$msgCmdC = '';
$msgCmdLargeD = '';
$msgCmdD = '';
'pcp_systemdb_info');
for ($i = 0; $i < count($command); $i++) {
- if (!@is_file($pcp_client_dir . "/" . $command[$i])) {
+ if (! @is_file($pcp_client_dir . "/" . $command[$i])) {
$msgPcpClientDir = $command[$i] . ' command not found';
$error = TRUE;
} elseif (!is_executable($pcp_client_dir . "/" . $command[$i] )) {
$pcp_hostname = _PGPOOL2_PCP_HOSTNAME;
}
+if (3.5 <= $version) {
+ $msgPcpPassFile = '';
+ $proc_user_info = posix_getpwuid(posix_geteuid());
+ $pcppass_file = "{$proc_user_info['dir']}/.pcppass";
+ if (! is_file($pcppass_file)) {
+ $msgPcpPassFile = 'File not found';
+ } elseif (fileowner($pcppass_file) != $proc_user_info['uid']) {
+ $msgPcpPassFile = 'Invalid owner';
+ } elseif (substr(sprintf('%o', fileperms($pcppass_file)), -4) != '0600') {
+ $msgPcpPassFile = 'Invalid permission';
+ }
+}
+
$msgPcpTimeout = '';
if (isset($_POST['pcp_timeout']) && $_POST['pcp_timeout']) {
$pcp_timeout= $_POST['pcp_timeout'];
<table>
<tr>
- <th><label><?php echo $message['strCmdC'] ?></label></th>
+ <th><label><?php echo $message['strCmdC'] ?> (-c)</label></th>
<td><input type="checkbox" name="c" />
<?php showResult($msgCmdC); ?>
</td>
</tr>
<tr>
- <th><label><?php echo $message['strCmdLargeD'] ?></label></th>
+ <th><label><?php echo $message['strCmdLargeD'] ?> (-D)</label></th>
<td><input type="checkbox" name="D" />
<?php showResult($msgCmdLargeD); ?>
</td>
</tr>
<tr>
- <th><label><?php echo $message['strCmdN'] ?></label></th>
+ <th><label><?php echo $message['strCmdN'] ?> (-n)</label></th>
<td><input type="checkbox" name="n" />
<?php showResult($msgCmdN); ?>
</td>
</tr>
<tr>
- <th><label><?php echo $message['strCmdLargeC'] ?></label></th>
+ <th><label><?php echo $message['strCmdLargeC'] ?> (-C)</label></th>
<td><input type="checkbox" name="D" />
<?php showResult($msgCmdLargeC); ?>
</td>
</tr>
<tr>
- <th><label><?php echo $message['strCmdD'] ?></label></th>
+ <th><label><?php echo $message['strCmdD'] ?> (-d)</label></th>
<td><input type="checkbox" name="d" />
<?php showResult($msgCmdD); ?>
</td>
</tr>
<tr>
- <th><label><?php echo $message['strCmdM'] ?></label></th>
+ <th><label><?php echo $message['strCmdM'] ?> (-m)</label></th>
<td><select name="m" />
<option value="s" selected="selected">smart</optgroup>
<option value="f">fast</optgroup>
<?php showResult($msgPcpHostname); ?>
</td>
</tr>
+ <tr id="tr_pcppass">
+ <th><label>.pcppass [V3.5 - ]</label></th>
+ <td><?php echo $pcppass_file; ?>
+ <?php showResult($msgPcpPassFile); ?>
<tr>
<th><label><?php echo $message['strPcpTimeout'] ?></label></th>
<td><input name="pcp_timeout" type="text" value="<?php echo $pcp_timeout?>" size="50" />
function versions()
{
- return array('3.4', '3.3', '3.2', '3.1', '3.0',
+ return array('3.5', '3.4', '3.3', '3.2', '3.1', '3.0',
'2.3', '2.2', '2.1', '2.0');
}
'errIllegalHostname' => 'Illegal hostname',
'errIllegalPipe' => 'Pipe destination is invalid',
'errInputEverything' => 'Please input all items',
+ 'errInvalidOwner' => 'Invalid owner',
+ 'errInvalidPermission' => 'Invalid permission',
'errNoDefined' => 'No defined parameter',
'errNotSameLength' => 'The array length of col_list is not corresponding to that of type_list. '.
'It should be the same number of elements.',
'e1011' => 'Log file not found.',
'e1012' => 'pcp_recovery_node command error occurred.',
'e1013' => 'pcp_watchdog_info command error occurred.',
+ 'e1014' => 'Could not read .pcppass file'
'e2001' => 'Database connection error occurred.',
'e2002' => 'The error occurred when SELECT was executed',
'e2003' => 'pgpool.conf not found.',
'errIllegalHostname' => '不正なホスト名です',
'errIllegalPipe' => 'パイプの指定が不正です',
'errInputEverything' => 'すべてを入力してください',
+ 'errInvalidOwner' => '所有者が正しくありません',
+ 'errInvalidPermission' => 'パーミッションが正しくありません',
'errNoDefined' => 'パラメータが設定されていません',
'errNotSameLength' => '列名リストと列データ型リストの配列の長さが一致しません。'.
'同じ要素数である必要があります。',
'e1011' => 'ログファイルが見つかりません',
'e1012' => 'pcp_recovery_nodeコマンドでエラーが発生しました',
'e1013' => 'pcp_watchdog_infoコマンドでエラーが発生しました',
+ 'e1014' => '.pcppass ファイルの読み込みに失敗しました',
'e2001' => 'データベースに接続できません',
'e2002' => 'レコード取得時にエラーが発生しました',
'e2003' => 'pgpool.confが見つかりません',
foreach ($select_options[$param] as $key => $val) {
$rtn .= sprintf(
'<option value="%s" %s>%s</option>',
- $key, ($val == $user_val) ? 'selected' : NULL, $val
+ $key, ($key === $user_val || $val === $user_val) ? 'selected' : NULL, $val
);
}
$rtn .= '</select>';
* is" without express or implied warranty.
*
- * @copyright 2003-2011 PgPool Global Development Group
+ * @copyright 2003-2015 PgPool Global Development Group
* @version CVS: $Id$
*/
$ret = execPcp('PCP_PROC_COUNT');
if (!array_key_exists('SUCCESS', $ret)) {
- $errorCode = 'e1004';
+ if (! isset($ret['errorCode'])) {
+ $errorCode = 'e1004';
+ }
$tpl->assign('errorCode', $errorCode);
$tpl->display('innerError.tpl');
exit();
for ($i = 0; $i < count($procPids); $i++) {
$procPid = $procPids[$i];
- $ret = execPcp('PCP_PROC_INFO', $procPid);
+ $ret = execPcp('PCP_PROC_INFO', array('P' => $procPid));
if (!array_key_exists('SUCCESS', $ret)) {
- $errorCode = 'e1005';
+ if (! isset($ret['errorCode'])) {
+ $errorCode = 'e1005';
+ }
$tpl->assign('errorCode', $errorCode);
$tpl->display('innerError.tpl');
exit();
color: #709CD1;
font-size: small;
}
+tbody th.category_2 span {
+ font-weight: bold;
+ color: #7CC9E2;
+ font-size: small;
+}
table#complete_msg
{
/* --------------------------------------------------------------------- */
a:link {
- color: red;
+ color: red;
text-decoration: none;
}
a:visited {
font: x-small Verdana, Arial, Helvetica, sans-serif;
}
input[type=button], input[type=submit] {
- border-radius: 3px;
- padding: 2px 5px;
+ background: #cfcfcf;
+ padding: 5px 7px;
vertical-align: middle;
- border-top: 1px solid #aaa;
- border-right: 1px solid #666;
- border-bottom: 1px solid #666;
- border-left: 1px solid #aaa;
-
+ border-width: 0px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
-
- background: #ffffff;
- background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#eeeeee));
- background: -moz-linear-gradient(top, #ffffff, #eeeeee);
}
-
input[type=button]:hover, input[type=submit]:hover, input[type=reset]:hover {
- border-top: 1px solid #666;
- border-right: 1px solid #aaa;
- border-bottom: 1px solid #aaa;
- border-left: 1px solid #666;
-
- background: #f3f3f3;
- background: -webkit-gradient(linear, left top, left bottom, from(#eeeeee), to(#ffffff));
- background: -moz-linear-gradient(top, #eeeeee, #ffffff);
+ background: #dddddd;
color: #5f5f5f;
}
input[type=button]:active, input[type=submit]:active, input[type=reset]:active {
- border-top: 1px solid #666;
- border-right: 1px solid #aaa;
- border-bottom: 1px solid #aaa;
- border-left: 1px solid #666;
-
- background: #cccccc;
+ background: #bbbbbb;
color: #000000;
}
input[type=button].command_active {
background: yellow;
- background: -webkit-gradient(linear, left top, left bottom, from(yellow), to(#FCE114));
- background: -moz-linear-gradient(top, yellow, #FCE114);
border-color: #BC4B00;
}
input[type=button][disabled], input[type=button][disabled]:hover {
- border-top: 1px solid #aaa;
- border-right: 1px solid #666;
- border-bottom: 1px solid #666;
- border-left: 1px solid #aaa;
-
- background: #dedede;
+ background: #cfcfcf;
color: #777777;
text-shadow: #eeeeee 0 1px 0;
}
-input[type=button][disabled]:hover {
- background: #f0f0f0;
+
+/* --------------------------------------------------------------------- */
+/* radio */
+/* --------------------------------------------------------------------- */
+
+div.radio_bool {
+ margin-bottom: 20px;
+ padding: 0px;
+}
+div.radio_bool input{
+ display: none;
+}
+div.radio_bool label{
+ background: #bdc3c7;
+ border-right: 1px solid #abb2b7;
+ color: #555e64;
+ cursor: pointer;
+ display: block;
+ float: left;
+ line-height: 1;
+ margin: 0;
+ padding: 5px 12px;
+ text-align: center;
+ transition: .2s;
+}
+div.radio_bool label:first-of-type{
+ border-radius: 3px 0 0 3px;
+}
+div.radio_bool label:last-of-type{
+ border-right: 0px;
+ border-radius: 0 3px 3px 0;
+}
+div.radio_bool input[type="radio"]:checked + label {
+ background-color: #a1b91d;
+ color: #fff;
+ font-weight: bold;
+}
+div.radio_bool input[type="radio"]:disabled:checked + label {
+ background-color: #e1e1e1;
+ color: #999999;
+}
+div.radio_bool input[type="radio"]:disabled + label {
+ background-color: #cfcfcf;
+ color: #aaaaaa;
}
/* --------------------------------------------------------------------- */
/* menu */
#menu {
- padding-bottom: 40px;
border-top: 1px solid lightsteelblue;
border-right: 1px solid lightsteelblue;
float: left;
background: white url("images/background.gif") repeat-y left;
}
-/* submenu */
+/* submenu in pgconfig */
#submenu {
- border: 1px solid lightsteelblue;
- float: right;
+ padding: 0px 30px 30px 10px;
background: ghostwhite;
font-size: x-small;
+ border-bottom: 1px solid lightsteelblue;
}
#submenu h3 {
- margin: 0px;
- padding: 4px 8px;
- border: 0px solid black;
- border-bottom: 4px solid white;
- color: white;
- background: steelblue;
- text-align: center;
+ border: 0px;
}
-#submenu ul {
- margin: 0px;
- padding: 8px;
- border-top: 1px solid lightsteelblue;
- list-style: square inside;
+#submenu ul li {
+ border: 0px;
+}
+#submenu ul li a:link {
+ padding: 3px;
}
/* footer */
border-radius: 3px;
color: white;
}
+p.check_error {
+ color: red;
+ font-weight: bold;
+}
+p.check_error span.error {
+ background: red;
+ color: white;
+ font-weight: bold;
+ padding: 1px 5px;
+
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 3px;
+ border-radius: 3px;
+}
+td.command_option {
+ padding-left: 30px;
+}
/* --------------------------------------------------------------------- */
/* Refresh info */
margin: 5px;
color: #2D1D00;
}
+
+
+form.pgconfig table {
+ width: 800px;
+}
+form.pgconfig table tr:hover {
+ background: #f6f6f6;
+}
+form.pgconfig th.colname {
+ width: 500px;
+}
+form.pgconfig tr.group th {
+ padding-left: 30px;
+}
</tr>
<tr>
<th><label>{$message.strErrorMessage|escape}</label></th>
- <td>{$message.$errorCode|escape}</td>
+ <td>{$message.$errorCode|escape}<br>{$detail|escape}</td>
</tr>
</td>
</tr>