Commit 0a624d4983757dddd56e21f7d4c5d5772879e749
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
Showing
7 changed files
with
51 additions
and
37 deletions
dmsctl.bat
| @@ -31,6 +31,7 @@ echo start - start the services | @@ -31,6 +31,7 @@ echo start - start the services | ||
| 31 | echo stop - stop the services | 31 | echo stop - stop the services |
| 32 | echo restart - restart the services | 32 | echo restart - restart the services |
| 33 | echo. | 33 | echo. |
| 34 | +echo install - install the services | ||
| 34 | echo uninstall - uninstall the services | 35 | echo uninstall - uninstall the services |
| 35 | echo. | 36 | echo. |
| 36 | 37 | ||
| @@ -63,4 +64,11 @@ sc delete %SchedulerServiceName% | @@ -63,4 +64,11 @@ sc delete %SchedulerServiceName% | ||
| 63 | sc delete %OpenofficeServiceName% | 64 | sc delete %OpenofficeServiceName% |
| 64 | goto end | 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 | :end | 74 | :end |
| 67 | \ No newline at end of file | 75 | \ No newline at end of file |
setup/wizard/lib/services/unixScheduler.php
| @@ -118,8 +118,6 @@ class unixScheduler extends unixService { | @@ -118,8 +118,6 @@ class unixScheduler extends unixService { | ||
| 118 | $content .= "done"; | 118 | $content .= "done"; |
| 119 | @fwrite($fp, $content); | 119 | @fwrite($fp, $content); |
| 120 | @fclose($fp); | 120 | @fclose($fp); |
| 121 | - @chmod($fLoc, '0777'); | ||
| 122 | - $this->util->pexec("chmod 777 $fLoc"); | ||
| 123 | } | 121 | } |
| 124 | 122 | ||
| 125 | function install() { | 123 | function install() { |
setup/wizard/lib/services/windowsLucene.php
| @@ -395,6 +395,13 @@ class windowsLucene extends windowsService { | @@ -395,6 +395,13 @@ class windowsLucene extends windowsService { | ||
| 395 | return $this->javaJVM; | 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 | * Install Lucene Service | 406 | * Install Lucene Service |
| 400 | * | 407 | * |
| @@ -415,7 +422,8 @@ class windowsLucene extends windowsService { | @@ -415,7 +422,8 @@ class windowsLucene extends windowsService { | ||
| 415 | echo "$cmd<br/>"; | 422 | echo "$cmd<br/>"; |
| 416 | return false; | 423 | return false; |
| 417 | } | 424 | } |
| 418 | - $response = $this->util->pexec($cmd); | 425 | + $this->writeLuceneInstall($cmd); |
| 426 | + //$response = $this->util->pexec($cmd); | ||
| 419 | return $response; | 427 | return $response; |
| 420 | } | 428 | } |
| 421 | return $state; | 429 | return $state; |
setup/wizard/lib/services/windowsOpenOffice.php
| @@ -198,6 +198,13 @@ class windowsOpenOffice extends windowsService { | @@ -198,6 +198,13 @@ class windowsOpenOffice extends windowsService { | ||
| 198 | return $this->options; | 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 | public function install() { | 208 | public function install() { |
| 202 | $status = $this->status(); | 209 | $status = $this->status(); |
| 203 | if($status == '') { | 210 | if($status == '') { |
| @@ -208,7 +215,8 @@ class windowsOpenOffice extends windowsService { | @@ -208,7 +215,8 @@ class windowsOpenOffice extends windowsService { | ||
| 208 | echo "$cmd<br/>"; | 215 | echo "$cmd<br/>"; |
| 209 | return false; | 216 | return false; |
| 210 | } | 217 | } |
| 211 | - $response = $this->util->pexec($cmd); | 218 | + $this->writeOfficeInstall($cmd); |
| 219 | + //$response = $this->util->pexec($cmd); | ||
| 212 | return $response; | 220 | return $response; |
| 213 | } | 221 | } |
| 214 | return $status; | 222 | return $status; |
setup/wizard/lib/services/windowsScheduler.php
| @@ -86,7 +86,7 @@ class windowsScheduler extends windowsService { | @@ -86,7 +86,7 @@ class windowsScheduler extends windowsService { | ||
| 86 | * @return void | 86 | * @return void |
| 87 | */ | 87 | */ |
| 88 | function load() { | 88 | function load() { |
| 89 | - $this->setSchedulerDIR($this->varDir."bin"); | 89 | + $this->setSchedulerDIR(SYS_VAR_DIR."bin"); |
| 90 | $this->setSchedulerScriptPath("taskrunner.bat"); | 90 | $this->setSchedulerScriptPath("taskrunner.bat"); |
| 91 | $this->setSchedulerSource("schedulerService.php"); | 91 | $this->setSchedulerSource("schedulerService.php"); |
| 92 | 92 | ||
| @@ -102,7 +102,7 @@ class windowsScheduler extends windowsService { | @@ -102,7 +102,7 @@ class windowsScheduler extends windowsService { | ||
| 102 | */ | 102 | */ |
| 103 | private function setSchedulerDIR($schedulerDIR) { | 103 | private function setSchedulerDIR($schedulerDIR) { |
| 104 | if(!file_exists($schedulerDIR)) { | 104 | if(!file_exists($schedulerDIR)) { |
| 105 | - @mkdir($schedulerDIR); | 105 | + mkdir($schedulerDIR); |
| 106 | } | 106 | } |
| 107 | $this->schedulerDir = $schedulerDIR; | 107 | $this->schedulerDir = $schedulerDIR; |
| 108 | } | 108 | } |
| @@ -185,15 +185,19 @@ class windowsScheduler extends windowsService { | @@ -185,15 +185,19 @@ class windowsScheduler extends windowsService { | ||
| 185 | if(DEBUG) { // Check if bin is readable and writable | 185 | if(DEBUG) { // Check if bin is readable and writable |
| 186 | echo "Attempt to Create {$this->getSchedulerDir()}\\taskrunner.bat<br>"; | 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,7 +231,7 @@ class windowsScheduler extends windowsService { | ||
| 227 | $state = $this->status(); | 231 | $state = $this->status(); |
| 228 | if($state == '') { | 232 | if($state == '') { |
| 229 | $this->writeTaskRunner(); | 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 | if(DEBUG) { | 235 | if(DEBUG) { |
| 232 | echo '<pre>'; | 236 | echo '<pre>'; |
| 233 | print_r(array('service' => $this->name, 'display' => $this->name, 'path' => $this->getSchedulerScriptPath())); | 237 | print_r(array('service' => $this->name, 'display' => $this->name, 'path' => $this->getSchedulerScriptPath())); |
| @@ -237,13 +241,15 @@ class windowsScheduler extends windowsService { | @@ -237,13 +241,15 @@ class windowsScheduler extends windowsService { | ||
| 237 | echo '</pre>'; | 241 | echo '</pre>'; |
| 238 | return ; | 242 | return ; |
| 239 | } | 243 | } |
| 244 | + /* | ||
| 240 | $response = win32_create_service(array( | 245 | $response = win32_create_service(array( |
| 241 | 'service' => $this->name, | 246 | 'service' => $this->name, |
| 242 | 'display' => $this->name, | 247 | 'display' => $this->name, |
| 243 | 'path' => $this->getSchedulerScriptPath() | 248 | 'path' => $this->getSchedulerScriptPath() |
| 244 | )); | 249 | )); |
| 245 | return $response; | 250 | return $response; |
| 246 | - } else { // Attempt to use the winserv | 251 | + */ |
| 252 | + //} else { // Attempt to use the winserv | ||
| 247 | // TODO: Add service using winserv | 253 | // TODO: Add service using winserv |
| 248 | $this->setWinservice(); | 254 | $this->setWinservice(); |
| 249 | $this->setOptions(); | 255 | $this->setOptions(); |
| @@ -252,9 +258,10 @@ class windowsScheduler extends windowsService { | @@ -252,9 +258,10 @@ class windowsScheduler extends windowsService { | ||
| 252 | echo "$cmd<br/>"; | 258 | echo "$cmd<br/>"; |
| 253 | return false; | 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 | return $state; | 266 | return $state; |
| 260 | } | 267 | } |
setup/wizard/steps/configuration.php
| @@ -378,15 +378,7 @@ class configuration extends Step | @@ -378,15 +378,7 @@ class configuration extends Step | ||
| 378 | */ | 378 | */ |
| 379 | private function getServerInfo() | 379 | private function getServerInfo() |
| 380 | { | 380 | { |
| 381 | -// $iis = false; | ||
| 382 | $script = $_SERVER['SCRIPT_NAME']; | 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 | $file_system_root = realpath(SYSTEM_DIR); | 382 | $file_system_root = realpath(SYSTEM_DIR); |
| 391 | $host = $_SERVER['SERVER_NAME']; | 383 | $host = $_SERVER['SERVER_NAME']; |
| 392 | $port = $_SERVER['SERVER_PORT']; | 384 | $port = $_SERVER['SERVER_PORT']; |
| @@ -394,17 +386,10 @@ class configuration extends Step | @@ -394,17 +386,10 @@ class configuration extends Step | ||
| 394 | $pos = strpos($script, '/setup/wizard/'); | 386 | $pos = strpos($script, '/setup/wizard/'); |
| 395 | $root_url = substr($script, 0, $pos); | 387 | $root_url = substr($script, 0, $pos); |
| 396 | $root_url = (isset($_POST['root_url'])) ? $_POST['root_url'] : $root_url; | 388 | $root_url = (isset($_POST['root_url'])) ? $_POST['root_url'] : $root_url; |
| 397 | -// echo $file_system_root; | ||
| 398 | -// if($iis) { | ||
| 399 | $file_system_root = (isset($_POST['file_system_root'])) ? $_POST['file_system_root'] : $file_system_root; | 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 | $host = (isset($_POST['host'])) ? $_POST['host'] : $host; | 390 | $host = (isset($_POST['host'])) ? $_POST['host'] : $host; |
| 405 | $port = (isset($_POST['port'])) ? $_POST['port'] : $port; | 391 | $port = (isset($_POST['port'])) ? $_POST['port'] : $port; |
| 406 | $ssl_enabled = (isset($_POST['ssl_enabled'])) ? $_POST['ssl_enabled'] : $ssl_enabled; | 392 | $ssl_enabled = (isset($_POST['ssl_enabled'])) ? $_POST['ssl_enabled'] : $ssl_enabled; |
| 407 | - | ||
| 408 | $server = array(); | 393 | $server = array(); |
| 409 | $server['root_url'] = array('name' => 'Root Url', 'setting' => 'rootUrl', 'where' => 'db', 'value' => $root_url); | 394 | $server['root_url'] = array('name' => 'Root Url', 'setting' => 'rootUrl', 'where' => 'db', 'value' => $root_url); |
| 410 | $server['file_system_root'] = array('name' => 'File System Root', 'section' => 'KnowledgeTree', 'setting' => 'fileSystemRoot', 'where' => 'file', 'value' => $file_system_root); | 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,11 +6,11 @@ | ||
| 6 | that things are still set up correctly.</p> | 6 | that things are still set up correctly.</p> |
| 7 | 7 | ||
| 8 | <?php | 8 | <?php |
| 9 | - if($errors || $warnings){ | 9 | +// if($errors || $warnings){ |
| 10 | echo '<div>' | 10 | echo '<div>' |
| 11 | . '<a href="http://wiki.knowledgetree.com/Web_Based_Installer#Post_Install" target="_blank">' | 11 | . '<a href="http://wiki.knowledgetree.com/Web_Based_Installer#Post_Install" target="_blank">' |
| 12 | . 'Click Here for help on overcoming post install issues</a></div><br/>'; | 12 | . 'Click Here for help on overcoming post install issues</a></div><br/>'; |
| 13 | - } | 13 | +// } |
| 14 | ?> | 14 | ?> |
| 15 | <div id="step_content_<?php echo $step_name; ?>" class="step"> | 15 | <div id="step_content_<?php echo $step_name; ?>" class="step"> |
| 16 | 16 |