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 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 85 * Reference to installer utility object
77 86 *
78 87 * @author KnowledgeTree Team
... ... @@ -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 157 * Set util reference
136 158 *
137 159 * @author KnowledgeTree Team
... ... @@ -203,6 +225,11 @@ class InstallWizard {
203 225 if(isset($_GET['bypass'])) {
204 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 233 $this->setIUtil(new InstallUtil());
207 234 }
208 235  
... ...
setup/wizard/lib/services/unixLucene.php
... ... @@ -185,7 +185,7 @@ class unixLucene extends unixService {
185 185 $cmd = "cd ".$this->getLuceneDir()."; ";
186 186 $cmd .= "nohup java -jar ".$this->getLuceneSource()." > ".SYS_LOG_DIR."lucene.log 2>&1 & echo $!";
187 187 if(DEBUG) {
188   - echo "$cmd<br/>";
  188 + echo "Command : $cmd<br/>";
189 189 return ;
190 190 }
191 191 $response = $this->util->pexec($cmd);
... ...
setup/wizard/lib/services/unixOpenOffice.php
... ... @@ -157,7 +157,7 @@ class unixOpenOffice extends unixService {
157 157 if($state != 'STARTED') {
158 158 $cmd = "nohup {$this->getBin()} ".$this->getOption()." > ".SYS_LOG_DIR."{$this->getLog()} 2>&1 & echo $!";
159 159 if(DEBUG) {
160   - echo "$cmd<br/>";
  160 + echo "Command : $cmd<br/>";
161 161 return ;
162 162 }
163 163 $response = $this->util->pexec($cmd);
... ...
setup/wizard/lib/services/unixScheduler.php
... ... @@ -161,7 +161,7 @@ class unixScheduler extends unixService {
161 161 $cmd = "nohup ".$source." > ".SYS_LOG_DIR."scheduler.log 2>&1 & echo $!";
162 162 }
163 163 if(DEBUG) {
164   - echo "$cmd<br/>";
  164 + echo "Command : $cmd<br/>";
165 165 return ;
166 166 }
167 167 $response = $this->util->pexec($cmd);
... ...
setup/wizard/lib/services/windowsLucene.php
... ... @@ -410,7 +410,7 @@ class windowsLucene extends windowsService {
410 410 if($luceneExe && $luceneSource && $luceneDir) {
411 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 412 if(DEBUG) {
413   - echo "$cmd<br/>";
  413 + echo "Command : $cmd<br/>";
414 414 return ;
415 415 }
416 416 $response = $this->util->pexec($cmd);
... ...
setup/wizard/lib/services/windowsOpenOffice.php
... ... @@ -211,7 +211,7 @@ class windowsOpenOffice extends windowsService {
211 211 $this->setOption();
212 212 $cmd = "\"{$this->winservice}\" install $this->name {$this->getOption()}";
213 213 if(DEBUG) {
214   - echo "$cmd<br/>";
  214 + echo "Command : $cmd<br/>";
215 215 return ;
216 216 }
217 217 $response = $this->util->pexec($cmd);
... ...
setup/wizard/lib/services/windowsScheduler.php
... ... @@ -222,7 +222,7 @@ class windowsScheduler extends windowsService {
222 222 $this->setOptions();
223 223 $cmd = "\"{$this->winservice}\" install $this->name $this->options";
224 224 if(DEBUG) {
225   - echo "$cmd<br/>";
  225 + echo "Command : $cmd<br/>";
226 226 return ;
227 227 }
228 228 $response = $this->util->pexec($cmd);
... ... @@ -257,26 +257,5 @@ class windowsScheduler extends windowsService {
257 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 262 \ No newline at end of file
... ...
setup/wizard/path.php
... ... @@ -40,7 +40,6 @@
40 40 * @version Version 0.1
41 41 */
42 42 // Define installer environment
43   - define('DEBUG', 0);
44 43 define('AJAX', 0);
45 44 if (substr(php_uname(), 0, 7) == "Windows"){
46 45 define('WINDOWS_OS', true);
... ...
setup/wizard/steps/services.php
... ... @@ -1222,6 +1222,9 @@ class services extends Step
1222 1222  
1223 1223 if(isset($_GET['action'])) {
1224 1224 $func = $_GET['action'];
  1225 + if(isset($_GET['debug'])) {
  1226 + define('DEBUG', $_GET['debug']);
  1227 + }
1225 1228 if($func != '') {
1226 1229 $serv = new services();
1227 1230 $func_call = strtoupper(substr($func,0,1)).substr($func,1);
... ...