Commit f7a540c1eafb27c4c119b03e9a6b17957ca9c0f5

Authored by Jarrett Jordaan
1 parent 2313e9b9

Updated utilites.

Committed by: Jarrett Jordaan

Reviewed by: Megan Watson
setup/upgrade/upgradeUtil.php
@@ -161,8 +161,7 @@ class UpgradeUtil extends InstallUtil { @@ -161,8 +161,7 @@ class UpgradeUtil extends InstallUtil {
161 $mechanism = "--port=\"$dbPort\""; 161 $mechanism = "--port=\"$dbPort\"";
162 } 162 }
163 163
164 -// $tmpdir = $this->resolveTempDir();  
165 - $this->resolveTempDir(); 164 + $this->util->resolveTempDir();
166 165
167 $stmt = $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism drop \"$dbName\"<br/>"; 166 $stmt = $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism drop \"$dbName\"<br/>";
168 $stmt .= $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism create \"$dbName\"<br/>"; 167 $stmt .= $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism create \"$dbName\"<br/>";
@@ -214,24 +213,7 @@ class UpgradeUtil extends InstallUtil { @@ -214,24 +213,7 @@ class UpgradeUtil extends InstallUtil {
214 return ''; 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 \ No newline at end of file 220 \ No newline at end of file
setup/wizard/installUtil.php
@@ -1071,11 +1071,11 @@ class InstallUtil { @@ -1071,11 +1071,11 @@ class InstallUtil {
1071 } 1071 }
1072 } 1072 }
1073 if (substr($sDst, 0, strlen($sSrc)) === $sSrc) { 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 $hSrc = @opendir($sSrc); 1076 $hSrc = @opendir($sSrc);
1077 if ($hSrc === false) { 1077 if ($hSrc === false) {
1078 - return false; //PEAR::raiseError(sprintf(_kt("Could not open source directory: %s"), $sSrc)); 1078 + return false;
1079 } 1079 }
1080 @mkdir($sDst, 0777); 1080 @mkdir($sDst, 0777);
1081 while (($sFilename = readdir($hSrc)) !== false) { 1081 while (($sFilename = readdir($hSrc)) !== false) {
@@ -1112,34 +1112,47 @@ class InstallUtil { @@ -1112,34 +1112,47 @@ class InstallUtil {
1112 } 1112 }
1113 $aSrcStat = stat($sSrc); 1113 $aSrcStat = stat($sSrc);
1114 if ($aSrcStat === false) { 1114 if ($aSrcStat === false) {
1115 - return false; //PEAR::raiseError(sprintf(_kt("Couldn't stat source file: %s"), $sSrc)); 1115 + return false;
1116 } 1116 }
1117 $aDstStat = stat(dirname($sDst)); 1117 $aDstStat = stat(dirname($sDst));
1118 if ($aDstStat === false) { 1118 if ($aDstStat === false) {
1119 - return false; //PEAR::raiseError(sprintf(_kt("Couldn't stat destination location: %s"), $sDst)); 1119 + return false;
1120 } 1120 }
1121 if ($aSrcStat["dev"] === $aDstStat["dev"]) { 1121 if ($aSrcStat["dev"] === $aDstStat["dev"]) {
1122 $res = @rename($sSrc, $sDst); 1122 $res = @rename($sSrc, $sDst);
1123 if ($res === false) { 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 return; 1126 return;
1127 } 1127 }
1128 $res = @copy($sSrc, $sDst); 1128 $res = @copy($sSrc, $sDst);
1129 if ($res === false) { 1129 if ($res === false) {
1130 - return false; //PEAR::raiseError(sprintf(_kt("Could not copy to destination: %s"), $sDst)); 1130 + return false;
1131 } 1131 }
1132 $res = @unlink($sSrc); 1132 $res = @unlink($sSrc);
1133 if ($res === false) { 1133 if ($res === false) {
1134 - return false; //PEAR::raiseError(sprintf(_kt("Could not remove source: %s"), $sSrc)); 1134 + return false;
1135 } 1135 }
1136 } else { 1136 } else {
1137 $res = @rename($sSrc, $sDst); 1137 $res = @rename($sSrc, $sDst);
1138 if ($res === false) { 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,7 +112,6 @@ class unixScheduler extends unixService {
112 $content = "#!/bin/sh\n"; 112 $content = "#!/bin/sh\n";
113 $content .= "cd ".SYS_BIN_DIR."\n"; 113 $content .= "cd ".SYS_BIN_DIR."\n";
114 $content .= "while true; do\n"; 114 $content .= "while true; do\n";
115 - // TODO : This will not work without CLI  
116 $content .= "{$this->phpCli} -Cq scheduler.php\n"; 115 $content .= "{$this->phpCli} -Cq scheduler.php\n";
117 $content .= "sleep 30\n"; 116 $content .= "sleep 30\n";
118 $content .= "done"; 117 $content .= "done";
@@ -176,24 +175,15 @@ class unixScheduler extends unixService { @@ -176,24 +175,15 @@ class unixScheduler extends unixService {
176 * @return array 175 * @return array
177 */ 176 */
178 function start() { 177 function start() {
179 - // TODO : Write sh on the fly? Not sure the reasoning here  
180 $source = $this->getSchedulerSourceLoc(); 178 $source = $this->getSchedulerSourceLoc();
181 -// $this->writeSchedulerTask();  
182 $logFile = "/dev/null"; 179 $logFile = "/dev/null";
183 -// @unlink($logFile);  
184 if($source) { // Source 180 if($source) { // Source
185 $cmd = "nohup ".$source." > ".$logFile." 2>&1 & echo $!"; 181 $cmd = "nohup ".$source." > ".$logFile." 2>&1 & echo $!";
186 } else { // Could be Stack 182 } else { // Could be Stack
187 $source = SYS_BIN_DIR.$this->schedulerSource; 183 $source = SYS_BIN_DIR.$this->schedulerSource;
188 $cmd = "nohup ".$source." > ".$logFile." 2>&1 & echo $!"; 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 return false; 187 return false;
198 } 188 }
199 189
setup/wizard/lib/services/windowsLucene.php
@@ -172,10 +172,10 @@ class windowsLucene extends windowsService { @@ -172,10 +172,10 @@ class windowsLucene extends windowsService {
172 return true; 172 return true;
173 } 173 }
174 } 174 }
175 - // TODO: Will not detect, but a java pre-check is done in services, before this  
176 if(file_exists($this->varDir.'outJVHome')) { 175 if(file_exists($this->varDir.'outJVHome')) {
177 $this->javaBin = file_get_contents($this->varDir.'outJVHome'); 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 return false; 181 return false;
@@ -400,8 +400,7 @@ class windowsLucene extends windowsService { @@ -400,8 +400,7 @@ class windowsLucene extends windowsService {
400 */ 400 */
401 public function getJavaJVM() { 401 public function getJavaJVM() {
402 $this->javaJVM = SYSTEM_ROOT . "java\jre\bin\client\jvm.dll"; 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 private function writeLuceneInstall($cmd) { 406 private function writeLuceneInstall($cmd) {
setup/wizard/lib/validation/luceneValidation.php
@@ -380,28 +380,6 @@ class luceneValidation extends serviceValidation { @@ -380,28 +380,6 @@ class luceneValidation extends serviceValidation {
380 } 380 }
381 $javaExecutable = $this->java; 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 $this->javaVersionInCorrect(); 384 $this->javaVersionInCorrect();
407 $this->javaCheck = 'cross'; 385 $this->javaCheck = 'cross';
setup/wizard/lib/validation/schedulerValidation.php
@@ -89,7 +89,6 @@ class schedulerValidation extends serviceValidation { @@ -89,7 +89,6 @@ class schedulerValidation extends serviceValidation {
89 } 89 }
90 90
91 public function binaryChecks() { 91 public function binaryChecks() {
92 - // TODO: Better detection  
93 $phpDir = $this->util->useZendPhp(); 92 $phpDir = $this->util->useZendPhp();
94 if(WINDOWS_OS) { 93 if(WINDOWS_OS) {
95 $phpPath = "$phpDir"."php.exe"; 94 $phpPath = "$phpDir"."php.exe";
@@ -101,29 +100,6 @@ class schedulerValidation extends serviceValidation { @@ -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 * Set template view to specify php 104 * Set template view to specify php
129 * 105 *
@@ -150,7 +126,7 @@ class schedulerValidation extends serviceValidation { @@ -150,7 +126,7 @@ class schedulerValidation extends serviceValidation {
150 return $this->php; 126 return $this->php;
151 } 127 }
152 128
153 - public function storeSilent() { // TODO : PHP detection 129 + public function storeSilent() {
154 $this->temp_variables['schedulerInstalled'] = $this->installed; 130 $this->temp_variables['schedulerInstalled'] = $this->installed;
155 $this->temp_variables['phpCheck'] = $this->phpCheck; 131 $this->temp_variables['phpCheck'] = $this->phpCheck;
156 $this->temp_variables['phpExeError'] = $this->phpExeError; 132 $this->temp_variables['phpExeError'] = $this->phpExeError;