Commit f7a540c1eafb27c4c119b03e9a6b17957ca9c0f5
1 parent
2313e9b9
Updated utilites.
Committed by: Jarrett Jordaan Reviewed by: Megan Watson
Showing
6 changed files
with
28 additions
and
90 deletions
setup/upgrade/upgradeUtil.php
| ... | ... | @@ -161,8 +161,7 @@ class UpgradeUtil extends InstallUtil { |
| 161 | 161 | $mechanism = "--port=\"$dbPort\""; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | -// $tmpdir = $this->resolveTempDir(); | |
| 165 | - $this->resolveTempDir(); | |
| 164 | + $this->util->resolveTempDir(); | |
| 166 | 165 | |
| 167 | 166 | $stmt = $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism drop \"$dbName\"<br/>"; |
| 168 | 167 | $stmt .= $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism create \"$dbName\"<br/>"; |
| ... | ... | @@ -214,24 +213,7 @@ class UpgradeUtil extends InstallUtil { |
| 214 | 213 | return ''; |
| 215 | 214 | } |
| 216 | 215 | |
| 217 | - public function resolveTempDir() | |
| 218 | - { | |
| 219 | - $dir = ''; | |
| 220 | - if (!WINDOWS_OS) { | |
| 221 | - $dir='/tmp/kt-db-backup'; | |
| 222 | - } | |
| 223 | - else { | |
| 224 | - $dir='c:/kt-db-backup'; | |
| 225 | - } | |
| 226 | 216 | |
| 227 | -// $oKTConfig =& KTConfig::getSingleton(); | |
| 228 | -// $dir = $oKTConfig->get('backup/backupDirectory',$dir); | |
| 229 | - | |
| 230 | - if (!is_dir($dir)) { | |
| 231 | - mkdir($dir); | |
| 232 | - } | |
| 233 | - return $dir; | |
| 234 | - } | |
| 235 | 217 | |
| 236 | 218 | } |
| 237 | 219 | ?> |
| 238 | 220 | \ No newline at end of file | ... | ... |
setup/wizard/installUtil.php
| ... | ... | @@ -1071,11 +1071,11 @@ class InstallUtil { |
| 1071 | 1071 | } |
| 1072 | 1072 | } |
| 1073 | 1073 | if (substr($sDst, 0, strlen($sSrc)) === $sSrc) { |
| 1074 | - return false; //PEAR::raiseError(_kt("Destination of move is within source")); | |
| 1074 | + return false; | |
| 1075 | 1075 | } |
| 1076 | 1076 | $hSrc = @opendir($sSrc); |
| 1077 | 1077 | if ($hSrc === false) { |
| 1078 | - return false; //PEAR::raiseError(sprintf(_kt("Could not open source directory: %s"), $sSrc)); | |
| 1078 | + return false; | |
| 1079 | 1079 | } |
| 1080 | 1080 | @mkdir($sDst, 0777); |
| 1081 | 1081 | while (($sFilename = readdir($hSrc)) !== false) { |
| ... | ... | @@ -1112,34 +1112,47 @@ class InstallUtil { |
| 1112 | 1112 | } |
| 1113 | 1113 | $aSrcStat = stat($sSrc); |
| 1114 | 1114 | if ($aSrcStat === false) { |
| 1115 | - return false; //PEAR::raiseError(sprintf(_kt("Couldn't stat source file: %s"), $sSrc)); | |
| 1115 | + return false; | |
| 1116 | 1116 | } |
| 1117 | 1117 | $aDstStat = stat(dirname($sDst)); |
| 1118 | 1118 | if ($aDstStat === false) { |
| 1119 | - return false; //PEAR::raiseError(sprintf(_kt("Couldn't stat destination location: %s"), $sDst)); | |
| 1119 | + return false; | |
| 1120 | 1120 | } |
| 1121 | 1121 | if ($aSrcStat["dev"] === $aDstStat["dev"]) { |
| 1122 | 1122 | $res = @rename($sSrc, $sDst); |
| 1123 | 1123 | if ($res === false) { |
| 1124 | - return false; //PEAR::raiseError(sprintf(_kt("Couldn't move file to destination: %s"), $sDst)); | |
| 1124 | + return false; | |
| 1125 | 1125 | } |
| 1126 | 1126 | return; |
| 1127 | 1127 | } |
| 1128 | 1128 | $res = @copy($sSrc, $sDst); |
| 1129 | 1129 | if ($res === false) { |
| 1130 | - return false; //PEAR::raiseError(sprintf(_kt("Could not copy to destination: %s"), $sDst)); | |
| 1130 | + return false; | |
| 1131 | 1131 | } |
| 1132 | 1132 | $res = @unlink($sSrc); |
| 1133 | 1133 | if ($res === false) { |
| 1134 | - return false; //PEAR::raiseError(sprintf(_kt("Could not remove source: %s"), $sSrc)); | |
| 1134 | + return false; | |
| 1135 | 1135 | } |
| 1136 | 1136 | } else { |
| 1137 | 1137 | $res = @rename($sSrc, $sDst); |
| 1138 | 1138 | if ($res === false) { |
| 1139 | - return false; //PEAR::raiseError(sprintf(_kt("Could not move to destination: %s"), $sDst)); | |
| 1139 | + return false; | |
| 1140 | 1140 | } |
| 1141 | 1141 | } |
| 1142 | 1142 | } |
| 1143 | - // }}} | |
| 1143 | + | |
| 1144 | + public function resolveTempDir() { | |
| 1145 | + $dir = ''; | |
| 1146 | + if (!WINDOWS_OS) { | |
| 1147 | + $dir='/tmp/kt-db-backup'; | |
| 1148 | + } else { | |
| 1149 | + $dir='c:/kt-db-backup'; | |
| 1150 | + } | |
| 1151 | + | |
| 1152 | + if (!is_dir($dir)) { | |
| 1153 | + mkdir($dir); | |
| 1154 | + } | |
| 1155 | + return $dir; | |
| 1156 | + } | |
| 1144 | 1157 | } |
| 1145 | 1158 | ?> | ... | ... |
setup/wizard/lib/services/unixScheduler.php
| ... | ... | @@ -112,7 +112,6 @@ class unixScheduler extends unixService { |
| 112 | 112 | $content = "#!/bin/sh\n"; |
| 113 | 113 | $content .= "cd ".SYS_BIN_DIR."\n"; |
| 114 | 114 | $content .= "while true; do\n"; |
| 115 | - // TODO : This will not work without CLI | |
| 116 | 115 | $content .= "{$this->phpCli} -Cq scheduler.php\n"; |
| 117 | 116 | $content .= "sleep 30\n"; |
| 118 | 117 | $content .= "done"; |
| ... | ... | @@ -176,24 +175,15 @@ class unixScheduler extends unixService { |
| 176 | 175 | * @return array |
| 177 | 176 | */ |
| 178 | 177 | function start() { |
| 179 | - // TODO : Write sh on the fly? Not sure the reasoning here | |
| 180 | 178 | $source = $this->getSchedulerSourceLoc(); |
| 181 | -// $this->writeSchedulerTask(); | |
| 182 | 179 | $logFile = "/dev/null"; |
| 183 | -// @unlink($logFile); | |
| 184 | 180 | if($source) { // Source |
| 185 | 181 | $cmd = "nohup ".$source." > ".$logFile." 2>&1 & echo $!"; |
| 186 | 182 | } else { // Could be Stack |
| 187 | 183 | $source = SYS_BIN_DIR.$this->schedulerSource; |
| 188 | 184 | $cmd = "nohup ".$source." > ".$logFile." 2>&1 & echo $!"; |
| 189 | 185 | } |
| 190 | -// if(DEBUG) { | |
| 191 | -// echo "$cmd<br/>"; | |
| 192 | -// return ; | |
| 193 | -// } | |
| 194 | - //$response = $this->util->pexec($cmd); | |
| 195 | - | |
| 196 | -// return $response; | |
| 186 | + | |
| 197 | 187 | return false; |
| 198 | 188 | } |
| 199 | 189 | ... | ... |
setup/wizard/lib/services/windowsLucene.php
| ... | ... | @@ -172,10 +172,10 @@ class windowsLucene extends windowsService { |
| 172 | 172 | return true; |
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | - // TODO: Will not detect, but a java pre-check is done in services, before this | |
| 176 | 175 | if(file_exists($this->varDir.'outJVHome')) { |
| 177 | 176 | $this->javaBin = file_get_contents($this->varDir.'outJVHome'); |
| 178 | - if($this->javaBin != '') return true; | |
| 177 | + if($this->javaBin != '') | |
| 178 | + return true; | |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | return false; |
| ... | ... | @@ -400,8 +400,7 @@ class windowsLucene extends windowsService { |
| 400 | 400 | */ |
| 401 | 401 | public function getJavaJVM() { |
| 402 | 402 | $this->javaJVM = SYSTEM_ROOT . "java\jre\bin\client\jvm.dll"; |
| 403 | - return SYSTEM_ROOT . "java\jre\bin\client\jvm.dll"; // Hard code | |
| 404 | - //return $this->javaJVM; // TODO: PUT BACK!!! | |
| 403 | + return SYSTEM_ROOT . "java\jre\bin\client\jvm.dll"; | |
| 405 | 404 | } |
| 406 | 405 | |
| 407 | 406 | private function writeLuceneInstall($cmd) { | ... | ... |
setup/wizard/lib/validation/luceneValidation.php
| ... | ... | @@ -380,28 +380,6 @@ class luceneValidation extends serviceValidation { |
| 380 | 380 | } |
| 381 | 381 | $javaExecutable = $this->java; |
| 382 | 382 | } |
| 383 | - if(WINDOWS_OS) { | |
| 384 | - $cmd = "\"$javaExecutable\" -cp \"".SYS_DIR.";\" javaVersion \"".$this->outputDir."outJV\""." \"".$this->outputDir."outJVHome\""; | |
| 385 | - $func = OS."ReadJVFromFile"; | |
| 386 | - if($this->$func($cmd)) { | |
| 387 | - return true; | |
| 388 | - } else { | |
| 389 | - $this->java = $this->util->useZendJava(); // Java not installed | |
| 390 | - $javaExecutable = $this->java; | |
| 391 | - $cmd = "\"$javaExecutable\" -cp \"".SYS_DIR.";\" javaVersion \"".$this->outputDir."outJV\""." \"".$this->outputDir."outJVHome\""; | |
| 392 | - if($this->$func($cmd)) { | |
| 393 | - return true; | |
| 394 | - } | |
| 395 | - } | |
| 396 | - } else { | |
| 397 | - $cmd = "\"$javaExecutable\" -version > ".$this->outputDir."outJV 2>&1 echo $!"; | |
| 398 | - $func = OS."ReadJVFromFile"; | |
| 399 | - if($this->$func($cmd)) { | |
| 400 | - return true; | |
| 401 | - } else { | |
| 402 | - // TODO: Not sure | |
| 403 | - } | |
| 404 | - } | |
| 405 | 383 | |
| 406 | 384 | $this->javaVersionInCorrect(); |
| 407 | 385 | $this->javaCheck = 'cross'; | ... | ... |
setup/wizard/lib/validation/schedulerValidation.php
| ... | ... | @@ -89,7 +89,6 @@ class schedulerValidation extends serviceValidation { |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | public function binaryChecks() { |
| 92 | - // TODO: Better detection | |
| 93 | 92 | $phpDir = $this->util->useZendPhp(); |
| 94 | 93 | if(WINDOWS_OS) { |
| 95 | 94 | $phpPath = "$phpDir"."php.exe"; |
| ... | ... | @@ -101,29 +100,6 @@ class schedulerValidation extends serviceValidation { |
| 101 | 100 | } |
| 102 | 101 | } |
| 103 | 102 | |
| 104 | - function detPhpSettings() { | |
| 105 | - // TODO: Better php handling | |
| 106 | - return true; | |
| 107 | - $phpExecutable = $this->util->phpSpecified();// Retrieve java bin | |
| 108 | - $cmd = "$phpExecutable -version > ".$this->outputDir."/outPHP 2>&1 echo $!"; | |
| 109 | - $response = $this->util->pexec($cmd); | |
| 110 | - if(file_exists($this->outputDir.'outPHP')) { | |
| 111 | - $tmp = file_get_contents($this->outputDir.'outPHP'); | |
| 112 | - preg_match('/PHP/',$tmp, $matches); | |
| 113 | - if($matches) { | |
| 114 | - $this->phpCheck = 'tick'; | |
| 115 | - | |
| 116 | - return true; | |
| 117 | - } else { | |
| 118 | - $this->phpCheck = 'cross_orange'; | |
| 119 | - $this->phpExeError = "PHP : Incorrect path specified"; | |
| 120 | - $this->error[] = "PHP executable required"; | |
| 121 | - | |
| 122 | - return false; | |
| 123 | - } | |
| 124 | - } | |
| 125 | - } | |
| 126 | - | |
| 127 | 103 | /** |
| 128 | 104 | * Set template view to specify php |
| 129 | 105 | * |
| ... | ... | @@ -150,7 +126,7 @@ class schedulerValidation extends serviceValidation { |
| 150 | 126 | return $this->php; |
| 151 | 127 | } |
| 152 | 128 | |
| 153 | - public function storeSilent() { // TODO : PHP detection | |
| 129 | + public function storeSilent() { | |
| 154 | 130 | $this->temp_variables['schedulerInstalled'] = $this->installed; |
| 155 | 131 | $this->temp_variables['phpCheck'] = $this->phpCheck; |
| 156 | 132 | $this->temp_variables['phpExeError'] = $this->phpExeError; | ... | ... |