Commit 7e18bc6438974ada61fc17e84d1af683b388dc21

Authored by Jarrett Jordaan
1 parent 5dacad84

Story ID: 778902 Services Updated

Committed by: Jarrett Jordaan

Reviewed by: Megan Watson
setup/wizard/lib/services/unixScheduler.php
... ... @@ -108,19 +108,19 @@ class unixScheduler extends Service {
108 108 }
109 109  
110 110 function install() {
111   -// $source = $this->getSchedulerSourceLoc();
112   -// if($source) {
113   -// $cmd = "nohup ".$source." &> ".SYS_LOG_DIR."dmsctl.log";
114   -// $response = $this->util->pexec($cmd);
115   -// return $response;
116   -// } else {
117   -// $source = $this->getSystemDir().$this->schedulerSource;
118   -// if(file_exists($source)) {
119   -// $cmd = "nohup ".$source." &> ".SYS_LOG_DIR."dmsctl.log";
120   -// $response = $this->util->pexec($cmd);
121   -// return $response;
122   -// }
123   -// }
  111 + $source = $this->getSchedulerSourceLoc();
  112 + if($source) {
  113 + $cmd = "nohup ".$source." &> ".SYS_LOG_DIR."dmsctl.log";
  114 + $response = $this->util->pexec($cmd);
  115 + return $response;
  116 + } else { // Could be Stack
  117 + $source = $this->getSystemDir().$this->schedulerSource;
  118 + if(file_exists($source)) {
  119 + $cmd = "nohup ".$source." &> ".SYS_LOG_DIR."dmsctl.log";
  120 + $response = $this->util->pexec($cmd);
  121 + return $response;
  122 + }
  123 + }
124 124 return false;
125 125 }
126 126  
... ...
setup/wizard/lib/services/windowsLucene.php
... ... @@ -364,10 +364,15 @@ class windowsLucene extends windowsService {
364 364 * @return array
365 365 */
366 366 function install() {
367   - $cmd = "\"{$this->getLuceneExe()}\""." -install \"".$this->getName()."\" \"".$this->getJavaJVM(). "\" -Djava.class.path=\"". $this->getLuceneSource()."\"". " -start ".$this->getLuceneServer(). " -out \"".$this->getLuceneOut()."\" -err \"".$this->getLuceneError()."\" -current \"".$this->getluceneDir()."\" -auto";
368   - $response = $this->util->pexec($cmd);
  367 + $state = $this->status();
  368 + if($state == '') {
  369 + $cmd = "\"{$this->getLuceneExe()}\""." -install \"".$this->getName()."\" \"".$this->getJavaJVM(). "\" -Djava.class.path=\"". $this->getLuceneSource()."\"". " -start ".$this->getLuceneServer(). " -out \"".$this->getLuceneOut()."\" -err \"".$this->getLuceneError()."\" -current \"".$this->getluceneDir()."\" -auto";
  370 + $response = $this->util->pexec($cmd);
369 371  
370   - return $response;
  372 + return $response;
  373 + }
  374 +
  375 + return $state;
371 376 }
372 377  
373 378 }
... ...
setup/wizard/lib/services/windowsScheduler.php
... ... @@ -179,17 +179,21 @@ class windowsScheduler extends windowsService {
179 179 * @return array
180 180 */
181 181 public function install() {
182   - $fp = fopen($this->getSchedulerScriptPath(), "w+");
183   - $content = "@echo off\n";
184   - $content .= "\"".PHP_DIR."php.exe\" "."\"{$this->getSchedulerSource()}\"";
185   - fwrite($fp, $content);
186   - fclose($fp);
187   - $response = win32_create_service(array(
188   - 'service' => $this->name,
189   - 'display' => $this->name,
190   - 'path' => $this->getSchedulerSource()
191   - ));
192   - return $response;
  182 + $state = $this->status();
  183 + if($state == '') {
  184 + $fp = fopen($this->getSchedulerScriptPath(), "w+");
  185 + $content = "@echo off\n";
  186 + $content .= "\"".PHP_DIR."php.exe\" "."\"{$this->getSchedulerSource()}\"";
  187 + fwrite($fp, $content);
  188 + fclose($fp);
  189 + $response = win32_create_service(array(
  190 + 'service' => $this->name,
  191 + 'display' => $this->name,
  192 + 'path' => $this->getSchedulerScriptPath()
  193 + ));
  194 + return $response;
  195 + }
  196 + return $state;
193 197 }
194 198 }
195 199 ?>
196 200 \ No newline at end of file
... ...
setup/wizard/lib/services/windowsService.php
... ... @@ -125,7 +125,7 @@ class windowsService extends Service {
125 125 * @author KnowledgeTree Team
126 126 * @access public
127 127 * @param none
128   - * @return array
  128 + * @return string
129 129 */
130 130 public function status() {
131 131 $cmd = "sc query {$this->name}";
... ... @@ -134,6 +134,8 @@ class windowsService extends Service {
134 134 $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key
135 135 return $state;
136 136 }
  137 +
  138 + return '';
137 139 }
138 140  
139 141 /**
... ...
setup/wizard/steps/services.php
... ... @@ -66,6 +66,15 @@ class services extends Step
66 66  
67 67 protected $util;
68 68  
  69 + /**
  70 + * Flag to store class information in session
  71 + *
  72 + * @author KnowledgeTree Team
  73 + * @access public
  74 + * @var boolean
  75 + */
  76 + protected $storeInSession = false;
  77 +
69 78 public $temp_variables;
70 79  
71 80 /**
... ...