From 42b1316cf2e27759dbe4620133deb1688f6635da Mon Sep 17 00:00:00 2001 From: Nozomi Anzai Date: Tue, 29 May 2012 15:19:18 +0900 Subject: [PATCH] Add "-C" option to "pgpool" command. Some refactoring. --- conf/pgmgt.conf.php | 2 +- config.php | 59 +++----- install/checkParameter.php | 277 +++++++++++------------------------ install/defaultParameter.php | 3 +- install/lang/en.lang.php | 3 +- install/lang/ja.lang.php | 3 +- lang/en.lang.php | 3 +- lang/ja.lang.php | 3 +- login.php | 3 +- status.php | 9 +- templates/status.tpl | 16 ++ version.php | 4 +- 12 files changed, 147 insertions(+), 238 deletions(-) diff --git a/conf/pgmgt.conf.php b/conf/pgmgt.conf.php index 86160de..8381360 100644 --- a/conf/pgmgt.conf.php +++ b/conf/pgmgt.conf.php @@ -8,9 +8,9 @@ define('_PGPOOL2_CMD_OPTION_LARGE_D', '0'); define('_PGPOOL2_CMD_OPTION_D', '0'); define('_PGPOOL2_CMD_OPTION_M', 's'); define('_PGPOOL2_CMD_OPTION_N', '0'); +define('_PGPOOL2_CMD_OPTION_LARGE_C', '0'); define('_PGPOOL2_LOG_FILE', '/tmp/pgpool.log'); define('_PGPOOL2_PCP_DIR', '/usr/local/bin'); define('_PGPOOL2_PCP_HOSTNAME', 'localhost'); -define('_PGPOOL2_PCP_TIMEOUT', '10'); define('_PGPOOL2_STATUS_REFRESH_TIME', '0'); ?> diff --git a/config.php b/config.php index 7bfb8f1..94a8e59 100644 --- a/config.php +++ b/config.php @@ -19,7 +19,7 @@ * is" without express or implied warranty. * * @author Ryuma Ando - * @copyright 2003-2011 PgPool Global Development Group + * @copyright 2003-2012 PgPool Global Development Group * @version CVS: $Id$ */ @@ -73,6 +73,8 @@ $params['m'] = (defined('_PGPOOL2_CMD_OPTION_M')) ? _PGPOOL2_CMD_OPTION_M : $message['errNoDefined']; $params['n'] = (defined('_PGPOOL2_CMD_OPTION_N')) ? _PGPOOL2_CMD_OPTION_N : $message['errNoDefined']; +$params['C'] = (defined('_PGPOOL2_CMD_OPTION_LARGE_C')) ? + _PGPOOL2_CMD_OPTION_LARGE_C : $message['errNoDefined']; $params['pgpool_logfile'] = (defined('_PGPOOL2_LOG_FILE')) ? _PGPOOL2_LOG_FILE : $message['errNoDefined']; $params['pcp_client_dir'] = (defined('_PGPOOL2_PCP_DIR')) ? @@ -229,44 +231,22 @@ function writePgmtConf($pgmgtConfigFile) $str = "\n"; fputs($fp, $str); @@ -274,4 +254,9 @@ function writePgmtConf($pgmgtConfigFile) fclose($fp); return TRUE; } + +function write($fp, $defname, $val) +{ + fputs($fp, "define('{$defname}', '{$val}');\n"); +} ?> diff --git a/install/checkParameter.php b/install/checkParameter.php index 59bb64f..9f907e9 100644 --- a/install/checkParameter.php +++ b/install/checkParameter.php @@ -19,7 +19,7 @@ * is" without express or implied warranty. * * @author Ryuma Ando - * @copyright 2003-2011 PgPool Global Development Group + * @copyright 2003-2012 PgPool Global Development Group * @version CVS: $Id$ */ @@ -107,6 +107,7 @@ $msgCmdLargeD = ''; $msgCmdD = ''; $msgCmdN = ''; $msgCmdM = ''; +$msgCmdLargeC = ''; $msgPgpoolLogFile = ''; if (isset($_POST['pgpool_logfile']) && $_POST['pgpool_logfile']) { @@ -123,6 +124,7 @@ if ($pgpool_logfile != '' && strpos($pgpool_logfile, '|') !== FALSE) { $error = TRUE; } +// check log file directory } elseif (!is_dir(dirname($pgpool_logfile))) { $msgPgpoolLogFile = 'Directory not found'; $error = TRUE; @@ -132,6 +134,7 @@ if ($pgpool_logfile != '' && strpos($pgpool_logfile, '|') !== FALSE) { $error = TRUE; } +// check pcp parameters if (isset($_POST['pcp_client_dir']) && $_POST['pcp_client_dir']) { $pcp_client_dir = $_POST['pcp_client_dir']; } else { @@ -141,7 +144,8 @@ if (isset($_POST['pcp_client_dir']) && $_POST['pcp_client_dir']) { $msgPcpClientDir = ''; if (!is_dir($pcp_client_dir)) { $msgPcpClientDir = 'Directory not found'; - $error = TRUE; + $error = TRUE; + } else { $command = array('pcp_attach_node', 'pcp_detach_node', @@ -170,18 +174,18 @@ if (isset($_POST['pcp_hostname']) && $_POST['pcp_hostname']) { $pcp_hostname = _PGPOOL2_PCP_HOSTNAME; } +$msgPcpTimeout = ''; if (isset($_POST['pcp_timeout']) && $_POST['pcp_timeout']) { $pcp_timeout= $_POST['pcp_timeout']; } else { $pcp_timeout = _PGPOOL2_PCP_TIMEOUT; - $msgPcpTimeout = ''; } +$msgPcpRefreshTime = ''; if (isset($_POST['pcp_refreshTime']) && $_POST['pcp_refreshTime']) { $pcp_refreshTime = $_POST['pcp_refreshTime']; } else { $pcp_refreshTime = _PGPOOL2_STATUS_REFRESH_TIME; - $msgPcpRefreshTime = ''; } /* --------------------------------------------------------------------- */ @@ -202,76 +206,27 @@ if ($error || (isset($_POST['submitBack']) && $_POST['submitBack'] != NULL)) { } if (!$error && $action == 'next') { - $fp = fopen( "../conf/pgmgt.conf.php", "w"); fputs($fp, ""."\n"); @@ -298,6 +253,7 @@ if (!$error && $action == 'next') {

Welcome to pgpool-II Administration Tool

+

'; } ?> + - - + + - - ' . $msgCmdC; - echo ' - - ' . $msgCmdLargeD; - echo ' - - ' . $msgCmdN; - echo ' + + + + - - ' . $msgCmdD; - echo ' - - ' . $msgCmdM; - echo ' - - - - -
- ' . $msgPgpoolConfigFile; - echo 'ng'; - } else { - echo 'ok'; - } - ?> +
- ' . $msgPasswordFile; - echo 'ng'; - } else { - echo 'ok'; - } - ?> + +
- ' . $msgPgpoolCommand; - echo 'ng'; - } else { - echo 'ok'; - } - ?> + +

ng'; - } else { - echo 'ok'; - } - ?> + +
ng'; - } else { - echo 'ok'; - } - ?> + +
ng'; - } else { - echo 'ok'; - } - ?> + + +
+
ng'; - } else { - echo 'ok'; - } - ?> + +
- ng'; - } else { - echo 'ok'; - } - ?> + +
- ' . $msgPgpoolLogFile; - echo 'ng'; - } else { - echo 'ok'; - } - ?> + +
- ' . $msgPcpClientDir; - echo 'ng'; - } else { - echo 'ok'; - } - ?> + +
- ' . $msgPcpHostname; - echo 'ng'; - } else { - echo 'ok'; - } - ?> + +
- ' . $msgPcpHostname; - echo 'ng'; - } else { - echo 'ok'; - } - ?> + +
- ' . $msgPcpRefreshTime; - echo 'ng'; - } else { - echo 'ok'; - } - ?> + +
+

'; + echo ''; } else { -echo ''; + echo ''; } ?>

@@ -507,3 +381,24 @@ echo '';
+ +' . $msg; + echo 'ng'; + } else { + echo 'ok'; + } +} diff --git a/install/defaultParameter.php b/install/defaultParameter.php index 6bf0bf9..1be6c12 100644 --- a/install/defaultParameter.php +++ b/install/defaultParameter.php @@ -19,7 +19,7 @@ * is" without express or implied warranty. * * @author Ryuma Ando - * @copyright 2003-2011:PgPool Global Development Group + * @copyright 2003-2012:PgPool Global Development Group * @version CVS: $Id$ */ @@ -31,6 +31,7 @@ define("_PGPOOL2_CMD_OPTION_LARGE_D", "0"); define("_PGPOOL2_CMD_OPTION_D", "0"); define("_PGPOOL2_CMD_OPTION_M", "s"); define("_PGPOOL2_CMD_OPTION_N", "0"); +define("_PGPOOL2_CMD_OPTION_LARGE_C", "0"); define("_PGPOOL2_LOG_FILE", "/tmp/pgpool.log"); define("_PGPOOL2_PCP_DIR", "/usr/local/bin"); define("_PGPOOL2_PCP_HOSTNAME", "localhost"); diff --git a/install/lang/en.lang.php b/install/lang/en.lang.php index bb6f7c1..91fe970 100644 --- a/install/lang/en.lang.php +++ b/install/lang/en.lang.php @@ -19,7 +19,7 @@ * is" without express or implied warranty. * * @author Ryuma Ando - * @copyright 2003-2008 PgPool Global Development Group + * @copyright 2003-2012 PgPool Global Development Group * @version CVS: $Id$ */ @@ -42,6 +42,7 @@ $message = array( 'strCmdM' => 'stop mode', 'strCmdLargeD' => 'Discard pgpool_status file', 'strCmdN' => 'don\'t run in daemon mode', + 'strCmdLargeC' => 'Discard oid maps for om memory query cache', 'strCmdPgpoolFile' => 'pgpool.conf', 'strCmdPcpFile' => 'pcp.conf', 'strCmdDesc' => 'If it is a blank, this option is ignored.', diff --git a/install/lang/ja.lang.php b/install/lang/ja.lang.php index ec57016..700380f 100644 --- a/install/lang/ja.lang.php +++ b/install/lang/ja.lang.php @@ -19,7 +19,7 @@ * is" without express or implied warranty. * * @author Ryuma Ando - * @copyright 2003-2008 PgPool Global Development Group + * @copyright 2003-2012 PgPool Global Development Group * @version CVS: $Id$ */ @@ -42,6 +42,7 @@ $message = array( 'strCmdM' => '停止モード', 'strCmdLargeD' => 'pgpool_status を無視', 'strCmdN' => '非デーモンモード', + 'strCmdLargeC' => 'オンメモリキャッシュの oid map をリセット', 'strCmdPgpoolFile' => 'pgpool.conf', 'strCmdPcpFile' => 'pcp.conf', 'strCmdDesc' => '空白の場合には無視', diff --git a/lang/en.lang.php b/lang/en.lang.php index cde2290..95cffe0 100644 --- a/lang/en.lang.php +++ b/lang/en.lang.php @@ -19,7 +19,7 @@ * is" without express or implied warranty. * * @author Ryuma Ando - * @copyright 2003-2009 PgPool Global Development Group + * @copyright 2003-2012 PgPool Global Development Group * @version CVS: $Id$ */ @@ -177,6 +177,7 @@ $message = array( 'strCmdC' => 'Clears query cache', 'strCmdD' => 'Debug mode', 'strCmdDesc' => 'If it is a blank, this option is ignored.', + 'strCmdLargeC' => 'Discard oid maps for on memory query cache', 'strCmdLargeD' => 'Discard pgpool_status file', 'strCmdM' => 'Stop mode', 'strCmdN' => 'Don\'t run in daemon mode', diff --git a/lang/ja.lang.php b/lang/ja.lang.php index 692cd03..ad7feae 100644 --- a/lang/ja.lang.php +++ b/lang/ja.lang.php @@ -19,7 +19,7 @@ * is" without express or implied warranty. * * @author Ryuma Ando - * @copyright 2003-2008 PgPool Global Development Group + * @copyright 2003-2012 PgPool Global Development Group * @version CVS: $Id$ */ @@ -169,6 +169,7 @@ $message = array( 'strCmdC' => 'クエリキャッシュクリア', 'strCmdD' => 'デバッグモード', 'strCmdDesc' => '空白の場合には無視', + 'strCmdLargeC' => 'オンメモリキャッシュの oid map をリセット', 'strCmdLargeD' => 'pgpool_status を無視', 'strCmdM' => '停止モード', 'strCmdN' => '非デーモンモード', diff --git a/login.php b/login.php index 8535c85..aae1e81 100644 --- a/login.php +++ b/login.php @@ -19,7 +19,7 @@ * is" without express or implied warranty. * * @author Ryuma Ando - * @copyright 2003-2008 PgPool Global Development Group + * @copyright 2003-2012 PgPool Global Development Group * @version CVS: $Id$ */ @@ -96,6 +96,7 @@ $tpl->assign('D', _PGPOOL2_CMD_OPTION_LARGE_D); $tpl->assign('d', _PGPOOL2_CMD_OPTION_D); $tpl->assign('m', _PGPOOL2_CMD_OPTION_M); $tpl->assign('n', _PGPOOL2_CMD_OPTION_N); +$tpl->assign('C', _PGPOOL2_CMD_OPTION_LARGE_C); $tpl->assign('pgpoolStatus', NULL); $tpl->assign('pgpoolMessage', NULL); diff --git a/status.php b/status.php index ad0a6cb..0ce1bb0 100644 --- a/status.php +++ b/status.php @@ -19,7 +19,7 @@ * is" without express or implied warranty. * * @author Ryuma Ando - * @copyright 2003-2008 PgPool Global Development Group + * @copyright 2003-2012 PgPool Global Development Group * @version SVN: $Id$ */ @@ -55,6 +55,7 @@ $tpl->assign('D', _PGPOOL2_CMD_OPTION_LARGE_D); $tpl->assign('d', _PGPOOL2_CMD_OPTION_D); $tpl->assign('m', _PGPOOL2_CMD_OPTION_M); $tpl->assign('n', _PGPOOL2_CMD_OPTION_N); +$tpl->assign('C', _PGPOOL2_CMD_OPTION_LARGE_C); if (isPipe(_PGPOOL2_LOG_FILE)) { $tpl->assign('pipe', 1); @@ -95,6 +96,9 @@ switch ($action) { $args = "$args -n > $pgpoolLog "; } } + if (isset($_POST['C'])) { + $args = $args . "-C "; + } $ret = execPcp('PCP_START_PGPOOL', $args); if (!array_key_exists('SUCCESS', $ret)) { @@ -209,6 +213,9 @@ switch ($action) { $args = "$args -n > $pgpoolLog "; } } + if (isset($_POST['C'])) { + $args = $args . "-C "; + } $ret = execPcp('PCP_START_PGPOOL', $args); if (!array_key_exists('SUCCESS', $ret)) { diff --git a/templates/status.tpl b/templates/status.tpl index 04068a1..9cf57e7 100644 --- a/templates/status.tpl +++ b/templates/status.tpl @@ -268,6 +268,14 @@ function changeView(chView){ {/if} + {$message.strCmdLargeC|escape} (-C) + {if $C == 1} + + {else} + + {/if} + + {$message.strCmdD|escape} (-d) {if $d == 1} @@ -376,6 +384,14 @@ function changeView(chView){ {/if} + {$message.strCmdLargeC|escape} (-C) + {if $C == 1} + + {else} + + {/if} + + {$message.strCmdD|escape}(-d) {if $d == 1} diff --git a/version.php b/version.php index 92190ab..b309012 100644 --- a/version.php +++ b/version.php @@ -19,10 +19,10 @@ * is" without express or implied warranty. * * @author Ryuma Ando - * @copyright 2003-2011 PgPool Global Development Group + * @copyright 2003-2012 PgPool Global Development Group * @version SVN: $Id$ */ -$version = '3.1.1'; +$version = '3.2.0'; ?> -- 2.39.5