Commit 0a624d4983757dddd56e21f7d4c5d5772879e749

Authored by Jarrett Jordaan
1 parent d4bb4c1c

Story Id:1627025 Updated dmsctl.bat and updated windows services install from command line

Committed by: Jarrett Jordaan

Reviewed by: Paul Barrett
dmsctl.bat
... ... @@ -31,6 +31,7 @@ echo start - start the services
31 31 echo stop - stop the services
32 32 echo restart - restart the services
33 33 echo.
  34 +echo install - install the services
34 35 echo uninstall - uninstall the services
35 36 echo.
36 37  
... ... @@ -63,4 +64,11 @@ sc delete %SchedulerServiceName%
63 64 sc delete %OpenofficeServiceName%
64 65 goto end
65 66  
  67 +:install
  68 +echo Installing services
  69 +call "%INSTALL_PATH%\var\bin\officeinstall.bat"
  70 +call "%INSTALL_PATH%\var\bin\schedulerinstall.bat"
  71 +call "%INSTALL_PATH%\var\bin\luceneinstall.bat"
  72 +goto end
  73 +
66 74 :end
67 75 \ No newline at end of file
... ...
setup/wizard/lib/services/unixScheduler.php
... ... @@ -118,8 +118,6 @@ class unixScheduler extends unixService {
118 118 $content .= "done";
119 119 @fwrite($fp, $content);
120 120 @fclose($fp);
121   - @chmod($fLoc, '0777');
122   - $this->util->pexec("chmod 777 $fLoc");
123 121 }
124 122  
125 123 function install() {
... ...
setup/wizard/lib/services/windowsLucene.php
... ... @@ -395,6 +395,13 @@ class windowsLucene extends windowsService {
395 395 return $this->javaJVM;
396 396 }
397 397  
  398 + private function writeLuceneInstall($cmd) {
  399 + $luceneInstallFile = SYS_VAR_DIR."bin".DS."luceneinstall.bat";
  400 + $fp = fopen($luceneInstallFile, "w+");
  401 + fwrite($fp, $cmd);
  402 + fclose($fp);
  403 + }
  404 +
398 405 /**
399 406 * Install Lucene Service
400 407 *
... ... @@ -415,7 +422,8 @@ class windowsLucene extends windowsService {
415 422 echo "$cmd<br/>";
416 423 return false;
417 424 }
418   - $response = $this->util->pexec($cmd);
  425 + $this->writeLuceneInstall($cmd);
  426 + //$response = $this->util->pexec($cmd);
419 427 return $response;
420 428 }
421 429 return $state;
... ...
setup/wizard/lib/services/windowsOpenOffice.php
... ... @@ -198,6 +198,13 @@ class windowsOpenOffice extends windowsService {
198 198 return $this->options;
199 199 }
200 200  
  201 + private function writeOfficeInstall($cmd) {
  202 + $officeInstallFile = SYS_VAR_DIR."bin".DS."officeinstall.bat";
  203 + $fp = fopen($officeInstallFile, "w+");
  204 + fwrite($fp, $cmd);
  205 + fclose($fp);
  206 + }
  207 +
201 208 public function install() {
202 209 $status = $this->status();
203 210 if($status == '') {
... ... @@ -208,7 +215,8 @@ class windowsOpenOffice extends windowsService {
208 215 echo "$cmd<br/>";
209 216 return false;
210 217 }
211   - $response = $this->util->pexec($cmd);
  218 + $this->writeOfficeInstall($cmd);
  219 + //$response = $this->util->pexec($cmd);
212 220 return $response;
213 221 }
214 222 return $status;
... ...
setup/wizard/lib/services/windowsScheduler.php
... ... @@ -86,7 +86,7 @@ class windowsScheduler extends windowsService {
86 86 * @return void
87 87 */
88 88 function load() {
89   - $this->setSchedulerDIR($this->varDir."bin");
  89 + $this->setSchedulerDIR(SYS_VAR_DIR."bin");
90 90 $this->setSchedulerScriptPath("taskrunner.bat");
91 91 $this->setSchedulerSource("schedulerService.php");
92 92  
... ... @@ -102,7 +102,7 @@ class windowsScheduler extends windowsService {
102 102 */
103 103 private function setSchedulerDIR($schedulerDIR) {
104 104 if(!file_exists($schedulerDIR)) {
105   - @mkdir($schedulerDIR);
  105 + mkdir($schedulerDIR);
106 106 }
107 107 $this->schedulerDir = $schedulerDIR;
108 108 }
... ... @@ -185,15 +185,19 @@ class windowsScheduler extends windowsService {
185 185 if(DEBUG) { // Check if bin is readable and writable
186 186 echo "Attempt to Create {$this->getSchedulerDir()}\\taskrunner.bat<br>";
187 187 }
188   - if(is_readable($this->varDir."bin") && is_writable($this->varDir."bin")) {
189   - $fp = @fopen($this->getSchedulerDir().""."\\taskrunner.bat", "w+");
190   - $content = "@echo off \n";
191   - $content .= "\"".$this->util->useZendPhp()."php.exe\" "."\"{$this->getSchedulerSource()}\"";
192   - @fwrite($fp, $content);
193   - @fclose($fp);
194   - } else {
195   - echo 'Could not write task runner<br>'; // TODO: Should not reach this point
196   - }
  188 + $taskrunner = SYS_VAR_DIR."bin".DS."taskrunner.bat";
  189 + $fp = fopen($taskrunner, "w+");
  190 + $content = "@echo off \n";
  191 + $content .= "\"".$this->util->useZendPhp()."php.exe\" "."\"{$this->getSchedulerSource()}\"";
  192 + fwrite($fp, $content);
  193 + fclose($fp);
  194 + }
  195 +
  196 + private function writeSchedulerInstall($cmd) {
  197 + $schedulerInstallFile = SYS_VAR_DIR."bin".DS."schedulerinstall.bat";
  198 + $fp = fopen($schedulerInstallFile, "w+");
  199 + fwrite($fp, $cmd);
  200 + fclose($fp);
197 201 }
198 202  
199 203 /**
... ... @@ -227,7 +231,7 @@ class windowsScheduler extends windowsService {
227 231 $state = $this->status();
228 232 if($state == '') {
229 233 $this->writeTaskRunner();
230   - if (function_exists('win32_create_service')) { // TODO what if it does not exist? check how the dmsctl.bat does this
  234 + //if (function_exists('win32_create_service')) { // TODO what if it does not exist? check how the dmsctl.bat does this
231 235 if(DEBUG) {
232 236 echo '<pre>';
233 237 print_r(array('service' => $this->name, 'display' => $this->name, 'path' => $this->getSchedulerScriptPath()));
... ... @@ -237,13 +241,15 @@ class windowsScheduler extends windowsService {
237 241 echo '</pre>';
238 242 return ;
239 243 }
  244 + /*
240 245 $response = win32_create_service(array(
241 246 'service' => $this->name,
242 247 'display' => $this->name,
243 248 'path' => $this->getSchedulerScriptPath()
244 249 ));
245 250 return $response;
246   - } else { // Attempt to use the winserv
  251 + */
  252 + //} else { // Attempt to use the winserv
247 253 // TODO: Add service using winserv
248 254 $this->setWinservice();
249 255 $this->setOptions();
... ... @@ -252,9 +258,10 @@ class windowsScheduler extends windowsService {
252 258 echo "$cmd<br/>";
253 259 return false;
254 260 }
255   - $response = $this->util->pexec($cmd);
256   - return $response;
257   - }
  261 + //$response = $this->util->pexec($cmd);
  262 + //return $response;
  263 + //}
  264 + $this->writeSchedulerInstall($cmd);
258 265 }
259 266 return $state;
260 267 }
... ...
setup/wizard/steps/configuration.php
... ... @@ -378,15 +378,7 @@ class configuration extends Step
378 378 */
379 379 private function getServerInfo()
380 380 {
381   -// $iis = false;
382 381 $script = $_SERVER['SCRIPT_NAME'];
383   - /*
384   - $file_system_root = $_SERVER['DOCUMENT_ROOT'];
385   - if(preg_match('/inetpub/', $file_system_root)) {
386   - $iis = true;
387   - $file_system_root = $_SERVER['APPL_PHYSICAL_PATH'];
388   - }
389   - */
390 382 $file_system_root = realpath(SYSTEM_DIR);
391 383 $host = $_SERVER['SERVER_NAME'];
392 384 $port = $_SERVER['SERVER_PORT'];
... ... @@ -394,17 +386,10 @@ class configuration extends Step
394 386 $pos = strpos($script, '/setup/wizard/');
395 387 $root_url = substr($script, 0, $pos);
396 388 $root_url = (isset($_POST['root_url'])) ? $_POST['root_url'] : $root_url;
397   -// echo $file_system_root;
398   -// if($iis) {
399 389 $file_system_root = (isset($_POST['file_system_root'])) ? $_POST['file_system_root'] : $file_system_root;
400   -// } else {
401   -// substr($root_url, 1, strlen($root_url))
402   -// $file_system_root = (isset($_POST['file_system_root'])) ? $_POST['file_system_root'] : $file_system_root.$root_url;
403   -// }
404 390 $host = (isset($_POST['host'])) ? $_POST['host'] : $host;
405 391 $port = (isset($_POST['port'])) ? $_POST['port'] : $port;
406 392 $ssl_enabled = (isset($_POST['ssl_enabled'])) ? $_POST['ssl_enabled'] : $ssl_enabled;
407   -
408 393 $server = array();
409 394 $server['root_url'] = array('name' => 'Root Url', 'setting' => 'rootUrl', 'where' => 'db', 'value' => $root_url);
410 395 $server['file_system_root'] = array('name' => 'File System Root', 'section' => 'KnowledgeTree', 'setting' => 'fileSystemRoot', 'where' => 'file', 'value' => $file_system_root);
... ...
setup/wizard/templates/complete.tpl
... ... @@ -6,11 +6,11 @@
6 6 that things are still set up correctly.</p>
7 7  
8 8 <?php
9   - if($errors || $warnings){
  9 +// if($errors || $warnings){
10 10 echo '<div>'
11 11 . '<a href="http://wiki.knowledgetree.com/Web_Based_Installer#Post_Install" target="_blank">'
12 12 . 'Click Here for help on overcoming post install issues</a></div><br/>';
13   - }
  13 +// }
14 14 ?>
15 15 <div id="step_content_<?php echo $step_name; ?>" class="step">
16 16  
... ...