Fix Notice errors when _PGPOOL_VERSION is not 3.2
authorNozomi Anzai <anzai@sraoss.co.jp>
Fri, 1 Jun 2012 07:17:21 +0000 (16:17 +0900)
committerNozomi Anzai <anzai@sraoss.co.jp>
Fri, 1 Jun 2012 07:17:21 +0000 (16:17 +0900)
common.php

index 81275dce0fe08dc7cc09bd516fdfdf8a1ddcc8ee..df949289acc0bb399cf9d20753ae9aea5b9cf88e 100644 (file)
@@ -19,7 +19,7 @@
  * is" without express or implied warranty.
  *
  * @author     Ryuma Ando <ando@ecomas.co.jp>
- * @copyright  2003-2008 PgPool Global Development Group
+ * @copyright  2003-2012 PgPool Global Development Group
  * @version    SVN: $Id$
  */
 
@@ -271,14 +271,18 @@ function NodeStandby($num)
     $params = readHealthCheckParam();
 
     $healthCheckUser = $params['health_check_user'];
+    $healthCheckPw   = (isset($params['health_check_password'])) ?
+                       $params['health_check_password'] : "''";
     $backendHostName = $params['backend_hostname'][$num];
     $backendPort     = $params['backend_port'][$num];
-    $healthCheckDb = 'template1';
+    $healthCheckDb   = 'template1';
 
     if ($backendHostName != '') {
-        $conStr = "dbname=$healthCheckDb user=$healthCheckUser host=$backendHostName port=$backendPort" ;
+        $conStr = "dbname=$healthCheckDb host=$backendHostName port=$backendPort ".
+                  "user=$healthCheckUser password=$healthCheckPw";
     } else {
-        $conStr = "dbname=$healthCheckDb port=$backendPort user=$healthCheckUser" ;
+        $conStr = "dbname=$healthCheckDb port=$backendPort ".
+                  "user=$healthCheckUser password=$healthCheckPw" ;
     }
 
     $conn = @pg_connect($conStr);
@@ -315,6 +319,7 @@ function readHealthCheckParam()
 {
 
     $params = readConfigParams(array('health_check_user',
+                                     'health_check_password',
                                      'backend_hostname',
                                      'backend_port',
                                      'backend_weight'));
@@ -404,6 +409,8 @@ function useStreaming()
  */
 function useSyslog()
 {
+    if (!paramExists('log_destination')) { return FALSE; }
+
     $params = readConfigParams(array('log_destination'));
 
     if ($params['log_destination'] == 'syslog') {
@@ -481,7 +488,9 @@ function readConfigParams($paramList = FALSE)
                    !preg_match("/^backend_data_directory/", $key) &&
                    !preg_match("/^backend_flag/",           $key))
                 {
-                    $results[$key] = $pgpoolConfigParam[$key]['default'];
+                    if (isset($configParam[$key])) {
+                        $results[$key] = $configParam[$key]['default'];
+                    }
                 }
             }
         }