Commit 51f6cc4daee5371e764e89e453600a08b7cae3f6
1 parent
9dcabe27
Story ID: 778902 Services Updated
Committed by: Jarrett Jordaan Reviewed by: Megan Watson
Showing
73 changed files
with
300 additions
and
132 deletions
setup/wizard/batches/lucene_install.bat
100644 → 100755
setup/wizard/batches/lucene_start.bat
100644 → 100755
setup/wizard/batches/lucene_uninstall.bat
100644 → 100755
setup/wizard/batches/scheduler_install.bat
100644 → 100755
setup/wizard/batches/scheduler_start.bat
100644 → 100755
setup/wizard/batches/scheduler_uninstall.bat
100644 → 100755
setup/wizard/config/config.xml
100644 → 100755
| ... | ... | @@ -12,9 +12,10 @@ |
| 12 | 12 | <step name="Welcome">welcome</step> |
| 13 | 13 | <step name="License Agreement">license</step> |
| 14 | 14 | <step name="PHP Dependencies" mode="silent">dependencies</step> |
| 15 | - <step name="System Configuration" order="1">configuration</step> | |
| 15 | + <step name="System Configuration" order="2">configuration</step> | |
| 16 | 16 | <step name="Service Dependencies" order="3" mode="silent">services</step> |
| 17 | - <step name="Database Configuration" order="2">database</step> | |
| 17 | + <step name="Database Configuration" order="1">database</step> | |
| 18 | + <step name="Registration">registration</step> | |
| 18 | 19 | <step name="Install" mode="silent">install</step> |
| 19 | 20 | <step name="Complete">complete</step> |
| 20 | 21 | </steps> | ... | ... |
setup/wizard/config/databases.xml
100644 → 100755
setup/wizard/dbUtil.php
100644 → 100755
setup/wizard/index.php
100644 → 100755
setup/wizard/ini.php
100644 → 100755
setup/wizard/installUtil.php
100644 → 100755
setup/wizard/installWizard.php
100644 → 100755
setup/wizard/installer.php
100644 → 100755
| ... | ... | @@ -267,7 +267,6 @@ class Installer { |
| 267 | 267 | * @return string |
| 268 | 268 | */ |
| 269 | 269 | private function _runStepAction($stepName) { |
| 270 | - //echo $stepName."=="; | |
| 271 | 270 | $this->stepAction = new stepAction($stepName); |
| 272 | 271 | $this->stepAction->setSteps($this->getSteps()); |
| 273 | 272 | $this->stepAction->setStepNames($this->getStepNames()); |
| ... | ... | @@ -403,8 +402,6 @@ class Installer { |
| 403 | 402 | private function _resetSessions() { |
| 404 | 403 | if($this->session) { |
| 405 | 404 | if($this->_firstStepPeriod()) { |
| 406 | - $this->session->destroy(); | |
| 407 | -/* | |
| 408 | 405 | foreach ($this->getSteps() as $class) { |
| 409 | 406 | $this->session->un_setClass($class); |
| 410 | 407 | } |
| ... | ... | @@ -414,7 +411,6 @@ class Installer { |
| 414 | 411 | foreach ($this->_getInstallOrders() as $class) { |
| 415 | 412 | $this->session->un_setClass($class); |
| 416 | 413 | } |
| 417 | -*/ | |
| 418 | 414 | } |
| 419 | 415 | } |
| 420 | 416 | } |
| ... | ... | @@ -434,7 +430,17 @@ class Installer { |
| 434 | 430 | if(!$this->installOrders) { |
| 435 | 431 | $this->_xmlStepsOrders(); |
| 436 | 432 | } |
| 433 | + if(isset($_POST['Next'])) { | |
| 434 | + $this->response = 'next'; | |
| 435 | + } elseif (isset($_POST['Previous'])) { | |
| 436 | + $this->response = 'previous'; | |
| 437 | + } elseif (isset($_POST['Confirm'])) { | |
| 438 | + $this->response = 'next'; | |
| 439 | + } elseif (isset($_POST['Install'])) { | |
| 440 | + $this->response = 'next'; | |
| 441 | + } | |
| 437 | 442 | } |
| 443 | + | |
| 438 | 444 | /** |
| 439 | 445 | * Main control to handle the flow of install |
| 440 | 446 | * |
| ... | ... | @@ -445,39 +451,29 @@ class Installer { |
| 445 | 451 | */ |
| 446 | 452 | public function step() { |
| 447 | 453 | $this->loadNeeded(); |
| 448 | - $response = $this->_landing(); | |
| 449 | - switch($response) { | |
| 454 | + switch($this->response) { | |
| 450 | 455 | case 'next': |
| 451 | - $this->_proceed(); // Load next window | |
| 456 | + $step_name = $this->_getStepName(); | |
| 457 | + $res = $this->_runStepAction($step_name); | |
| 458 | + if($res == 'next') | |
| 459 | + $this->_proceed(); // Load next window | |
| 460 | + elseif ($res == 'install') { | |
| 461 | + $this->_runStepsInstallers(); // Load landing | |
| 462 | + $this->_proceed(); // Load next window | |
| 463 | + } elseif ($res == 'confirm') { | |
| 464 | + $this->stepConfirmation = true; | |
| 465 | + $this->_landing(); | |
| 466 | + } else { | |
| 467 | +// die("Unmet parameters"); | |
| 468 | + } | |
| 452 | 469 | break; |
| 453 | - | |
| 454 | 470 | case 'previous': |
| 455 | - $this->_backward(); // Load previous window | |
| 456 | - break; | |
| 457 | - | |
| 458 | - case 'confirm': | |
| 459 | - $this->stepConfirmation = true; | |
| 460 | - $this->_landing(); | |
| 461 | - break; | |
| 462 | - | |
| 463 | - case 'error': | |
| 464 | - $this->_landing(); // Load landing with errors | |
| 465 | - break; | |
| 466 | - | |
| 467 | - case 'landing': | |
| 468 | - $this->_landing(); // Load landing | |
| 469 | - break; | |
| 470 | - | |
| 471 | - case 'install': | |
| 472 | - $this->_runStepsInstallers(); // Load landing | |
| 473 | - $this->_proceed(); // Load next window | |
| 474 | - break; | |
| 475 | - | |
| 471 | + $this->_backward(); // Load previous page | |
| 472 | + break; | |
| 476 | 473 | default: |
| 477 | - die("Response $response: That was unexpected"); // No class response | |
| 474 | + $this->_landing(); | |
| 478 | 475 | break; |
| 479 | 476 | } |
| 480 | - | |
| 481 | 477 | $this->stepAction->paintAction(); // Display step |
| 482 | 478 | } |
| 483 | 479 | ... | ... |
setup/wizard/lib/services/service.php
100644 → 100755
setup/wizard/lib/services/unixAgent.php
100644 → 100755
setup/wizard/lib/services/unixLucene.php
100644 → 100755
| ... | ... | @@ -99,8 +99,6 @@ class unixLucene extends Service { |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | -// echo $this->phpDir; | |
| 103 | -// die; | |
| 104 | 102 | return ; |
| 105 | 103 | } else { |
| 106 | 104 | $this->phpDir = $phpdir; |
| ... | ... | @@ -165,13 +163,8 @@ class unixLucene extends Service { |
| 165 | 163 | |
| 166 | 164 | public function stop() { |
| 167 | 165 | // TODO: Breaks things |
| 168 | - if($this->getPhpDir() != "") { | |
| 169 | -// $cmd = $this->getPhpDir()." ".$this->getIndexerDir().$this->getShutdownScript()." positive &> ".SYS_LOG_DIR."dmsctl.log"; | |
| 170 | - } else { | |
| 171 | - $cmd = "pkill -f ".$this->getLuceneSource(); | |
| 172 | - } | |
| 173 | 166 | $state = $this->status(); |
| 174 | - if($state == 'STARTED') { | |
| 167 | + if($state != 'STOPPED') { | |
| 175 | 168 | $cmd = "pkill -f ".$this->getLuceneSource(); |
| 176 | 169 | $response = $this->util->pexec($cmd); |
| 177 | 170 | return $response; |
| ... | ... | @@ -181,27 +174,34 @@ class unixLucene extends Service { |
| 181 | 174 | |
| 182 | 175 | public function install() { |
| 183 | 176 | $state = $this->status(); |
| 184 | -// die; | |
| 185 | 177 | if($state != 'STARTED') { |
| 186 | 178 | $cmd = "cd ".$this->getLuceneDir()."; "; |
| 187 | 179 | $cmd .= "nohup java -jar ".$this->getLuceneSource()." &> ".SYS_LOG_DIR."lucene.log &"; |
| 188 | 180 | $response = $this->util->pexec($cmd); |
| 181 | + | |
| 189 | 182 | return $response; |
| 190 | 183 | } elseif ($state == 'STOPPED') { |
| 191 | - // start her up | |
| 192 | - | |
| 184 | + // Start Service | |
| 185 | + return true; | |
| 186 | + } else { | |
| 187 | + // Service Running Already | |
| 188 | + return true; | |
| 193 | 189 | } |
| 190 | + | |
| 191 | + return false; | |
| 194 | 192 | } |
| 195 | 193 | |
| 196 | 194 | public function status() { |
| 197 | - $cmd = "ps ax | grep ".$this->getLuceneSource()." | awk {'print $1'}"; | |
| 198 | -// echo $cmd; | |
| 195 | + $cmd = "ps ax | grep ".$this->getLuceneSource(); | |
| 199 | 196 | $response = $this->util->pexec($cmd); |
| 200 | -// var_dump($response); | |
| 201 | 197 | if(is_array($response['out'])) { |
| 202 | 198 | if(count($response['out']) > 1) { |
| 203 | -// var_dump($response['out']); | |
| 204 | - return 'STARTED'; | |
| 199 | + foreach ($response['out'] as $r) { | |
| 200 | + preg_match('/grep/', $r, $matches); // Ignore grep | |
| 201 | + if(!$matches) { | |
| 202 | + return 'STARTED'; | |
| 203 | + } | |
| 204 | + } | |
| 205 | 205 | } else { |
| 206 | 206 | return 'STOPPED'; |
| 207 | 207 | } | ... | ... |
setup/wizard/lib/services/unixScheduler.php
100644 → 100755
| ... | ... | @@ -47,6 +47,7 @@ class unixScheduler extends Service { |
| 47 | 47 | protected $schedulerDir; |
| 48 | 48 | protected $schedulerSource; |
| 49 | 49 | protected $schedulerSourceLoc; |
| 50 | + protected $systemDir; | |
| 50 | 51 | private $util = null; |
| 51 | 52 | |
| 52 | 53 | public function __construct() { |
| ... | ... | @@ -55,6 +56,7 @@ class unixScheduler extends Service { |
| 55 | 56 | function load() { |
| 56 | 57 | $this->name = "KTSchedulerTest"; |
| 57 | 58 | $this->util = new InstallUtil(); |
| 59 | + $this->setSystemDir(SYSTEM_ROOT."bin".DS); | |
| 58 | 60 | $this->setSchedulerDir(SYSTEM_DIR."bin".DS); |
| 59 | 61 | $this->setSchedulerSource('schedulerTask.sh'); |
| 60 | 62 | $this->setSchedulerSourceLoc('schedulerTask.sh'); |
| ... | ... | @@ -69,6 +71,16 @@ class unixScheduler extends Service { |
| 69 | 71 | return $this->schedulerPidFile; |
| 70 | 72 | } |
| 71 | 73 | |
| 74 | + function setSystemDir($systemDir) { | |
| 75 | + $this->systemDir = $systemDir; | |
| 76 | + } | |
| 77 | + | |
| 78 | + function getSystemDir() { | |
| 79 | + if(file_exists($this->systemDir)) | |
| 80 | + return $this->systemDir; | |
| 81 | + return false; | |
| 82 | + } | |
| 83 | + | |
| 72 | 84 | function setSchedulerDir($schedulerDir) { |
| 73 | 85 | $this->schedulerDir = $schedulerDir; |
| 74 | 86 | } |
| ... | ... | @@ -90,21 +102,25 @@ class unixScheduler extends Service { |
| 90 | 102 | } |
| 91 | 103 | |
| 92 | 104 | function getSchedulerSourceLoc() { |
| 93 | - if(file_exists($this->schedulerSourceLoc)) { | |
| 105 | + if(file_exists($this->schedulerSourceLoc)) | |
| 94 | 106 | return $this->schedulerSourceLoc; |
| 95 | - } | |
| 96 | -// die('File Expected Error'); | |
| 97 | 107 | return false; |
| 98 | 108 | } |
| 99 | 109 | |
| 100 | 110 | function install() { |
| 101 | - $source = $this->getSchedulerSourceLoc(); | |
| 102 | - if($source) { | |
| 103 | - $cmd = "nohup ".$source." &> ".SYS_LOG_DIR."dmsctl.log"; | |
| 104 | - $response = $this->util->pexec($cmd); | |
| 105 | - return $response; | |
| 106 | - } | |
| 107 | - | |
| 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 | +// } | |
| 108 | 124 | return false; |
| 109 | 125 | } |
| 110 | 126 | |
| ... | ... | @@ -113,17 +129,22 @@ class unixScheduler extends Service { |
| 113 | 129 | } |
| 114 | 130 | |
| 115 | 131 | function stop() { |
| 116 | - $cmd = "pkill -f ".$this->name; | |
| 132 | + $cmd = "pkill -f ".$this->schedulerSource; | |
| 117 | 133 | $response = $this->util->pexec($cmd); |
| 118 | 134 | return $response; |
| 119 | 135 | } |
| 120 | 136 | |
| 121 | 137 | function status() { |
| 122 | - $cmd = "ps ax | grep ".$this->getSchedulerSource()." | awk {'print $1'}"; | |
| 138 | + $cmd = "ps ax | grep ".$this->getSchedulerSource(); | |
| 123 | 139 | $response = $this->util->pexec($cmd); |
| 124 | - if(is_array($response['out'])) { | |
| 140 | + if(is_array($response['out'])) { | |
| 125 | 141 | if(count($response['out']) > 1) { |
| 126 | - return 'STARTED'; | |
| 142 | + foreach ($response['out'] as $r) { | |
| 143 | + preg_match('/grep/', $r, $matches); // Ignore grep | |
| 144 | + if(!$matches) { | |
| 145 | + return 'STARTED'; | |
| 146 | + } | |
| 147 | + } | |
| 127 | 148 | } else { |
| 128 | 149 | return 'STOPPED'; |
| 129 | 150 | } |
| ... | ... | @@ -131,5 +152,17 @@ class unixScheduler extends Service { |
| 131 | 152 | |
| 132 | 153 | return 'STOPPED'; |
| 133 | 154 | } |
| 155 | + | |
| 156 | + function writeSchedulerTask() { | |
| 157 | + $fp = fopen($this->getSchedulerDir().$this->getSchedulerSource(), "w+"); | |
| 158 | + $content = "#!/bin/sh\n"; | |
| 159 | + $content .= "cd ".$this->getSchedulerDir()."\n"; | |
| 160 | + $content .= "while true; do\n"; | |
| 161 | + $content .= "php "."\"{$this->getSchedulerDir()}{$this->getSchedulerSource()}\""; | |
| 162 | + $content .= "sleep 30\n"; | |
| 163 | + $content .= "done"; | |
| 164 | + fwrite($fp, $content); | |
| 165 | + fclose($fp); | |
| 166 | + } | |
| 134 | 167 | } |
| 135 | 168 | ?> |
| 136 | 169 | \ No newline at end of file | ... | ... |
setup/wizard/lib/services/unixService.php
100644 → 100755
setup/wizard/lib/services/windowsAgent.php
100644 → 100755
setup/wizard/lib/services/windowsLucene.php
100644 → 100755
setup/wizard/lib/services/windowsScheduler.php
100644 → 100755
setup/wizard/lib/services/windowsService.php
100644 → 100755
setup/wizard/path.php
100644 → 100755
| ... | ... | @@ -73,10 +73,17 @@ |
| 73 | 73 | define('RES_DIR', WIZARD_DIR."resources".DS); |
| 74 | 74 | define('STEP_DIR', WIZARD_DIR."steps".DS); |
| 75 | 75 | define('TEMP_DIR', WIZARD_DIR."templates".DS); |
| 76 | - // Define paths to system | |
| 76 | + // Define paths to system webroot | |
| 77 | 77 | define('SYSTEM_DIR', $sys); |
| 78 | 78 | define('SYS_BIN_DIR', SYSTEM_DIR."bin".DS); |
| 79 | 79 | define('SYS_LOG_DIR', SYSTEM_DIR."var".DS."log".DS); |
| 80 | + // Define paths to system | |
| 81 | + array_pop($xdir); | |
| 82 | + $asys = ''; | |
| 83 | + foreach ($xdir as $k=>$v) { | |
| 84 | + $asys .= $v.DS; | |
| 85 | + } | |
| 86 | + define('SYSTEM_ROOT', $asys); | |
| 80 | 87 | // Install Type |
| 81 | 88 | preg_match('/Zend/', $sys, $matches); |
| 82 | 89 | if($matches) { |
| ... | ... | @@ -96,13 +103,16 @@ |
| 96 | 103 | } |
| 97 | 104 | // Other |
| 98 | 105 | date_default_timezone_set('Africa/Johannesburg'); |
| 99 | - // Mysql bin | |
| 100 | - $serverPaths = explode(';',$_SERVER['PATH']); | |
| 101 | - foreach ($serverPaths as $apath) { | |
| 102 | - preg_match('/mysql/i', $apath, $matches); | |
| 103 | - if($matches) { | |
| 104 | - define('MYSQL_BIN', $apath.DS); | |
| 105 | - break; | |
| 106 | - } | |
| 106 | + // Mysql bin [Windows] | |
| 107 | + if(WINDOWS_OS) { | |
| 108 | + $serverPaths = explode(';',$_SERVER['PATH']); | |
| 109 | + foreach ($serverPaths as $apath) { | |
| 110 | + preg_match('/mysql/i', $apath, $matches); | |
| 111 | + if($matches) { | |
| 112 | + define('MYSQL_BIN', $apath.DS); | |
| 113 | + break; | |
| 114 | + } | |
| 115 | + } | |
| 107 | 116 | } |
| 117 | + | |
| 108 | 118 | ?> | ... | ... |
setup/wizard/resources/graphics/active.png
100644 → 100755
setup/wizard/resources/graphics/background.gif
100644 → 100755
setup/wizard/resources/graphics/cross.png
100644 → 100755
setup/wizard/resources/graphics/cross_orange.png
100644 → 100755
setup/wizard/resources/graphics/footer.png
100644 → 100755
setup/wizard/resources/graphics/gradient.png
100644 → 100755
setup/wizard/resources/graphics/inactive.png
100644 → 100755
setup/wizard/resources/graphics/indicator.png
100644 → 100755
setup/wizard/resources/graphics/indicator.pxm
100644 → 100755
No preview for this file type
setup/wizard/resources/graphics/left.png
100644 → 100755
setup/wizard/resources/graphics/logo.png
100644 → 100755
setup/wizard/resources/graphics/powered-by-kt.png
100644 → 100755
setup/wizard/resources/graphics/tick.png
100644 → 100755
setup/wizard/resources/graphics/tree.jpg
100644 → 100755
setup/wizard/resources/wizard.css
100644 → 100755
setup/wizard/resources/wizard.js
100644 → 100755
| ... | ... | @@ -47,13 +47,11 @@ wizard.prototype.toggleElement = function(el) { |
| 47 | 47 | |
| 48 | 48 | // Handle steps within database page |
| 49 | 49 | wizard.prototype.showStep = function(p, d) { |
| 50 | - // Don't check if previous is clicked | |
| 51 | - if(d != 'p') { | |
| 52 | - // Check for errors | |
| 50 | + if(d != 'p') { // Don't check if previous is clicked | |
| 53 | 51 | var ueq = 0; |
| 54 | - if(p == 2) { | |
| 52 | + if(p == 2) { // Check User 1 | |
| 55 | 53 | ueq = w.validateUsers('dmsname', 'dmspassword', 'dmspassword2'); |
| 56 | - } else if(p == 3) { | |
| 54 | + } else if(p == 3) { // Check User 1 | |
| 57 | 55 | ueq = w.validateUsers('dmsusername', 'dmsuserpassword', 'dmsuserpassword2'); |
| 58 | 56 | } |
| 59 | 57 | if(ueq != 0) { |
| ... | ... | @@ -136,8 +134,20 @@ wizard.prototype.focusElement = function(el) { |
| 136 | 134 | wizard.prototype.onSubmitValidate = function() { |
| 137 | 135 | var response = w.showStep(3, 'n'); |
| 138 | 136 | if(response == true) { |
| 137 | + alert(response); | |
| 139 | 138 | document.getElementById('sendAll').name = 'Next'; // Force the next step |
| 140 | 139 | document.getElementById('sendAll').value = 'next'; |
| 141 | 140 | document.getElementById('dbsettings').submit(); |
| 141 | + } else { | |
| 142 | + alert('asd'); | |
| 143 | + return false; | |
| 144 | + /* | |
| 145 | + document.getElementById('sendAll').name = 'Previous'; // Force the previous step | |
| 146 | + document.getElementById('sendAll').value = 'previous'; | |
| 147 | + document.getElementById('dbsettings').submit(); | |
| 148 | + */ | |
| 142 | 149 | } |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 143 | 153 | } |
| 144 | 154 | \ No newline at end of file | ... | ... |
setup/wizard/service.php
100644 → 100755
setup/wizard/session.php
100644 → 100755
setup/wizard/sql/data.sql
100644 → 100755
setup/wizard/sql/structure.sql
100644 → 100755
setup/wizard/sql/upgrades/folders.sql
100644 → 100755
setup/wizard/sql/upgrades/search_ranking.sql
100644 → 100755
setup/wizard/sql/user.sql
100644 → 100755
setup/wizard/step.php
100644 → 100755
setup/wizard/stepAction.php
100644 → 100755
| ... | ... | @@ -322,6 +322,7 @@ class stepAction { |
| 322 | 322 | $step_tpl = new Template($template); |
| 323 | 323 | $step_tpl->set("errors", $step_errors); // Set template errors |
| 324 | 324 | $step_vars = $this->action->getStepVars(); // Get template variables |
| 325 | + $step_tpl->set("step_vars", $step_vars); // Set template errors | |
| 325 | 326 | foreach ($step_vars as $key => $value) { // Set template variables |
| 326 | 327 | $step_tpl->set($key, $value); // Load values to session |
| 327 | 328 | if($this->action->storeInSession()) { // Check if class values need to be stored in session | ... | ... |
setup/wizard/steps/complete.php
100644 → 100755
setup/wizard/steps/configuration.php
100644 → 100755
| ... | ... | @@ -117,8 +117,12 @@ class configuration extends Step |
| 117 | 117 | * @return string The position in the step |
| 118 | 118 | */ |
| 119 | 119 | public function doStep() { |
| 120 | + if(!$this->inStep("configuration")) { | |
| 121 | + $this->doRun(); | |
| 122 | + return 'landing'; | |
| 123 | + } | |
| 120 | 124 | if($this->next()) { |
| 121 | - if($this->doRun()){ | |
| 125 | + if($this->doRun()) { | |
| 122 | 126 | return 'confirm'; |
| 123 | 127 | } |
| 124 | 128 | return 'error'; | ... | ... |
setup/wizard/steps/database.php
100644 → 100755
| ... | ... | @@ -241,8 +241,8 @@ class database extends Step |
| 241 | 241 | public function __construct() { |
| 242 | 242 | $this->_dbhandler = new dbUtil(); |
| 243 | 243 | $this->_util = new InstallUtil(); |
| 244 | - $this->mysqlDir = MYSQL_BIN; | |
| 245 | - echo $this->mysqlDir; | |
| 244 | + if(WINDOWS_OS) | |
| 245 | + $this->mysqlDir = MYSQL_BIN; | |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /** |
| ... | ... | @@ -323,7 +323,7 @@ class database extends Step |
| 323 | 323 | else |
| 324 | 324 | $con = $this->_dbhandler->load($this->dhost.":".$this->dport, $this->duname, $this->dpassword, $this->dname); |
| 325 | 325 | if (!$con) { |
| 326 | - $this->error[] = "Could not connect: " . $this->_dbhandler->getErrors(); | |
| 326 | + $this->error[] = "Could not connect"; | |
| 327 | 327 | return false; |
| 328 | 328 | } else { |
| 329 | 329 | $this->error = array(); // Reset usage errors |
| ... | ... | @@ -541,7 +541,7 @@ class database extends Step |
| 541 | 541 | $con = $this->connectMysql(); |
| 542 | 542 | if($con) { |
| 543 | 543 | if(!$this->createDB($con)) { |
| 544 | - $this->error[] = "Could not Create Database: " . $this->_dbhandler->getErrors(); | |
| 544 | + $this->error[] = "Could not Create Database: "; | |
| 545 | 545 | return false; |
| 546 | 546 | } |
| 547 | 547 | $this->closeMysql($con); |
| ... | ... | @@ -559,7 +559,7 @@ class database extends Step |
| 559 | 559 | private function connectMysql() { |
| 560 | 560 | $con = $this->_dbhandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname); |
| 561 | 561 | if (!$con) { |
| 562 | - $this->error[] = "Could not connect: " . $this->_dbhandler->getErrors(); | |
| 562 | + $this->error[] = "Could not connect: "; | |
| 563 | 563 | |
| 564 | 564 | return false; |
| 565 | 565 | } |
| ... | ... | @@ -579,16 +579,16 @@ class database extends Step |
| 579 | 579 | if($this->usedb($con)) { // attempt to use the db |
| 580 | 580 | if($this->dropdb($con)) { // attempt to drop the db |
| 581 | 581 | if(!$this->create($con)) { // attempt to create the db |
| 582 | - $this->error[] = "Could create database: " . $this->_dbhandler->getErrors(); | |
| 582 | + $this->error[] = "Could create database: "; | |
| 583 | 583 | return false;// cannot overwrite database |
| 584 | 584 | } |
| 585 | 585 | } else { |
| 586 | - $this->error[] = "Could not drop database: " . $this->_dbhandler->getErrors(); | |
| 586 | + $this->error[] = "Could not drop database: "; | |
| 587 | 587 | return false;// cannot overwrite database |
| 588 | 588 | } |
| 589 | 589 | } else { |
| 590 | 590 | if(!$this->create($con)) { // attempt to create the db |
| 591 | - $this->error[] = "Could not create database: " . $this->_dbhandler->getErrors(); | |
| 591 | + $this->error[] = "Could not create database: "; | |
| 592 | 592 | return false;// cannot overwrite database |
| 593 | 593 | } |
| 594 | 594 | } |
| ... | ... | @@ -638,7 +638,7 @@ class database extends Step |
| 638 | 638 | if($this->_dbhandler->useBD($this->dname)) { |
| 639 | 639 | return true; |
| 640 | 640 | } else { |
| 641 | - $this->error[] = "Error using database: ".$this->_dbhandler->getErrors(); | |
| 641 | + $this->error[] = "Error using database: "; | |
| 642 | 642 | return false; |
| 643 | 643 | } |
| 644 | 644 | } |
| ... | ... | @@ -655,11 +655,11 @@ class database extends Step |
| 655 | 655 | if($this->ddrop) { |
| 656 | 656 | $sql = "DROP DATABASE {$this->dname};"; |
| 657 | 657 | if(!$this->_dbhandler->query($sql)) { |
| 658 | - $this->error[] = "Cannot drop database: ".$this->_dbhandler->getErrors(); | |
| 658 | + $this->error[] = "Cannot drop database: "; | |
| 659 | 659 | return false; |
| 660 | 660 | } |
| 661 | 661 | } else { |
| 662 | - $this->error[] = "Cannot drop database: ".$this->_dbhandler->getErrors(); | |
| 662 | + $this->error[] = "Cannot drop database: "; | |
| 663 | 663 | return false; |
| 664 | 664 | } |
| 665 | 665 | return true; |
| ... | ... | @@ -688,7 +688,7 @@ class database extends Step |
| 688 | 688 | if ($this->_dbhandler->execute($user1) && $this->_dbhandler->execute($user2)) { |
| 689 | 689 | return true; |
| 690 | 690 | } else { |
| 691 | - $this->error[] = "Could not create users in database: ".$this->_dbhandler->getErrors(); | |
| 691 | + $this->error[] = "Could not create users in database: "; | |
| 692 | 692 | return false; |
| 693 | 693 | } |
| 694 | 694 | } |
| ... | ... | @@ -785,30 +785,4 @@ class database extends Step |
| 785 | 785 | |
| 786 | 786 | } |
| 787 | 787 | } |
| 788 | - | |
| 789 | -/*$db = new database(); | |
| 790 | -$db->doProcess(); | |
| 791 | -$dhost = 'localhost'; | |
| 792 | -$dbbinary = "C:\Program Files\Zend\MySQL51\bin\mysql.exe"; | |
| 793 | -$dbbinary = "mysql"; | |
| 794 | -$dbbinary = MYSQL_BIN."mysql.exe"; | |
| 795 | -$duname = "root"; | |
| 796 | -$dpassword = "root"; | |
| 797 | -$dname = "dms_install"; | |
| 798 | -$sql1 = "DROP DATABASE {$dname}"; | |
| 799 | -$sql2 = "CREATE DATABASE {$dname}"; | |
| 800 | -$con = $db->_dbhandler->load($dhost, $duname, $dpassword, $dname); | |
| 801 | -$db->_dbhandler->query($sql1, $con); | |
| 802 | -$db->_dbhandler->query($sql2, $con); | |
| 803 | -//die; | |
| 804 | -$command = "\"$dbbinary\" -u{$duname} -p{$dpassword} {$dname} < \"".SQL_DIR."structure.sql\""; | |
| 805 | -//echo $command."<br>"; | |
| 806 | -$db->_util->pexec($command); | |
| 807 | -$command = "\"$dbbinary\" -u{$duname} -p{$dpassword} {$dname} < \"".SQL_DIR."data.sql\""; | |
| 808 | -$db->_util->pexec($command); | |
| 809 | -echo $command."<br>"; | |
| 810 | -$db->setName("dms".rand()); | |
| 811 | -$db->installStep(); | |
| 812 | -var_dump($db); | |
| 813 | -die;*/ | |
| 814 | 788 | ?> |
| 815 | 789 | \ No newline at end of file | ... | ... |
setup/wizard/steps/dependencies.php
100644 → 100755
| ... | ... | @@ -71,7 +71,7 @@ class dependencies extends Step |
| 71 | 71 | * @access public |
| 72 | 72 | */ |
| 73 | 73 | public function __construct() { |
| 74 | - $this->temp_variables = array("step_name"=>"dependencyCheck"); | |
| 74 | + $this->temp_variables = array("step_name"=>"dependencies"); | |
| 75 | 75 | $this->error = array(); |
| 76 | 76 | $this->done = true; |
| 77 | 77 | } |
| ... | ... | @@ -85,6 +85,10 @@ class dependencies extends Step |
| 85 | 85 | */ |
| 86 | 86 | public function doStep() |
| 87 | 87 | { |
| 88 | + if(!$this->inStep("dependencies")) { | |
| 89 | + $this->doRun(); | |
| 90 | + return 'landing'; | |
| 91 | + } | |
| 88 | 92 | // Check dependencies |
| 89 | 93 | $passed = $this->doRun(); |
| 90 | 94 | if($this->next()) { | ... | ... |
setup/wizard/steps/dependency_check.php
100644 → 100755
setup/wizard/steps/install.php
100644 → 100755
| ... | ... | @@ -48,11 +48,12 @@ class install extends step |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function doStep() { |
| 51 | + if(!$this->inStep("install")) { | |
| 52 | + return 'landing'; | |
| 53 | + } | |
| 51 | 54 | if($this->install()) { |
| 52 | - | |
| 53 | 55 | return 'install'; |
| 54 | 56 | } else if($this->previous()) { |
| 55 | - | |
| 56 | 57 | return 'previous'; |
| 57 | 58 | } |
| 58 | 59 | ... | ... |
setup/wizard/steps/license.php
100644 → 100755
| ... | ... | @@ -40,21 +40,31 @@ |
| 40 | 40 | * @version Version 0.1 |
| 41 | 41 | */ |
| 42 | 42 | |
| 43 | -class license extends step { | |
| 44 | 43 | |
| 44 | +class license extends step { | |
| 45 | + /** | |
| 46 | + * List of errors encountered by step | |
| 47 | + * | |
| 48 | + * @author KnowledgeTree Team | |
| 49 | + * @access protected | |
| 50 | + * @var array | |
| 51 | + */ | |
| 52 | + protected $error = array(); | |
| 53 | + | |
| 45 | 54 | function __construct() { |
| 46 | 55 | $this->temp_variables = array("step_name"=>"license"); |
| 47 | 56 | } |
| 48 | 57 | |
| 49 | 58 | public function doStep() { |
| 59 | + if(!$this->inStep("license")) { | |
| 60 | + return 'landing'; | |
| 61 | + } | |
| 50 | 62 | if($this->next()) { |
| 51 | 63 | if($this->doRun()) |
| 52 | - | |
| 53 | 64 | return 'next'; |
| 54 | 65 | else |
| 55 | 66 | return 'error'; |
| 56 | 67 | } else if($this->previous()) { |
| 57 | - | |
| 58 | 68 | return 'previous'; |
| 59 | 69 | } |
| 60 | 70 | |
| ... | ... | @@ -65,14 +75,14 @@ class license extends step { |
| 65 | 75 | if(isset($_POST['license'])) { |
| 66 | 76 | // check if agree |
| 67 | 77 | if($_POST['license']) { |
| 68 | - | |
| 69 | 78 | return true; |
| 70 | 79 | } else { |
| 71 | 80 | $this->error[] = "Please accept the license agreement"; |
| 72 | - | |
| 73 | 81 | return false; |
| 74 | 82 | } |
| 75 | 83 | } |
| 84 | + $this->error[] = "Please accept the license agreement"; | |
| 85 | + return false; | |
| 76 | 86 | } |
| 77 | 87 | |
| 78 | 88 | public function getStepVars() | ... | ... |
setup/wizard/steps/registration.php
0 → 100755
| 1 | +<?php | |
| 2 | +/** | |
| 3 | +* Complete Step Controller. | |
| 4 | +* | |
| 5 | +* KnowledgeTree Community Edition | |
| 6 | +* Document Management Made Simple | |
| 7 | +* Copyright(C) 2008,2009 KnowledgeTree Inc. | |
| 8 | +* Portions copyright The Jam Warehouse Software(Pty) Limited | |
| 9 | +* | |
| 10 | +* This program is free software; you can redistribute it and/or modify it under | |
| 11 | +* the terms of the GNU General Public License version 3 as published by the | |
| 12 | +* Free Software Foundation. | |
| 13 | +* | |
| 14 | +* This program is distributed in the hope that it will be useful, but WITHOUT | |
| 15 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 16 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
| 17 | +* details. | |
| 18 | +* | |
| 19 | +* You should have received a copy of the GNU General Public License | |
| 20 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 21 | +* | |
| 22 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 23 | +* California 94120-7775, or email info@knowledgetree.com. | |
| 24 | +* | |
| 25 | +* The interactive user interfaces in modified source and object code versions | |
| 26 | +* of this program must display Appropriate Legal Notices, as required under | |
| 27 | +* Section 5 of the GNU General Public License version 3. | |
| 28 | +* | |
| 29 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | |
| 30 | +* these Appropriate Legal Notices must retain the display of the "Powered by | |
| 31 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 32 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | |
| 33 | +* must display the words "Powered by KnowledgeTree" and retain the original | |
| 34 | +* copyright notice. | |
| 35 | +* | |
| 36 | +* @copyright 2008-2009, KnowledgeTree Inc. | |
| 37 | +* @license GNU General Public License version 3 | |
| 38 | +* @author KnowledgeTree Team | |
| 39 | +* @package Installer | |
| 40 | +* @version Version 0.1 | |
| 41 | +*/ | |
| 42 | + | |
| 43 | +class registration extends Step | |
| 44 | +{ | |
| 45 | + | |
| 46 | + function configure() { | |
| 47 | + $this->temp_variables = array("step_name"=>"registration"); | |
| 48 | + } | |
| 49 | + | |
| 50 | + function doStep() { | |
| 51 | + if(!$this->inStep("registration")) { | |
| 52 | + | |
| 53 | + return 'landing'; | |
| 54 | + } | |
| 55 | + if($this->next()) { | |
| 56 | + if($this->doRun()) | |
| 57 | + return 'next'; | |
| 58 | + else | |
| 59 | + return 'error'; | |
| 60 | + } else if($this->previous()) { | |
| 61 | + return 'previous'; | |
| 62 | + } | |
| 63 | + | |
| 64 | + return 'landing'; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public function doRun() { | |
| 68 | + return true; // TODO: Bypass for now | |
| 69 | + if(isset($_POST['email'])) { | |
| 70 | + if($_POST['email']) { // check email is valid | |
| 71 | + return true; | |
| 72 | + } else { | |
| 73 | + $this->error[] = "Please accept the license agreement"; | |
| 74 | + return false; | |
| 75 | + } | |
| 76 | + } | |
| 77 | + } | |
| 78 | +} | |
| 79 | +?> | |
| 0 | 80 | \ No newline at end of file | ... | ... |
setup/wizard/steps/services.php
100644 → 100755
| ... | ... | @@ -65,14 +65,18 @@ class services extends Step |
| 65 | 65 | protected $java; |
| 66 | 66 | |
| 67 | 67 | protected $util; |
| 68 | + | |
| 69 | + public $temp_variables; | |
| 70 | + | |
| 68 | 71 | /** |
| 69 | - * Constructs database object | |
| 72 | + * Constructs services object | |
| 70 | 73 | * |
| 71 | 74 | * @author KnowledgeTree Team |
| 72 | 75 | * @access public |
| 73 | 76 | * @param none |
| 74 | 77 | */ |
| 75 | 78 | public function __construct() { |
| 79 | + $this->temp_variables = array("step_name"=>"services"); | |
| 76 | 80 | $this->util = new InstallUtil(); |
| 77 | 81 | $this->setJava(); |
| 78 | 82 | } |
| ... | ... | @@ -130,18 +134,21 @@ class services extends Step |
| 130 | 134 | */ |
| 131 | 135 | public function doStep() |
| 132 | 136 | { |
| 137 | + if(!$this->inStep("services")) { | |
| 138 | + $this->doRun(); | |
| 139 | + return 'landing'; | |
| 140 | + } | |
| 133 | 141 | // Check dependencies |
| 134 | 142 | $passed = $this->doRun(); |
| 143 | +// die; | |
| 135 | 144 | if($this->next()) { |
| 136 | 145 | if($passed) |
| 137 | 146 | return 'next'; |
| 138 | 147 | else |
| 139 | 148 | return 'error'; |
| 140 | 149 | } else if($this->previous()) { |
| 141 | - | |
| 142 | 150 | return 'previous'; |
| 143 | 151 | } |
| 144 | - | |
| 145 | 152 | return 'landing'; |
| 146 | 153 | } |
| 147 | 154 | |
| ... | ... | @@ -160,6 +167,8 @@ class services extends Step |
| 160 | 167 | } |
| 161 | 168 | |
| 162 | 169 | $this->installService(); |
| 170 | +// if(count($this->getErrors() > 0)) | |
| 171 | +// return false; | |
| 163 | 172 | return true; |
| 164 | 173 | } |
| 165 | 174 | |
| ... | ... | @@ -177,6 +186,9 @@ class services extends Step |
| 177 | 186 | $className = OS.$serviceName; |
| 178 | 187 | $service = new $className(); |
| 179 | 188 | $status = $this->serviceHelper($service); |
| 189 | + if ($status) { | |
| 190 | + $this->temp_variables['services'][] = $service->getName()." has been added as a Service"; | |
| 191 | + } | |
| 180 | 192 | } |
| 181 | 193 | |
| 182 | 194 | return true; |
| ... | ... | @@ -192,11 +204,9 @@ class services extends Step |
| 192 | 204 | */ |
| 193 | 205 | private function serviceHelper($service) { |
| 194 | 206 | $service->load(); // Load Defaults |
| 195 | - $response = $service->uninstall(); // Uninstall service if it exists | |
| 196 | 207 | $response = $service->install(); // Install service |
| 197 | 208 | $statusCheck = OS."ServiceInstalled"; |
| 198 | 209 | return $this->$statusCheck($service); |
| 199 | - | |
| 200 | 210 | } |
| 201 | 211 | |
| 202 | 212 | /** |
| ... | ... | @@ -279,5 +289,17 @@ class services extends Step |
| 279 | 289 | public function getErrors() { |
| 280 | 290 | return $this->error; |
| 281 | 291 | } |
| 292 | + | |
| 293 | + /** | |
| 294 | + * Get the variables to be passed to the template | |
| 295 | + * | |
| 296 | + * @author KnowledgeTree Team | |
| 297 | + * @access public | |
| 298 | + * @return array | |
| 299 | + */ | |
| 300 | + public function getStepVars() | |
| 301 | + { | |
| 302 | + return $this->temp_variables; | |
| 303 | + } | |
| 282 | 304 | } |
| 283 | 305 | ?> |
| 284 | 306 | \ No newline at end of file | ... | ... |
setup/wizard/steps/welcome.php
100644 → 100755
setup/wizard/template.php
100644 → 100755
setup/wizard/templates/complete.tpl
100644 → 100755
setup/wizard/templates/configuration.tpl
100644 → 100755
setup/wizard/templates/configuration_confirm.tpl
100644 → 100755
setup/wizard/templates/database.tpl
100644 → 100755
setup/wizard/templates/database_confirm.tpl
100644 → 100755
setup/wizard/templates/dependencies.tpl
100644 → 100755
setup/wizard/templates/dependency_check.tpl
100644 → 100755
setup/wizard/templates/install.tpl
100644 → 100755
setup/wizard/templates/license.tpl
100644 → 100755
setup/wizard/templates/registration.tpl
0 → 100755
| 1 | +<h1>Registration</h1> | |
| 2 | + | |
| 3 | +<div class="errors"> | |
| 4 | + <?php if(isset($errors)) { | |
| 5 | + foreach($errors as $k=>$e) { | |
| 6 | + echo $e; | |
| 7 | + } | |
| 8 | + }?> | |
| 9 | +</div> | |
| 10 | + | |
| 11 | +<form action="index.php?step_name=registration" method="post"> | |
| 12 | + | |
| 13 | +<div class="buttons"> | |
| 14 | + <input type="submit" name="Previous" value="Previous"/> | |
| 15 | + <input type="submit" name="Next" value="Next"/> | |
| 16 | +</div> | |
| 17 | +</form> | |
| 0 | 18 | \ No newline at end of file | ... | ... |
setup/wizard/templates/services.tpl
100644 → 100755
setup/wizard/templates/welcome.tpl
100644 → 100755
setup/wizard/templates/wizard.tpl
100644 → 100755
| ... | ... | @@ -2,8 +2,8 @@ |
| 2 | 2 | <html> |
| 3 | 3 | <head> |
| 4 | 4 | <title>KnowledgeTree Installer</title> |
| 5 | + <script type="text/javascript" src="resources/wizard.js" ></script> | |
| 5 | 6 | <link rel="stylesheet" type="text/css" href="resources/wizard.css" /> |
| 6 | - <script type="text/javascript" src="resources/wizard.js"></script> | |
| 7 | 7 | </head> |
| 8 | 8 | <body onload="w.doFormCheck();"> |
| 9 | 9 | <div id="outer-wrapper"> | ... | ... |