From f7a540c1eafb27c4c119b03e9a6b17957ca9c0f5 Mon Sep 17 00:00:00 2001 From: Jarrett Jordaan Date: Wed, 6 Jan 2010 16:31:44 +0200 Subject: [PATCH] Updated utilites. --- setup/upgrade/upgradeUtil.php | 20 +------------------- setup/wizard/installUtil.php | 31 ++++++++++++++++++++++--------- setup/wizard/lib/services/unixScheduler.php | 12 +----------- setup/wizard/lib/services/windowsLucene.php | 7 +++---- setup/wizard/lib/validation/luceneValidation.php | 22 ---------------------- setup/wizard/lib/validation/schedulerValidation.php | 26 +------------------------- 6 files changed, 28 insertions(+), 90 deletions(-) diff --git a/setup/upgrade/upgradeUtil.php b/setup/upgrade/upgradeUtil.php index 6bfd6f2..33268e4 100644 --- a/setup/upgrade/upgradeUtil.php +++ b/setup/upgrade/upgradeUtil.php @@ -161,8 +161,7 @@ class UpgradeUtil extends InstallUtil { $mechanism = "--port=\"$dbPort\""; } -// $tmpdir = $this->resolveTempDir(); - $this->resolveTempDir(); + $this->util->resolveTempDir(); $stmt = $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism drop \"$dbName\"
"; $stmt .= $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism create \"$dbName\"
"; @@ -214,24 +213,7 @@ class UpgradeUtil extends InstallUtil { return ''; } - public function resolveTempDir() - { - $dir = ''; - if (!WINDOWS_OS) { - $dir='/tmp/kt-db-backup'; - } - else { - $dir='c:/kt-db-backup'; - } -// $oKTConfig =& KTConfig::getSingleton(); -// $dir = $oKTConfig->get('backup/backupDirectory',$dir); - - if (!is_dir($dir)) { - mkdir($dir); - } - return $dir; - } } ?> \ No newline at end of file diff --git a/setup/wizard/installUtil.php b/setup/wizard/installUtil.php index 0e4d47f..407db15 100644 --- a/setup/wizard/installUtil.php +++ b/setup/wizard/installUtil.php @@ -1071,11 +1071,11 @@ class InstallUtil { } } if (substr($sDst, 0, strlen($sSrc)) === $sSrc) { - return false; //PEAR::raiseError(_kt("Destination of move is within source")); + return false; } $hSrc = @opendir($sSrc); if ($hSrc === false) { - return false; //PEAR::raiseError(sprintf(_kt("Could not open source directory: %s"), $sSrc)); + return false; } @mkdir($sDst, 0777); while (($sFilename = readdir($hSrc)) !== false) { @@ -1112,34 +1112,47 @@ class InstallUtil { } $aSrcStat = stat($sSrc); if ($aSrcStat === false) { - return false; //PEAR::raiseError(sprintf(_kt("Couldn't stat source file: %s"), $sSrc)); + return false; } $aDstStat = stat(dirname($sDst)); if ($aDstStat === false) { - return false; //PEAR::raiseError(sprintf(_kt("Couldn't stat destination location: %s"), $sDst)); + return false; } if ($aSrcStat["dev"] === $aDstStat["dev"]) { $res = @rename($sSrc, $sDst); if ($res === false) { - return false; //PEAR::raiseError(sprintf(_kt("Couldn't move file to destination: %s"), $sDst)); + return false; } return; } $res = @copy($sSrc, $sDst); if ($res === false) { - return false; //PEAR::raiseError(sprintf(_kt("Could not copy to destination: %s"), $sDst)); + return false; } $res = @unlink($sSrc); if ($res === false) { - return false; //PEAR::raiseError(sprintf(_kt("Could not remove source: %s"), $sSrc)); + return false; } } else { $res = @rename($sSrc, $sDst); if ($res === false) { - return false; //PEAR::raiseError(sprintf(_kt("Could not move to destination: %s"), $sDst)); + return false; } } } - // }}} + + public function resolveTempDir() { + $dir = ''; + if (!WINDOWS_OS) { + $dir='/tmp/kt-db-backup'; + } else { + $dir='c:/kt-db-backup'; + } + + if (!is_dir($dir)) { + mkdir($dir); + } + return $dir; + } } ?> diff --git a/setup/wizard/lib/services/unixScheduler.php b/setup/wizard/lib/services/unixScheduler.php index a1b3a57..0cca189 100644 --- a/setup/wizard/lib/services/unixScheduler.php +++ b/setup/wizard/lib/services/unixScheduler.php @@ -112,7 +112,6 @@ class unixScheduler extends unixService { $content = "#!/bin/sh\n"; $content .= "cd ".SYS_BIN_DIR."\n"; $content .= "while true; do\n"; - // TODO : This will not work without CLI $content .= "{$this->phpCli} -Cq scheduler.php\n"; $content .= "sleep 30\n"; $content .= "done"; @@ -176,24 +175,15 @@ class unixScheduler extends unixService { * @return array */ function start() { - // TODO : Write sh on the fly? Not sure the reasoning here $source = $this->getSchedulerSourceLoc(); -// $this->writeSchedulerTask(); $logFile = "/dev/null"; -// @unlink($logFile); if($source) { // Source $cmd = "nohup ".$source." > ".$logFile." 2>&1 & echo $!"; } else { // Could be Stack $source = SYS_BIN_DIR.$this->schedulerSource; $cmd = "nohup ".$source." > ".$logFile." 2>&1 & echo $!"; } -// if(DEBUG) { -// echo "$cmd
"; -// return ; -// } - //$response = $this->util->pexec($cmd); - -// return $response; + return false; } diff --git a/setup/wizard/lib/services/windowsLucene.php b/setup/wizard/lib/services/windowsLucene.php index efdf603..2e14227 100644 --- a/setup/wizard/lib/services/windowsLucene.php +++ b/setup/wizard/lib/services/windowsLucene.php @@ -172,10 +172,10 @@ class windowsLucene extends windowsService { return true; } } - // TODO: Will not detect, but a java pre-check is done in services, before this if(file_exists($this->varDir.'outJVHome')) { $this->javaBin = file_get_contents($this->varDir.'outJVHome'); - if($this->javaBin != '') return true; + if($this->javaBin != '') + return true; } return false; @@ -400,8 +400,7 @@ class windowsLucene extends windowsService { */ public function getJavaJVM() { $this->javaJVM = SYSTEM_ROOT . "java\jre\bin\client\jvm.dll"; - return SYSTEM_ROOT . "java\jre\bin\client\jvm.dll"; // Hard code - //return $this->javaJVM; // TODO: PUT BACK!!! + return SYSTEM_ROOT . "java\jre\bin\client\jvm.dll"; } private function writeLuceneInstall($cmd) { diff --git a/setup/wizard/lib/validation/luceneValidation.php b/setup/wizard/lib/validation/luceneValidation.php index 80dcf47..8302815 100644 --- a/setup/wizard/lib/validation/luceneValidation.php +++ b/setup/wizard/lib/validation/luceneValidation.php @@ -380,28 +380,6 @@ class luceneValidation extends serviceValidation { } $javaExecutable = $this->java; } - if(WINDOWS_OS) { - $cmd = "\"$javaExecutable\" -cp \"".SYS_DIR.";\" javaVersion \"".$this->outputDir."outJV\""." \"".$this->outputDir."outJVHome\""; - $func = OS."ReadJVFromFile"; - if($this->$func($cmd)) { - return true; - } else { - $this->java = $this->util->useZendJava(); // Java not installed - $javaExecutable = $this->java; - $cmd = "\"$javaExecutable\" -cp \"".SYS_DIR.";\" javaVersion \"".$this->outputDir."outJV\""." \"".$this->outputDir."outJVHome\""; - if($this->$func($cmd)) { - return true; - } - } - } else { - $cmd = "\"$javaExecutable\" -version > ".$this->outputDir."outJV 2>&1 echo $!"; - $func = OS."ReadJVFromFile"; - if($this->$func($cmd)) { - return true; - } else { - // TODO: Not sure - } - } $this->javaVersionInCorrect(); $this->javaCheck = 'cross'; diff --git a/setup/wizard/lib/validation/schedulerValidation.php b/setup/wizard/lib/validation/schedulerValidation.php index 1faa6a1..49333f7 100644 --- a/setup/wizard/lib/validation/schedulerValidation.php +++ b/setup/wizard/lib/validation/schedulerValidation.php @@ -89,7 +89,6 @@ class schedulerValidation extends serviceValidation { } public function binaryChecks() { - // TODO: Better detection $phpDir = $this->util->useZendPhp(); if(WINDOWS_OS) { $phpPath = "$phpDir"."php.exe"; @@ -101,29 +100,6 @@ class schedulerValidation extends serviceValidation { } } - function detPhpSettings() { - // TODO: Better php handling - return true; - $phpExecutable = $this->util->phpSpecified();// Retrieve java bin - $cmd = "$phpExecutable -version > ".$this->outputDir."/outPHP 2>&1 echo $!"; - $response = $this->util->pexec($cmd); - if(file_exists($this->outputDir.'outPHP')) { - $tmp = file_get_contents($this->outputDir.'outPHP'); - preg_match('/PHP/',$tmp, $matches); - if($matches) { - $this->phpCheck = 'tick'; - - return true; - } else { - $this->phpCheck = 'cross_orange'; - $this->phpExeError = "PHP : Incorrect path specified"; - $this->error[] = "PHP executable required"; - - return false; - } - } - } - /** * Set template view to specify php * @@ -150,7 +126,7 @@ class schedulerValidation extends serviceValidation { return $this->php; } - public function storeSilent() { // TODO : PHP detection + public function storeSilent() { $this->temp_variables['schedulerInstalled'] = $this->installed; $this->temp_variables['phpCheck'] = $this->phpCheck; $this->temp_variables['phpExeError'] = $this->phpExeError; -- libgit2 0.21.4