case 'PCP_START_PGPOOL':
$configOption = ' -f ' . _PGPOOL2_CONFIG_FILE . ' -F ' . _PGPOOL2_PASSWORD_FILE;
- if(strpos($num, '|') !== FALSE) {
- // pipe
+ if(isPipe($num)) {
$cmdOption = $configOption . $num . ' > /dev/null &';
} else {
$cmdOption = $configOption . $num . ' 2>&1 &';
}
+function isPipe($str)
+{
+ return (strpos($str, '|') !== FALSE);
+}
+
?>
} else {
$errors[$key] = $message['errNoDefined'];
}
- if($params[$key] != '' && (strpos($params[$key], '|') !== FALSE)) {
+ if($params[$key] != '' && isPipe($params[$key])) {
// pipe
$tmp_str = trim($params[$key]);
if(($tmp_str[0] != '|') || ($tmp_str[strlen($tmp_str) - 1] == '|')) {
$tpl->assign('d', _PGPOOL2_CMD_OPTION_D);
$tpl->assign('m', _PGPOOL2_CMD_OPTION_M);
$tpl->assign('n', _PGPOOL2_CMD_OPTION_N);
+if(isPipe(_PGPOOL2_LOG_FILE))
+ $tpl->assign('pipe', 1);
+else
+ $tpl->assign('pipe', 0);
switch ($action) {
case 'start':
$logDir = readLogDir();
$pgpoolLog = "$logDir/pgpool.log";
}
- if(strpos($pgpoolLog, '|') !== FALSE)
+ if(isPipe($pgpoolLog))
$args = "$args -n 2>&1 $pgpoolLog ";
else
$args = "$args -n > $pgpoolLog ";
$logDir = readLogDir();
$pgpoolLog = "$logDir/pgpool.log";
}
- if(strpos($pgpoolLog, '|') !== FALSE)
+ if(isPipe($pgpoolLog))
$args = "$args -n 2>&1 $pgpoolLog ";
else
$args = "$args -n > $pgpoolLog ";
<input type="button" name="command" onclick="changeView('summary')" value="{$message.strPgpoolSummary|escape}" />
<input type="button" name="command" onclick="changeView('proc')" value="{$message.strProcInfo|escape}" />
<input type="button" name="command" onclick="changeView('node')" value="{$message.strNodeInfo|escape}" />
- {if $n == 1}
+ {if $n == 1 && $pipe == 0}
<input type="button" name="command" onclick="changeView('log')" value="{$message.strLog|escape}" />
{/if}
</p>
<input type="button" name="command" onclick="changeView('summary')" value="{$message.strPgpoolSummary|escape}" />
<input type="button" name="command" onclick="changeView('proc')" value="{$message.strProcInfo|escape}" />
<input type="button" name="command" onclick="changeView('node')" value="{$message.strNodeInfo|escape}" />
- {if $n == 1}
+ {if $n == 1 && $pipe == 0}
<input type="button" name="command" onclick="changeView('log')" value="{$message.strLog|escape}" />
{/if}
</p>