From d5a58f5d2567e0444ef15dfccceb2f2bc886d40d Mon Sep 17 00:00:00 2001 From: Jarrett Jordaan Date: Wed, 30 Sep 2009 13:29:36 +0200 Subject: [PATCH] Story Id:1166880 Services Debug Updated --- setup/wizard/installWizard.php | 27 +++++++++++++++++++++++++++ setup/wizard/lib/services/unixLucene.php | 2 +- setup/wizard/lib/services/unixOpenOffice.php | 2 +- setup/wizard/lib/services/unixScheduler.php | 2 +- setup/wizard/lib/services/windowsLucene.php | 2 +- setup/wizard/lib/services/windowsOpenOffice.php | 2 +- setup/wizard/lib/services/windowsScheduler.php | 23 +---------------------- setup/wizard/path.php | 1 - setup/wizard/steps/services.php | 3 +++ 9 files changed, 36 insertions(+), 28 deletions(-) diff --git a/setup/wizard/installWizard.php b/setup/wizard/installWizard.php index 0886071..2c6b928 100644 --- a/setup/wizard/installWizard.php +++ b/setup/wizard/installWizard.php @@ -73,6 +73,15 @@ class InstallWizard { protected $bypass = null; /** + * Install bypass flag + * + * @author KnowledgeTree Team + * @access protected + * @var mixed + */ + protected $debugLevel = 0; + + /** * Reference to installer utility object * * @author KnowledgeTree Team @@ -132,6 +141,19 @@ class InstallWizard { } /** + * Set debug level + * + * @author KnowledgeTree Team + * @access private + * @param boolean + * @return void + */ + private function setDebugLevel($debug) { + define('DEBUG', $debug); + $this->debugLevel = $debug; + } + + /** * Set util reference * * @author KnowledgeTree Team @@ -203,6 +225,11 @@ class InstallWizard { if(isset($_GET['bypass'])) { $this->setBypass($_GET['bypass']); } + if(isset($_GET['debug'])) { + $this->setDebugLevel($_GET['debug']); + } else { + $this->setDebugLevel(0); + } $this->setIUtil(new InstallUtil()); } diff --git a/setup/wizard/lib/services/unixLucene.php b/setup/wizard/lib/services/unixLucene.php index 5e6c51c..da04bd3 100644 --- a/setup/wizard/lib/services/unixLucene.php +++ b/setup/wizard/lib/services/unixLucene.php @@ -185,7 +185,7 @@ class unixLucene extends unixService { $cmd = "cd ".$this->getLuceneDir()."; "; $cmd .= "nohup java -jar ".$this->getLuceneSource()." > ".SYS_LOG_DIR."lucene.log 2>&1 & echo $!"; if(DEBUG) { - echo "$cmd
"; + echo "Command : $cmd
"; return ; } $response = $this->util->pexec($cmd); diff --git a/setup/wizard/lib/services/unixOpenOffice.php b/setup/wizard/lib/services/unixOpenOffice.php index 79aaa50..74c098d 100644 --- a/setup/wizard/lib/services/unixOpenOffice.php +++ b/setup/wizard/lib/services/unixOpenOffice.php @@ -157,7 +157,7 @@ class unixOpenOffice extends unixService { if($state != 'STARTED') { $cmd = "nohup {$this->getBin()} ".$this->getOption()." > ".SYS_LOG_DIR."{$this->getLog()} 2>&1 & echo $!"; if(DEBUG) { - echo "$cmd
"; + echo "Command : $cmd
"; return ; } $response = $this->util->pexec($cmd); diff --git a/setup/wizard/lib/services/unixScheduler.php b/setup/wizard/lib/services/unixScheduler.php index 8042aed..2ea1a04 100644 --- a/setup/wizard/lib/services/unixScheduler.php +++ b/setup/wizard/lib/services/unixScheduler.php @@ -161,7 +161,7 @@ class unixScheduler extends unixService { $cmd = "nohup ".$source." > ".SYS_LOG_DIR."scheduler.log 2>&1 & echo $!"; } if(DEBUG) { - echo "$cmd
"; + echo "Command : $cmd
"; return ; } $response = $this->util->pexec($cmd); diff --git a/setup/wizard/lib/services/windowsLucene.php b/setup/wizard/lib/services/windowsLucene.php index f146cd9..be2c4b9 100644 --- a/setup/wizard/lib/services/windowsLucene.php +++ b/setup/wizard/lib/services/windowsLucene.php @@ -410,7 +410,7 @@ class windowsLucene extends windowsService { if($luceneExe && $luceneSource && $luceneDir) { $cmd = "\"{$luceneExe}\""." -install \"".$this->getName()."\" \"".$this->getJavaJVM(). "\" -Djava.class.path=\"".$luceneSource."\"". " -start ".$this->getLuceneServer(). " -out \"".$this->getLuceneOut()."\" -err \"".$this->getLuceneError()."\" -current \"".$luceneDir."\" -auto"; if(DEBUG) { - echo "$cmd
"; + echo "Command : $cmd
"; return ; } $response = $this->util->pexec($cmd); diff --git a/setup/wizard/lib/services/windowsOpenOffice.php b/setup/wizard/lib/services/windowsOpenOffice.php index 7501714..460a5e9 100644 --- a/setup/wizard/lib/services/windowsOpenOffice.php +++ b/setup/wizard/lib/services/windowsOpenOffice.php @@ -211,7 +211,7 @@ class windowsOpenOffice extends windowsService { $this->setOption(); $cmd = "\"{$this->winservice}\" install $this->name {$this->getOption()}"; if(DEBUG) { - echo "$cmd
"; + echo "Command : $cmd
"; return ; } $response = $this->util->pexec($cmd); diff --git a/setup/wizard/lib/services/windowsScheduler.php b/setup/wizard/lib/services/windowsScheduler.php index a774d4c..897c612 100644 --- a/setup/wizard/lib/services/windowsScheduler.php +++ b/setup/wizard/lib/services/windowsScheduler.php @@ -222,7 +222,7 @@ class windowsScheduler extends windowsService { $this->setOptions(); $cmd = "\"{$this->winservice}\" install $this->name $this->options"; if(DEBUG) { - echo "$cmd
"; + echo "Command : $cmd
"; return ; } $response = $this->util->pexec($cmd); @@ -257,26 +257,5 @@ class windowsScheduler extends windowsService { echo 'Could not write task runner
'; } } - - /* - private function writeSchedulerTask() { - // Check if bin is readable and writable - if(is_readable(SYS_OUT_DIR."bin") && is_writable(SYS_OUT_DIR."bin")) { - if(!$this->getSchedulerScriptPath()) { - if(DEBUG) { - echo "Create {$this->getSchedulerScriptPath()}
"; - } - $fp = fopen($this->getSchedulerScriptPath(), "w+"); - $content = "@echo off\n"; - $content .= "\"".PHP_DIR."php.exe\" "."\"{$this->getSchedulerSource()}\""; - fwrite($fp, $content); - fclose($fp); - } - } else { - // TODO: Should not reach this point - echo 'Could not write scheduler task
'; - } - } - */ } ?> \ No newline at end of file diff --git a/setup/wizard/path.php b/setup/wizard/path.php index 1044875..3a13595 100644 --- a/setup/wizard/path.php +++ b/setup/wizard/path.php @@ -40,7 +40,6 @@ * @version Version 0.1 */ // Define installer environment - define('DEBUG', 0); define('AJAX', 0); if (substr(php_uname(), 0, 7) == "Windows"){ define('WINDOWS_OS', true); diff --git a/setup/wizard/steps/services.php b/setup/wizard/steps/services.php index 54e2076..72f2b10 100644 --- a/setup/wizard/steps/services.php +++ b/setup/wizard/steps/services.php @@ -1222,6 +1222,9 @@ class services extends Step if(isset($_GET['action'])) { $func = $_GET['action']; + if(isset($_GET['debug'])) { + define('DEBUG', $_GET['debug']); + } if($func != '') { $serv = new services(); $func_call = strtoupper(substr($func,0,1)).substr($func,1); -- libgit2 0.21.4