Commit d5a58f5d2567e0444ef15dfccceb2f2bc886d40d

Authored by Jarrett Jordaan
1 parent 329b7c94

Story Id:1166880 Services Debug Updated

Committed by: Jarrett Jordaan

Reviewed by: Megan Watson
setup/wizard/installWizard.php
@@ -73,6 +73,15 @@ class InstallWizard { @@ -73,6 +73,15 @@ class InstallWizard {
73 protected $bypass = null; 73 protected $bypass = null;
74 74
75 /** 75 /**
  76 + * Install bypass flag
  77 + *
  78 + * @author KnowledgeTree Team
  79 + * @access protected
  80 + * @var mixed
  81 + */
  82 + protected $debugLevel = 0;
  83 +
  84 + /**
76 * Reference to installer utility object 85 * Reference to installer utility object
77 * 86 *
78 * @author KnowledgeTree Team 87 * @author KnowledgeTree Team
@@ -132,6 +141,19 @@ class InstallWizard { @@ -132,6 +141,19 @@ class InstallWizard {
132 } 141 }
133 142
134 /** 143 /**
  144 + * Set debug level
  145 + *
  146 + * @author KnowledgeTree Team
  147 + * @access private
  148 + * @param boolean
  149 + * @return void
  150 + */
  151 + private function setDebugLevel($debug) {
  152 + define('DEBUG', $debug);
  153 + $this->debugLevel = $debug;
  154 + }
  155 +
  156 + /**
135 * Set util reference 157 * Set util reference
136 * 158 *
137 * @author KnowledgeTree Team 159 * @author KnowledgeTree Team
@@ -203,6 +225,11 @@ class InstallWizard { @@ -203,6 +225,11 @@ class InstallWizard {
203 if(isset($_GET['bypass'])) { 225 if(isset($_GET['bypass'])) {
204 $this->setBypass($_GET['bypass']); 226 $this->setBypass($_GET['bypass']);
205 } 227 }
  228 + if(isset($_GET['debug'])) {
  229 + $this->setDebugLevel($_GET['debug']);
  230 + } else {
  231 + $this->setDebugLevel(0);
  232 + }
206 $this->setIUtil(new InstallUtil()); 233 $this->setIUtil(new InstallUtil());
207 } 234 }
208 235
setup/wizard/lib/services/unixLucene.php
@@ -185,7 +185,7 @@ class unixLucene extends unixService { @@ -185,7 +185,7 @@ class unixLucene extends unixService {
185 $cmd = "cd ".$this->getLuceneDir()."; "; 185 $cmd = "cd ".$this->getLuceneDir()."; ";
186 $cmd .= "nohup java -jar ".$this->getLuceneSource()." > ".SYS_LOG_DIR."lucene.log 2>&1 & echo $!"; 186 $cmd .= "nohup java -jar ".$this->getLuceneSource()." > ".SYS_LOG_DIR."lucene.log 2>&1 & echo $!";
187 if(DEBUG) { 187 if(DEBUG) {
188 - echo "$cmd<br/>"; 188 + echo "Command : $cmd<br/>";
189 return ; 189 return ;
190 } 190 }
191 $response = $this->util->pexec($cmd); 191 $response = $this->util->pexec($cmd);
setup/wizard/lib/services/unixOpenOffice.php
@@ -157,7 +157,7 @@ class unixOpenOffice extends unixService { @@ -157,7 +157,7 @@ class unixOpenOffice extends unixService {
157 if($state != 'STARTED') { 157 if($state != 'STARTED') {
158 $cmd = "nohup {$this->getBin()} ".$this->getOption()." > ".SYS_LOG_DIR."{$this->getLog()} 2>&1 & echo $!"; 158 $cmd = "nohup {$this->getBin()} ".$this->getOption()." > ".SYS_LOG_DIR."{$this->getLog()} 2>&1 & echo $!";
159 if(DEBUG) { 159 if(DEBUG) {
160 - echo "$cmd<br/>"; 160 + echo "Command : $cmd<br/>";
161 return ; 161 return ;
162 } 162 }
163 $response = $this->util->pexec($cmd); 163 $response = $this->util->pexec($cmd);
setup/wizard/lib/services/unixScheduler.php
@@ -161,7 +161,7 @@ class unixScheduler extends unixService { @@ -161,7 +161,7 @@ class unixScheduler extends unixService {
161 $cmd = "nohup ".$source." > ".SYS_LOG_DIR."scheduler.log 2>&1 & echo $!"; 161 $cmd = "nohup ".$source." > ".SYS_LOG_DIR."scheduler.log 2>&1 & echo $!";
162 } 162 }
163 if(DEBUG) { 163 if(DEBUG) {
164 - echo "$cmd<br/>"; 164 + echo "Command : $cmd<br/>";
165 return ; 165 return ;
166 } 166 }
167 $response = $this->util->pexec($cmd); 167 $response = $this->util->pexec($cmd);
setup/wizard/lib/services/windowsLucene.php
@@ -410,7 +410,7 @@ class windowsLucene extends windowsService { @@ -410,7 +410,7 @@ class windowsLucene extends windowsService {
410 if($luceneExe && $luceneSource && $luceneDir) { 410 if($luceneExe && $luceneSource && $luceneDir) {
411 $cmd = "\"{$luceneExe}\""." -install \"".$this->getName()."\" \"".$this->getJavaJVM(). "\" -Djava.class.path=\"".$luceneSource."\"". " -start ".$this->getLuceneServer(). " -out \"".$this->getLuceneOut()."\" -err \"".$this->getLuceneError()."\" -current \"".$luceneDir."\" -auto"; 411 $cmd = "\"{$luceneExe}\""." -install \"".$this->getName()."\" \"".$this->getJavaJVM(). "\" -Djava.class.path=\"".$luceneSource."\"". " -start ".$this->getLuceneServer(). " -out \"".$this->getLuceneOut()."\" -err \"".$this->getLuceneError()."\" -current \"".$luceneDir."\" -auto";
412 if(DEBUG) { 412 if(DEBUG) {
413 - echo "$cmd<br/>"; 413 + echo "Command : $cmd<br/>";
414 return ; 414 return ;
415 } 415 }
416 $response = $this->util->pexec($cmd); 416 $response = $this->util->pexec($cmd);
setup/wizard/lib/services/windowsOpenOffice.php
@@ -211,7 +211,7 @@ class windowsOpenOffice extends windowsService { @@ -211,7 +211,7 @@ class windowsOpenOffice extends windowsService {
211 $this->setOption(); 211 $this->setOption();
212 $cmd = "\"{$this->winservice}\" install $this->name {$this->getOption()}"; 212 $cmd = "\"{$this->winservice}\" install $this->name {$this->getOption()}";
213 if(DEBUG) { 213 if(DEBUG) {
214 - echo "$cmd<br/>"; 214 + echo "Command : $cmd<br/>";
215 return ; 215 return ;
216 } 216 }
217 $response = $this->util->pexec($cmd); 217 $response = $this->util->pexec($cmd);
setup/wizard/lib/services/windowsScheduler.php
@@ -222,7 +222,7 @@ class windowsScheduler extends windowsService { @@ -222,7 +222,7 @@ class windowsScheduler extends windowsService {
222 $this->setOptions(); 222 $this->setOptions();
223 $cmd = "\"{$this->winservice}\" install $this->name $this->options"; 223 $cmd = "\"{$this->winservice}\" install $this->name $this->options";
224 if(DEBUG) { 224 if(DEBUG) {
225 - echo "$cmd<br/>"; 225 + echo "Command : $cmd<br/>";
226 return ; 226 return ;
227 } 227 }
228 $response = $this->util->pexec($cmd); 228 $response = $this->util->pexec($cmd);
@@ -257,26 +257,5 @@ class windowsScheduler extends windowsService { @@ -257,26 +257,5 @@ class windowsScheduler extends windowsService {
257 echo 'Could not write task runner<br>'; 257 echo 'Could not write task runner<br>';
258 } 258 }
259 } 259 }
260 -  
261 - /*  
262 - private function writeSchedulerTask() {  
263 - // Check if bin is readable and writable  
264 - if(is_readable(SYS_OUT_DIR."bin") && is_writable(SYS_OUT_DIR."bin")) {  
265 - if(!$this->getSchedulerScriptPath()) {  
266 - if(DEBUG) {  
267 - echo "Create {$this->getSchedulerScriptPath()} <br/>";  
268 - }  
269 - $fp = fopen($this->getSchedulerScriptPath(), "w+");  
270 - $content = "@echo off\n";  
271 - $content .= "\"".PHP_DIR."php.exe\" "."\"{$this->getSchedulerSource()}\"";  
272 - fwrite($fp, $content);  
273 - fclose($fp);  
274 - }  
275 - } else {  
276 - // TODO: Should not reach this point  
277 - echo 'Could not write scheduler task<br>';  
278 - }  
279 - }  
280 - */  
281 } 260 }
282 ?> 261 ?>
283 \ No newline at end of file 262 \ No newline at end of file
setup/wizard/path.php
@@ -40,7 +40,6 @@ @@ -40,7 +40,6 @@
40 * @version Version 0.1 40 * @version Version 0.1
41 */ 41 */
42 // Define installer environment 42 // Define installer environment
43 - define('DEBUG', 0);  
44 define('AJAX', 0); 43 define('AJAX', 0);
45 if (substr(php_uname(), 0, 7) == "Windows"){ 44 if (substr(php_uname(), 0, 7) == "Windows"){
46 define('WINDOWS_OS', true); 45 define('WINDOWS_OS', true);
setup/wizard/steps/services.php
@@ -1222,6 +1222,9 @@ class services extends Step @@ -1222,6 +1222,9 @@ class services extends Step
1222 1222
1223 if(isset($_GET['action'])) { 1223 if(isset($_GET['action'])) {
1224 $func = $_GET['action']; 1224 $func = $_GET['action'];
  1225 + if(isset($_GET['debug'])) {
  1226 + define('DEBUG', $_GET['debug']);
  1227 + }
1225 if($func != '') { 1228 if($func != '') {
1226 $serv = new services(); 1229 $serv = new services();
1227 $func_call = strtoupper(substr($func,0,1)).substr($func,1); 1230 $func_call = strtoupper(substr($func,0,1)).substr($func,1);