From d3b0d1dddd99d8a208e8b44c998d3d7d06f0af79 Mon Sep 17 00:00:00 2001 From: Frank Fegert Date: Sun, 5 Jul 2009 16:03:32 +0000 Subject: [PATCH] - Fixed Bug #0000011: Added '.exe' suffix to dsmadmc and php binary string in installer. --- includes/global.php | 4 +++- install.php | 17 +++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/includes/global.php b/includes/global.php index f0dba41..90a2db2 100644 --- a/includes/global.php +++ b/includes/global.php @@ -62,9 +62,11 @@ $config["server_os"] = (strstr(PHP_OS, "WIN")) ? "win32" : "unix"; // ** Search paths for external programs (dsmadmc, php, ...) ** // if ($config["server_os"] == "win32") { - $config["search_path"] = array('c:/php', 'c:/progra~1/php', 'd:/php', 'd:/progra~1/php', 'c:/progra~1/tivoli/tsm/baclient', 'd:/progra~1/tivoli/tsm/baclient'); + $config["search_path"] = array('c:/php', 'c:/progra~1/php', 'c:/progra~2/php', 'c:/xampp/php', 'd:/php', 'd:/progra~1/php', 'd:/progra~2/php', 'd:/xampp/php', 'c:/progra~1/tivoli/tsm/baclient', 'c:/progra~2/tivoli/tsm/baclient', 'd:/progra~1/tivoli/tsm/baclient', 'd:/progra~2/tivoli/tsm/baclient'); + $config["binary_suffix"] = ".exe"; } elseif ($config["server_os"] == "unix") { $config["search_path"] = array('/bin', '/sbin', '/usr/bin', '/usr/sbin', '/usr/local/bin', '/usr/local/sbin', '/usr/tivoli/tsm/client/admin/bin', '/opt/tivoli/tsm/client/ba/bin'); + $config["binary_suffix"] = ""; } // ** Paths (libraries, includes, ...) ** // diff --git a/install.php b/install.php index e7473d5..9a259b1 100644 --- a/install.php +++ b/install.php @@ -157,28 +157,28 @@ if (empty($_REQUEST["step"])) { // dsmadmc binary path $_SESSION["install"]["paths"]["path_dsmadmc"]["name"] = "dsmadmc Binary Path"; $_SESSION["install"]["paths"]["path_dsmadmc"]["desc"] = "The path to the TSM admin client binary."; - $which_dsmadmc = $tsmmonitor->findPath("dsmadmc", $config["search_path"]); + $which_dsmadmc = $tsmmonitor->findPath("dsmadmc".$config["binary_suffix"], $config["search_path"]); if (isset($tsmmonitor->configarray["settings"]["paths"]["path_dsmadmc"])) { $_SESSION["install"]["paths"]["path_dsmadmc"]["default"] = $tsmmonitor->configarray["settings"]["path_dsmadmc"]; } else if (!empty($which_dsmadmc)) { $_SESSION["install"]["paths"]["path_dsmadmc"]["default"] = $which_dsmadmc; } else { - $_SESSION["install"]["paths"]["path_dsmadmc"]["default"] = "dsmadmc"; + $_SESSION["install"]["paths"]["path_dsmadmc"]["default"] = "dsmadmc".$config["binary_suffix"]; } // php/php5 binary path $_SESSION["install"]["paths"]["path_php"]["name"] = "PHP Binary Path"; $_SESSION["install"]["paths"]["path_php"]["desc"] = "The path to the PHP binary."; - $which_php = $tsmmonitor->findPath("php", $config["search_path"]); + $which_php = $tsmmonitor->findPath("php".$config["binary_suffix"], $config["search_path"]); if(!isset($which_php)) { - $which_php = $tsmmonitor->findPath("php5", $config["search_path"]); + $which_php = $tsmmonitor->findPath("php5".$config["binary_suffix"], $config["search_path"]); } if (isset($tsmmonitor->configarray["settings"]["paths"]["path_php"])) { $_SESSION["install"]["paths"]["path_php"]["default"] = $tsmmonitor->configarray["settings"]["path_php"]; } else if (!empty($which_php)) { $_SESSION["install"]["paths"]["path_php"]["default"] = $which_php; } else { - $_SESSION["install"]["paths"]["path_php"]["default"] = "php"; + $_SESSION["install"]["paths"]["path_php"]["default"] = "php".$config["binary_suffix"]; } // Logfile path @@ -259,7 +259,7 @@ if (empty($_REQUEST["step"])) { if ($input_err == "") { $dsmadmc = $_SESSION["install"]["paths"]["path_dsmadmc"]["default"]; if (file_exists($dsmadmc) && is_executable($dsmadmc)) { - $popen_flags = ($os == "win32") ? 'rb' : 'r'; + $popen_flags = ($config["server_os"] == "win32") ? 'rb' : 'r'; $oh = popen($dsmadmc." -se=".$server['srv_servername']." -id=".$server['srv_username']." -password=".$server['srv_password']." -TCPServeraddress=".$server['srv_ip']." -COMMMethod=TCPIP -TCPPort=".$server['srv_port']." -dataonly=yes -TAB \"SELECT SERVER_HLA,SERVER_LLA FROM status\" ", "$popen_flags"); if ($oh != 0) { while (!feof($oh)) { @@ -469,6 +469,11 @@ if ($_REQUEST["step"] == "90") { foreach ($_SESSION["install"]["paths"] as $name => $array) { if (isset($_SESSION["install"]["paths"][$name])) { $file = $array["default"]; + if ($name == "path_dsmadmc" || $name == "path_php") { + if ($config["server_os"] == "win32" && !ereg(".exe$", $file)) { + $file = $file.$config["binary_suffix"]; + } + } $resStr = ""; $capStr = "";