Disable "Log" button in "pgpool status" screen if a PIPE command is set as a log...
authorUser yamaguti <yamaguti at pgfoundry.org>
Wed, 6 Feb 2008 08:41:32 +0000 (08:41 +0000)
committerUser yamaguti <yamaguti at pgfoundry.org>
Wed, 6 Feb 2008 08:41:32 +0000 (08:41 +0000)
command.php
common.php
config.php
status.php
templates/status.tpl

index 7b4fc274b75f00e622966ec77e173e2e59f20357..537d9667295ce3feed5afcb6b512516b61032bcf 100644 (file)
@@ -91,8 +91,7 @@ function execPcp($command, $num='') {
         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 &';
index 3af4244c792b66e71d5f99d8366433471c6749ff..f96b77836411bf4346dd992ade273e5ca01ec2ff 100644 (file)
@@ -392,4 +392,9 @@ function readConfigParams($paramList = FALSE) {
     
 }
 
+function isPipe($str) 
+{
+       return (strpos($str, '|') !== FALSE);
+}
+
 ?>
index f31f481fc5809c8e55fadef6d98e7e7473a38497..59121adbce4c6f64c00adbba82873d900fb0fe2e 100644 (file)
@@ -177,7 +177,7 @@ switch ( $action ) {
         } 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] == '|')) {
index e4835610563b45a0746c757c83682b823a3c9e42..254c7d0530948062612296883021dbfd7803f686 100644 (file)
@@ -55,6 +55,10 @@ $tpl->assign('c', _PGPOOL2_CMD_OPTION_C);
 $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':
@@ -72,7 +76,7 @@ switch ($action) {
                 $logDir = readLogDir();
                 $pgpoolLog = "$logDir/pgpool.log";
             }
-                       if(strpos($pgpoolLog, '|') !== FALSE) 
+                       if(isPipe($pgpoolLog))
                                $args = "$args -n 2>&1 $pgpoolLog ";
                        else
                                $args = "$args -n > $pgpoolLog ";
@@ -169,7 +173,7 @@ switch ($action) {
                 $logDir = readLogDir();
                 $pgpoolLog = "$logDir/pgpool.log";
             }
-                       if(strpos($pgpoolLog, '|') !== FALSE
+                       if(isPipe($pgpoolLog)
                                $args = "$args -n 2>&1 $pgpoolLog ";
                        else
                                $args = "$args -n > $pgpoolLog ";
index 97c589884516670bd4615be8ab0cd3cd5eadef65..441dc6d35eabbcdbe1dd99ea65cf4168a8e72068 100644 (file)
@@ -177,7 +177,7 @@ function changeView(chView){
     <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>    
@@ -186,7 +186,7 @@ function changeView(chView){
     <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>