Commit c9ab6dcdb85e39440c1f2fef8da0a241dd44c8db

Authored by Paul Barrett
2 parents a1fdda0f 4aa0fc46

Merge branch 'edge' into cmis_checkout

setup/wizard/config/databases.xml
... ... @@ -15,4 +15,8 @@
15 15 <dport>3306</dport>
16 16 <dname>dms</dname>
17 17 <duname>root</duname>
  18 + <dmsadminuser>dmsadminuser</dmsadminuser>
  19 + <dmsaupass>js9281djw</dmsaupass>
  20 + <dmsuser>dmsuser</dmsuser>
  21 + <dmsupass>djw9281js</dmsupass>
18 22 </database>
... ...
setup/wizard/dbUtil.php
... ... @@ -108,7 +108,7 @@ class dbUtil {
108 108 $this->dbhost = $dhost;
109 109 $this->dbuname = $duname;
110 110 $this->dbpassword = $dpassword;
111   - $this->dbconnection = mysql_connect($dhost, $duname, $dpassword);
  111 + $this->dbconnection = @mysql_connect($dhost, $duname, $dpassword);
112 112 if($dbname != '') {
113 113 $this->setDb($dbname);
114 114 $this->useDb($dbname);
... ... @@ -116,7 +116,7 @@ class dbUtil {
116 116 if($this->dbconnection)
117 117 return $this->dbconnection;
118 118 else {
119   - $this->error[] = mysql_error($this->dbconnection);
  119 + $this->error[] = @mysql_error($this->dbconnection);
120 120 return false;
121 121 }
122 122 }
... ... @@ -128,15 +128,15 @@ class dbUtil {
128 128 * @access public
129 129 * @return boolean
130 130 */
131   - public function useDb($dbname) {
  131 + public function useDb($dbname = '') {
132 132 if($dbname != '') {
133 133 $this->setDb($dbname);
134 134 }
135 135  
136   - if(mysql_select_db($this->dbname, $this->dbconnection))
  136 + if(@mysql_select_db($this->dbname, $this->dbconnection))
137 137 return true;
138 138 else {
139   - $this->error[] = mysql_error($this->dbconnection);
  139 + $this->error[] = @mysql_error($this->dbconnection);
140 140 return false;
141 141 }
142 142 }
... ... @@ -153,11 +153,11 @@ class dbUtil {
153 153 * @return object The result of the query.
154 154 */
155 155 public function query($query) {
156   - $result = mysql_query($query, $this->dbconnection);
  156 + $result = @mysql_query($query, $this->dbconnection);
157 157 if($result) {
158 158 return $result;
159 159 } else {
160   - $this->error[] = mysql_error($this->dbconnection);
  160 + $this->error[] = @mysql_error($this->dbconnection);
161 161 return false;
162 162 }
163 163 }
... ... @@ -170,11 +170,11 @@ class dbUtil {
170 170 * @return boolean
171 171 */
172 172 public function execute($query) {
173   - $result = mysql_query($query, $this->dbconnection);
  173 + $result = @mysql_query($query, $this->dbconnection);
174 174 if($result) {
175 175 return true;
176 176 } else {
177   - $this->error[] = mysql_error($this->dbconnection);
  177 + $this->error[] = @mysql_error($this->dbconnection);
178 178 return false;
179 179 }
180 180 }
... ... @@ -187,10 +187,10 @@ class dbUtil {
187 187 * @return object An object representing a data row.
188 188 */
189 189 public function fetchNextObject($result = NULL) {
190   - if ($result == NULL || mysql_num_rows($result) < 1)
  190 + if ($result == NULL || @mysql_num_rows($result) < 1)
191 191 return NULL;
192 192 else
193   - return mysql_fetch_object($result);
  193 + return @mysql_fetch_object($result);
194 194 }
195 195  
196 196 /**
... ... @@ -202,10 +202,10 @@ class dbUtil {
202 202 */
203 203 public function fetchAssoc($result = NULL) {
204 204 $r = array();
205   - if ($result == NULL || mysql_num_rows($result) < 1)
  205 + if ($result == NULL || @mysql_num_rows($result) < 1)
206 206 return NULL;
207 207 else {
208   - $row = mysql_fetch_assoc($result);
  208 + $row = @mysql_fetch_assoc($result);
209 209 while ($row) {
210 210 $r[] = $row;
211 211 }
... ... @@ -221,7 +221,7 @@ class dbUtil {
221 221 * @return void.
222 222 */
223 223 public function close() {
224   - mysql_close($this->dbconnection);
  224 + @mysql_close($this->dbconnection);
225 225 }
226 226  
227 227 /**
... ...
setup/wizard/installUtil.php
... ... @@ -373,7 +373,6 @@ class InstallUtil {
373 373 }
374 374  
375 375 return 'java';
376   -// return array('response'=>$response, 'java'=>'java');
377 376 }
378 377  
379 378 function tryJava2() {
... ... @@ -383,7 +382,6 @@ class InstallUtil {
383 382 }
384 383  
385 384 return 'java';
386   -// return array('response'=>$response, 'java'=>'java');
387 385 }
388 386  
389 387 function tryJava3() {
... ... @@ -396,7 +394,6 @@ class InstallUtil {
396 394 $match = preg_match('/bin/', $r);
397 395 if($match) {
398 396 return preg_replace('/java:/', '', $r);
399   -// return array('response'=>$response, 'java'=>preg_replace('/java:/', '', $r));
400 397 }
401 398 }
402 399 }
... ... @@ -422,6 +419,26 @@ class InstallUtil {
422 419 }
423 420  
424 421 /**
  422 + * Check if user entered location of PHP
  423 + *
  424 + * @author KnowledgeTree Team
  425 + * @param none
  426 + * @access private
  427 + * @return mixed
  428 + */
  429 + public function phpSpecified() {
  430 + if(isset($_POST['php'])) {
  431 + if($_POST['php'] != '') {
  432 + return $_POST['php'];
  433 + } else {
  434 + return false;
  435 + }
  436 + } else {
  437 + return false;
  438 + }
  439 + }
  440 +
  441 + /**
425 442 * Determine the location of JAVA_HOME
426 443 *
427 444 * @author KnowledgeTree Team
... ... @@ -441,6 +458,32 @@ class InstallUtil {
441 458 return $response;
442 459 }
443 460  
  461 + /**
  462 + * Determine the location of PHP
  463 + *
  464 + * @author KnowledgeTree Team
  465 + * @param none
  466 + * @access private
  467 + * @return mixed
  468 + */
  469 + function getPhp() {
  470 + $cmd = "whereis php";
  471 + $response = $this->pexec($cmd);
  472 + if(is_array($response['out'])) {
  473 + if (isset($response['out'][0])) {
  474 + $broke = explode(' ', $response['out'][0]);
  475 + foreach ($broke as $r) {
  476 + $match = preg_match('/bin/', $r);
  477 + if($match) {
  478 + return preg_replace('/php:/', '', $r);
  479 + }
  480 + }
  481 + }
  482 + }
  483 +
  484 + return '';
  485 + }
  486 +
444 487 /**
445 488 * Portably execute a command on any of the supported platforms.
446 489 *
... ...
setup/wizard/installWizard.php
... ... @@ -176,7 +176,7 @@ class InstallWizard {
176 176 * @return void
177 177 */
178 178 private function createInstallFile() {
179   - touch("install");
  179 + @touch("install");
180 180 }
181 181  
182 182 /**
... ... @@ -188,7 +188,7 @@ class InstallWizard {
188 188 * @return void
189 189 */
190 190 private function removeInstallFile() {
191   - unlink("install");
  191 + @unlink("install");
192 192 }
193 193  
194 194 /**
... ...
setup/wizard/installer.php
... ... @@ -114,6 +114,17 @@ class Installer {
114 114 protected $stepConfirmation = false;
115 115  
116 116 /**
  117 + * Flag if a step object needs confirmation
  118 + *
  119 + * @author KnowledgeTree Team
  120 + * @access protected
  121 + * @var boolean
  122 + */
  123 + protected $stepDisplayFirst = false;
  124 +
  125 + private $installerAction = '';
  126 +
  127 + /**
117 128 * Constructs installation object
118 129 *
119 130 * @author KnowledgeTree Team
... ... @@ -273,11 +284,19 @@ class Installer {
273 284 $this->stepAction->setSteps($this->getSteps());
274 285 $this->stepAction->setStepNames($this->getStepNames());
275 286 $this->stepAction->setDisplayConfirm($this->stepConfirmation);
  287 + $this->stepAction->setDisplayFirst($this->stepDisplayFirst());
276 288 $this->stepAction->loadSession($this->session);
277 289  
278 290 return $this->stepAction->doAction();
279 291 }
280 292  
  293 + private function stepDisplayFirst() {
  294 + if($this->installerAction == 'edit')
  295 + return false; //
  296 + $class = $this->stepAction->createStep(); // Get step class
  297 + return $class->displayFirst(); // Check if class needs to display first
  298 + }
  299 +
281 300 /**
282 301 * Set steps class names in string format
283 302 *
... ... @@ -373,7 +392,7 @@ class Installer {
373 392 * @return void
374 393 */
375 394 private function _completeInstall() {
376   - touch("install");
  395 + @touch("install");
377 396 }
378 397  
379 398 /**
... ... @@ -443,20 +462,26 @@ class Installer {
443 462 private function loadNeeded() {
444 463 $this->_readXml(); // Xml steps
445 464 // Make sure session is cleared
446   - $this->_resetSessions();
  465 + $this->_resetSessions();
447 466 $this->_loadFromSessions();
448 467 if(isset($_POST['Next'])) {
  468 + $this->installerAction = 'next';
449 469 $this->response = 'next';
450 470 } elseif (isset($_POST['Previous'])) {
  471 + $this->installerAction = 'previous';
451 472 $this->response = 'previous';
452 473 } elseif (isset($_POST['Confirm'])) {
  474 + $this->installerAction = 'confirm';
453 475 $this->response = 'next';
454 476 } elseif (isset($_POST['Install'])) {
  477 + $this->installerAction = 'install';
455 478 $this->response = 'next';
456 479 } elseif (isset($_POST['Edit'])) {
  480 + $this->installerAction = 'edit';
457 481 $this->response = 'next';
458 482 } else {
459 483 $this->response = '';
  484 + $this->installerAction = '';
460 485 }
461 486 }
462 487  
... ... @@ -480,7 +505,8 @@ class Installer {
480 505 $this->_runStepsInstallers(); // Load landing
481 506 $this->_proceed(); // Load next window
482 507 } elseif ($res == 'confirm') {
483   - $this->stepConfirmation = true;
  508 + if(!$this->stepDisplayFirst())
  509 + $this->stepConfirmation = true;
484 510 $this->_landing();
485 511 } elseif ($res == 'landing') {
486 512 $this->_landing();
... ...
setup/wizard/lib/services/unixLucene.php
... ... @@ -42,7 +42,6 @@
42 42  
43 43 class unixLucene extends unixService {
44 44 public $util;
45   - private $phpDir;
46 45 private $shutdownScript;
47 46 private $indexerDir;
48 47 private $lucenePidFile;
... ... @@ -65,7 +64,6 @@ class unixLucene extends unixService {
65 64 $this->setJavaXmx(512);
66 65 $this->setLuceneSource("ktlucene.jar");
67 66 $this->setLuceneSourceLoc("ktlucene.jar");
68   -// $this->setPhpDir();
69 67 $this->setShutdownScript("shutdown.php");
70 68 }
71 69  
... ... @@ -85,29 +83,6 @@ class unixLucene extends unixService {
85 83 return $this->shutdownScript;
86 84 }
87 85  
88   - private function setPhpDir($phpdir = '') {
89   - if($phpdir == '') {
90   - $cmd = "whereis php";
91   - $response = $this->util->pexec($cmd);
92   - if(is_array($response['out'])) {
93   - $broke = explode(' ', $response['out'][0]);
94   - foreach ($broke as $r) {
95   - $match = preg_match('/bin/', $r);
96   - if($match) {
97   - $this->phpDir = preg_replace('/php:/', '', $r);
98   - }
99   - }
100   - }
101   - return ;
102   - } else {
103   - $this->phpDir = $phpdir;
104   - }
105   - }
106   -
107   - public function getPhpDir() {
108   - return $this->phpDir;
109   - }
110   -
111 86 private function setLucenePidFile($lucenePidFile) {
112 87 $this->lucenePidFile = $lucenePidFile;
113 88 }
... ... @@ -172,7 +147,12 @@ class unixLucene extends unixService {
172 147 }
173 148  
174 149 public function install() {
175   - $this->start();
  150 + $status = $this->status();
  151 + if($status == '') {
  152 + return $this->start();
  153 + } else {
  154 + return $status;
  155 + }
176 156 }
177 157  
178 158 public function status() {
... ... @@ -187,11 +167,11 @@ class unixLucene extends unixService {
187 167 }
188 168 }
189 169 } else {
190   - return 'STOPPED';
  170 + return '';
191 171 }
192 172 }
193 173  
194   - return 'STOPPED';
  174 + return '';
195 175 }
196 176  
197 177 public function uninstall() {
... ...
setup/wizard/lib/services/unixScheduler.php
... ... @@ -41,7 +41,6 @@
41 41 */
42 42  
43 43 class unixScheduler extends unixService {
44   - private $phpDir;
45 44 private $schedulerDir;
46 45 private $schedulerSource;
47 46 private $schedulerSourceLoc;
... ... @@ -109,7 +108,12 @@ class unixScheduler extends unixService {
109 108 }
110 109  
111 110 function install() {
112   - $this->start();
  111 + $status = $this->status();
  112 + if($status == '') {
  113 + return $this->start();
  114 + } else {
  115 + return $status;
  116 + }
113 117 }
114 118  
115 119 function uninstall() {
... ... @@ -134,7 +138,7 @@ class unixScheduler extends unixService {
134 138 }
135 139 }
136 140 } else {
137   - return 'STOPPED';
  141 + return '';
138 142 }
139 143 }
140 144  
... ... @@ -162,6 +166,7 @@ class unixScheduler extends unixService {
162 166 return false;
163 167 }
164 168  
  169 +
165 170  
166 171 }
167 172 ?>
168 173 \ No newline at end of file
... ...
setup/wizard/lib/services/unixService.php
... ... @@ -140,5 +140,7 @@ class unixService extends Service {
140 140 public function cont() {
141 141  
142 142 }
  143 +
  144 +
143 145 }
144 146 ?>
145 147 \ No newline at end of file
... ...
setup/wizard/lib/services/windowsScheduler.php
... ... @@ -78,7 +78,8 @@ class windowsScheduler extends windowsService {
78 78 function load() {
79 79 $this->name = "KTSchedulerTest";
80 80 $this->setSchedulerDIR(SYSTEM_DIR."bin".DS."win32");
81   - $this->setSchedulerScriptPath("taskrunner_test.bat");
  81 +// $this->setSchedulerScriptPath("taskrunner_test.bat");
  82 + $this->setSchedulerScriptPath("taskrunner.bat");
82 83 $this->setSchedulerSource("schedulerService.php");
83 84 }
84 85  
... ... @@ -171,11 +172,15 @@ class windowsScheduler extends windowsService {
171 172 public function install() {
172 173 $state = $this->status();
173 174 if($state == '') {
174   - $fp = fopen($this->getSchedulerScriptPath(), "w+");
175   - $content = "@echo off\n";
176   - $content .= "\"".PHP_DIR."php.exe\" "."\"{$this->getSchedulerSource()}\"";
177   - fwrite($fp, $content);
178   - fclose($fp);
  175 + if(is_readable(SYS_BIN_DIR)) {
  176 + if(!file_exists($this->getSchedulerScriptPath())) {
  177 + $fp = fopen($this->getSchedulerScriptPath(), "w+");
  178 + $content = "@echo off\n";
  179 + $content .= "\"".PHP_DIR."php.exe\" "."\"{$this->getSchedulerSource()}\"";
  180 + fwrite($fp, $content);
  181 + fclose($fp);
  182 + }
  183 + }
179 184 $response = win32_create_service(array(
180 185 'service' => $this->name,
181 186 'display' => $this->name,
... ...
setup/wizard/lib/services/windowsService.php
... ... @@ -69,10 +69,13 @@ class windowsService extends Service {
69 69 * @return array
70 70 */
71 71 public function start() {
72   - $cmd = "sc start {$this->name}";
73   - $response = $this->util->pexec($cmd);
74   -
75   - return $response;
  72 + $status = $this->status();
  73 + if ($status != 'RUNNING') {
  74 + $cmd = "sc start {$this->name}";
  75 + $response = $this->util->pexec($cmd);
  76 + return $response;
  77 + }
  78 + return $status;
76 79 }
77 80  
78 81 /**
... ... @@ -84,9 +87,13 @@ class windowsService extends Service {
84 87 * @return array
85 88 */
86 89 public function stop() {
87   - $cmd = "sc stop {$this->name}";
88   - $response = $this->util->pexec($cmd);
89   - return $response;
  90 + $status = $this->status();
  91 + if ($status != 'STOPPED') {
  92 + $cmd = "sc stop {$this->name}";
  93 + $response = $this->util->pexec($cmd);
  94 + return $response;
  95 + }
  96 + return $status;
90 97 }
91 98  
92 99 public function install() {}
... ... @@ -101,7 +108,7 @@ class windowsService extends Service {
101 108 */
102 109 public function restart() {
103 110 $response = $this->stop();
104   - sleep(1);
  111 + sleep(10);
105 112 $this->start();
106 113 }
107 114  
... ... @@ -114,10 +121,14 @@ class windowsService extends Service {
114 121 * @return array
115 122 */
116 123 public function uninstall() {
117   - $cmd = "sc delete {$this->name}";
118   - $response = $this->util->pexec($cmd);
119   - sleep(1);
120   - return $response;
  124 + $status = $this->status();
  125 + if ($status != '') {
  126 + $cmd = "sc delete {$this->name}";
  127 + $response = $this->util->pexec($cmd);
  128 + sleep(10);
  129 + return $response;
  130 + }
  131 + return $status;
121 132 }
122 133  
123 134 /**
... ...
setup/wizard/path.php
... ... @@ -87,7 +87,7 @@
87 87 }
88 88 define('SYSTEM_ROOT', $asys);
89 89 // Install Type
90   - preg_match('/Zend/', $sys, $matches);
  90 + preg_match('/Zend/', $sys, $matches); // TODO: Dirty
91 91 if($matches) {
92 92 $sysdir = explode(DS, $sys);
93 93 array_pop($sysdir);
... ... @@ -101,12 +101,18 @@
101 101 define('INSTALL_TYPE', 'Zend');
102 102 define('PHP_DIR', $zendsys."ZendServer".DS."bin".DS);
103 103 } else {
104   - // TODO: Other types
  104 + $modules = get_loaded_extensions();
  105 + if(in_array('Zend Monitor', $modules)) { // TODO: Dirty
  106 + define('INSTALL_TYPE', 'Zend');
  107 + define('PHP_DIR', '');
  108 + } else {
  109 + define('INSTALL_TYPE', '');
  110 + define('PHP_DIR', '');
  111 + }
105 112 }
106 113 // Other
107 114 date_default_timezone_set('Africa/Johannesburg');
108   - // Mysql bin [Windows]
109   - if(WINDOWS_OS) {
  115 + if(WINDOWS_OS) { // Mysql bin [Windows]
110 116 $serverPaths = explode(';',$_SERVER['PATH']);
111 117 foreach ($serverPaths as $apath) {
112 118 preg_match('/mysql/i', $apath, $matches);
... ... @@ -115,6 +121,8 @@
115 121 break;
116 122 }
117 123 }
  124 + } else {
  125 + define('MYSQL_BIN', ''); // Assume its linux and can be executed from command line
118 126 }
119 127  
120 128 ?>
... ...
setup/wizard/resources/wizard.js
... ... @@ -133,9 +133,9 @@ wizard.prototype.focusElement = function(el) {
133 133 }
134 134  
135 135 // Catch form submit and validate
136   -wizard.prototype.onSubmitValidate = function() {
  136 +wizard.prototype.onSubmitValidate = function(silent) {
137 137 var response = w.showStep(3, 'n');
138   - if(response == true) {
  138 + if(response == true || silent == true) {
139 139 document.getElementById('sendAll').name = 'Next'; // Force the next step
140 140 document.getElementById('sendAll').value = 'next';
141 141 document.getElementById('dbsettings').submit();
... ...
setup/wizard/step.php
... ... @@ -104,6 +104,7 @@ class Step
104 104 */
105 105 protected $silent = false;
106 106  
  107 + public $displayFirst = false;
107 108 /**
108 109 * Returns step state
109 110 *
... ... @@ -117,6 +118,9 @@ class Step
117 118 return '';
118 119 }
119 120  
  121 + public function displayFirst() {
  122 + return $this->displayFirst;
  123 + }
120 124  
121 125 /**
122 126 * Returns step variables
... ...
setup/wizard/stepAction.php
... ... @@ -69,6 +69,15 @@ class stepAction {
69 69 protected $displayConfirm = false;
70 70  
71 71 /**
  72 + * Returns whether or not to display the confirmation page first
  73 + *
  74 + * @author KnowledgeTree Team
  75 + * @access protected
  76 + * @var boolean
  77 + */
  78 + protected $displayFirst = false;
  79 +
  80 + /**
72 81 * Reference to session object
73 82 *
74 83 * @author KnowledgeTree Team
... ... @@ -122,9 +131,6 @@ class stepAction {
122 131 } else {
123 132 $this->_clearErrors($this->stepName); // Send Errors to session
124 133 }
125   -// if($this->action->silentMode()) {
126   -// return 'silent';
127   -// }
128 134 return $response;
129 135 } else {
130 136 $this->stepName = 'errors';
... ... @@ -278,6 +284,18 @@ class stepAction {
278 284 }
279 285  
280 286 /**
  287 + * Returns whether or not to display the confirmation page first
  288 + *
  289 + * @author KnowledgeTree Team
  290 + * @param none
  291 + * @access public
  292 + * @return boolean
  293 + */
  294 + public function displayFirst() {
  295 + return $this->displayFirst;
  296 + }
  297 +
  298 + /**
281 299 * Sets confirmation page flag
282 300 *
283 301 * @author KnowledgeTree Team
... ... @@ -290,6 +308,18 @@ class stepAction {
290 308 }
291 309  
292 310 /**
  311 + * Sets confirmation page first flag
  312 + *
  313 + * @author KnowledgeTree Team
  314 + * @param boolean
  315 + * @access public
  316 + * @return void
  317 + */
  318 + public function setDisplayFirst($displayFirst) {
  319 + $this->displayFirst = $displayFirst;
  320 + }
  321 +
  322 + /**
293 323 * Sets session object
294 324 *
295 325 * @author KnowledgeTree Team
... ... @@ -326,10 +356,15 @@ class stepAction {
326 356 $top = $this->getTop();
327 357 $step_errors = $this->action->getErrors(); // Get errors
328 358 $step_warnings = $this->action->getWarnings(); // Get warnings
329   - if($this->displayConfirm()) // Check if theres a confirm step
  359 + if($this->displayConfirm()) { // Check if theres a confirm step
330 360 $template = "templates/{$this->stepName}_confirm.tpl";
331   - else
332   - $template = "templates/{$this->stepName}.tpl";
  361 + } else {
  362 + if($this->displayFirst()) {
  363 + $template = "templates/{$this->stepName}_confirm.tpl";
  364 + } else {
  365 + $template = "templates/{$this->stepName}.tpl";
  366 + }
  367 + }
333 368 $step_tpl = new Template($template);
334 369 $step_tpl->set("errors", $step_errors); // Set template errors
335 370 $step_tpl->set("warnings", $step_warnings); // Set template warnings
... ...
setup/wizard/steps/complete.php
... ... @@ -50,10 +50,16 @@ class complete extends Step {
50 50 * @var object
51 51 */
52 52 private $_dbhandler = null;
53   -
54   - private $services_check = 'cross_orange';
  53 +
  54 + /**
  55 + * List of services to check
  56 + *
  57 + * @access private
  58 + * @var array
  59 + */
  60 + private $services_check = 'tick';
55 61 private $paths_check = 'tick';
56   - private $privileges_check = 'cross';
  62 + private $privileges_check = 'tick';
57 63 private $database_check = 'tick';
58 64 protected $silent = true;
59 65  
... ... @@ -108,18 +114,15 @@ class complete extends Step {
108 114 $pathhtml = '<td><div class="%s"></div></td>'
109 115 . '<td>%s</td>'
110 116 . '<td %s>%s</td>';
111   -
112 117 // check paths are writeable
113 118 if(is_array($paths)) {
114 119 foreach ($paths as $path)
115 120 {
116 121 $output = '';
117 122 $result = $this->util->checkPermission($path['path']);
118   - $output = sprintf($html, $result['class'],
119   - $path['path'],
120   - (($result['class'] == 'tick') ? '' : 'error' ),
121   - (($result['class'] == 'tick') ? 'Writeable' : 'Not Writeable' ));
122   -
  123 + $output = sprintf($pathhtml, $result['class'], $path['path'],
  124 + (($result['class'] == 'tick') ? 'class="green"' : 'class="error"' ),
  125 + (($result['class'] == 'tick') ? 'Writeable' : 'Not Writeable' ));
123 126 $this->temp_variables[($path['setting'] != '') ? $path['setting'] : 'config'] = $output;
124 127 if($result['class'] != 'tick') {
125 128 $this->paths_check = $result['class'];
... ... @@ -129,7 +132,6 @@ class complete extends Step {
129 132 $docRoot = $path['path'];
130 133 }
131 134 }
132   -
133 135 }
134 136  
135 137 // check document path internal/external to web root
... ... @@ -198,10 +200,12 @@ class complete extends Step {
198 200 $this->database_check = 'cross';
199 201 $this->temp_variables['dbPrivileges'] .= sprintf($html, 'cross', 'class="error"', 'Unable to do a basic database query<br/>Error: '
200 202 . $this->_dbhandler->getLastError());
  203 + $this->privileges_check = 'cross';
201 204 }
202 205 else
203 206 {
204 207 $this->temp_variables['dbPrivileges'] .= sprintf($html, 'tick', '', 'Basic database query successful');
  208 +
205 209 }
206 210  
207 211 // check transaction support
... ... @@ -228,19 +232,15 @@ class complete extends Step {
228 232  
229 233 private function checkServices()
230 234 {
231   -
232   - // defaults
233   -// $this->temp_variables['LuceneServiceStatus'] = 'cross';
234   -// $this->temp_variables['SchedulerServiceStatus'] = 'cross';
235 235 $services = new services();
236 236 foreach ($services->getServices() as $serviceName) {
237 237 $className = OS.$serviceName;
238 238 $service = new $className();
239 239 $service->load();
240   - if($service->status() != 'RUNNING') {
241   - $this->temp_variables[$serviceName."ServiceStatus"] = 'tick';
  240 + if($service->status() == 'RUNNING' || $service->status() == 'STARTED') {
  241 + $this->temp_variables[$serviceName."Status"] = 'tick';
242 242 } else {
243   - $this->temp_variables[$serviceName."ServiceStatus"] = 'cross_orange';
  243 + $this->temp_variables[$serviceName."Status"] = 'cross_orange';
244 244 $this->services_check = 'cross_orange';
245 245 }
246 246 }
... ...
setup/wizard/steps/configuration.php
... ... @@ -57,6 +57,7 @@ class configuration extends Step
57 57 private $ssl_enabled;
58 58 private $done;
59 59 public $temp_variables = array("step_name"=>"configuration");
  60 + public $displayFirst = true;
60 61 /**
61 62 * Flag to store class information in session
62 63 *
... ... @@ -125,6 +126,7 @@ class configuration extends Step
125 126 $this->doRun();
126 127 return 'landing';
127 128 }
  129 + $this->loadTemplateDefaults();
128 130 if($this->next()) {
129 131 if($this->doRun()) {
130 132 return 'confirm';
... ... @@ -134,9 +136,15 @@ class configuration extends Step
134 136 $this->setDetails();
135 137 return 'previous';
136 138 } else if($this->confirm()) {
137   - return 'next';
  139 + if($this->doRun()) {
  140 + return 'next';
  141 + }
  142 + return 'error';
138 143 } else if($this->edit()) {
139 144 $this->setDetails();
  145 + if($this->doRun()) {
  146 +
  147 + }
140 148 return 'landing';
141 149 }
142 150  
... ... @@ -144,6 +152,10 @@ class configuration extends Step
144 152 return 'landing';
145 153 }
146 154  
  155 + public function loadTemplateDefaults() {
  156 + $this->temp_variables['paths_perms'] = 'tick';
  157 + }
  158 +
147 159 /**
148 160 * Execute the step
149 161 *
... ... @@ -326,19 +338,22 @@ class configuration extends Step
326 338 private function getPathInfo($fileSystemRoot)
327 339 {
328 340 $dirs = $this->getDirectories();
329   - $varDirectory = $fileSystemRoot . DIRECTORY_SEPARATOR . 'var';
330   - $this->temp_variables['paths_perms'] = 'tick';
  341 + $varDirectory = $fileSystemRoot . DS . 'var';
331 342 foreach ($dirs as $key => $dir){
332 343 $path = (isset($_POST[$dir['setting']])) ? $_POST[$dir['setting']] : $dir['path'];
333 344  
334 345 while(preg_match('/\$\{([^}]+)\}/', $path, $matches)){
335 346 $path = str_replace($matches[0], $$matches[1], $path);
336 347 }
  348 + if(WINDOWS_OS)
  349 + $path = preg_replace('/\//', '\\',$path);
337 350  
338   - $dirs[$key]['path'] = $path;
  351 + $dirs[$key]['path'] = $path;
339 352 $class = $this->util->checkPermission($path, $dir['create']);
  353 +
340 354 if($class['class'] != 'tick') {
341 355 $this->temp_variables['paths_perms'] = $class['class'];
  356 + $this->done = false;
342 357 }
343 358 $dirs[$key] = array_merge($dirs[$key], $class);
344 359 }
... ... @@ -363,8 +378,9 @@ class configuration extends Step
363 378 array('name' => 'Log Directory', 'setting' => 'logDirectory', 'path' => '${varDirectory}/log', 'create' => true),
364 379 array('name' => 'Temporary Directory', 'setting' => 'tmpDirectory', 'path' => '${varDirectory}/tmp', 'create' => true),
365 380 array('name' => 'Uploads Directory', 'setting' => 'uploadDirectory', 'path' => '${varDirectory}/uploads', 'create' => true),
  381 + array('name' => 'Executables Directory', 'setting' => 'binDirectory', 'path' => '${fileSystemRoot}/bin', 'create' => false),
366 382 array('name' => 'Configuration File', 'setting' => '', 'path' => '${fileSystemRoot}/config/config.ini', 'create' => false),
367   - );
  383 + );
368 384 }
369 385 }
370 386 ?>
371 387 \ No newline at end of file
... ...
setup/wizard/steps/database.php
... ... @@ -214,6 +214,15 @@ class database extends Step
214 214 public $error = array();
215 215  
216 216 /**
  217 + * List of errors used in template
  218 + *
  219 + * @author KnowledgeTree Team
  220 + * @access public
  221 + * @var array
  222 + */
  223 + public $templateErrors = array('dmspassword', 'dmsuserpassword', 'con', 'dname', 'dtype', 'duname', 'dpassword');
  224 +
  225 + /**
217 226 * Flag to store class information in session
218 227 *
219 228 * @author KnowledgeTree Team
... ... @@ -232,6 +241,15 @@ class database extends Step
232 241 protected $runInstall = true;
233 242  
234 243 /**
  244 + * Flag if step needs to run silently
  245 + *
  246 + * @author KnowledgeTree Team
  247 + * @access public
  248 + * @var array
  249 + */
  250 + protected $silent = true;
  251 +
  252 + /**
235 253 * Constructs database object
236 254 *
237 255 * @author KnowledgeTree Team
... ... @@ -239,6 +257,7 @@ class database extends Step
239 257 * @param none
240 258 */
241 259 public function __construct() {
  260 + $this->temp_variables = array("step_name"=>"database", "silent"=>$this->silent);
242 261 $this->_dbhandler = new dbUtil();
243 262 $this->_util = new InstallUtil();
244 263 if(WINDOWS_OS)
... ... @@ -255,6 +274,7 @@ class database extends Step
255 274 */
256 275 public function doStep() {
257 276 $this->setErrorsFromSession();
  277 + $this->initErrors(); // Load template errors
258 278 if($this->inStep("database")) {
259 279 $res = $this->doProcess();
260 280 if($res) { // If theres a response, return it
... ... @@ -262,10 +282,8 @@ class database extends Step
262 282 }
263 283 }
264 284 if($this->setDataFromSession("database")) { // Attempt to set values from session
265   -
266 285 $this->setDetails(); // Set any posted variables
267 286 } else {
268   -
269 287 $this->loadDefaults($this->readXml()); // Load default variables from file
270 288 }
271 289  
... ... @@ -311,26 +329,36 @@ class database extends Step
311 329 */
312 330 public function doTest() {
313 331 if($this->match($this->dmspassword, $this->getPassword1()) != 0) {
314   - $this->error[] = "Passwords do not match: " . $this->dmspassword." ". $this->getPassword1();
  332 + $this->error['dmspassword'] = "Passwords do not match: " . $this->dmspassword." ". $this->getPassword1();
315 333 return false;
316 334 }
317 335 if($this->match($this->dmsuserpassword, $this->getPassword2()) != 0) {
318   - $this->error[] = "Passwords do not match: " . $this->dmsuserpassword." ". $this->getPassword2();
  336 + $this->error['dmsuserpassword'] = "Passwords do not match: " . $this->dmsuserpassword." ". $this->getPassword2();
319 337 return false;
320 338 }
321   - if($this->dport == '')
  339 + if($this->dport == '') {
322 340 $con = $this->_dbhandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname);
323   - else
  341 + } else {
324 342 $con = $this->_dbhandler->load($this->dhost.":".$this->dport, $this->duname, $this->dpassword, $this->dname);
  343 + }
325 344 if (!$con) {
326   - $this->error[] = "Could not connect";
  345 + $this->error['con'] = "Could not connect, please check username and password";
327 346 return false;
328 347 } else {
329   - $this->error = array(); // Reset usage errors
330   - return true;
  348 + if ($this->dbExists()) { // Check if database Exists
  349 + $this->error['dname'] = 'Database Already Exists, please specify a different name'; // Reset usage errors
  350 + return false;
  351 + } else {
  352 + $this->error = array(); // Reset usage errors
  353 + return true;
  354 + }
331 355 }
332 356 }
333 357  
  358 + public function dbExists() {
  359 + return $this->_dbhandler->useDb();
  360 + }
  361 +
334 362 public function match($str1, $str2) {
335 363 return strcmp($str1, $str2);
336 364 }
... ... @@ -418,10 +446,10 @@ class database extends Step
418 446 $this->temp_variables['dhost'] = (string) $simplexml->dhost;
419 447 $this->temp_variables['dport'] = (string) $simplexml->dport;
420 448 $this->temp_variables['dpassword'] = '';
421   - $this->temp_variables['dmsname'] = '';
422   - $this->temp_variables['dmsusername'] = '';
423   - $this->temp_variables['dmspassword'] = '';
424   - $this->temp_variables['dmsuserpassword'] = '';
  449 + $this->temp_variables['dmsname'] = (string) $simplexml->dmsadminuser;
  450 + $this->temp_variables['dmsusername'] = (string) $simplexml->dmsuser;
  451 + $this->temp_variables['dmspassword'] = (string) $simplexml->dmsaupass;
  452 + $this->temp_variables['dmsuserpassword'] = (string) $simplexml->dmsupass;
425 453 if(WINDOWS_OS) {
426 454 $this->temp_variables['dbbinary'] = 'mysql.exe';
427 455 } else {
... ... @@ -521,7 +549,7 @@ class database extends Step
521 549 */
522 550 private function installDatabase() {
523 551 if($this->dtype == '') {
524   - $this->error[] = 'No database type selected';
  552 + $this->error['dtype'] = 'No database type selected';
525 553 return 'error';
526 554 }
527 555 if(!$this->{$this->dtype}()) {
... ... @@ -541,7 +569,7 @@ class database extends Step
541 569 $con = $this->connectMysql();
542 570 if($con) {
543 571 if(!$this->createDB($con)) {
544   - $this->error[] = "Could not Create Database: ";
  572 + $this->error['con'] = "Could not Create Database: ";
545 573 return false;
546 574 }
547 575 $this->closeMysql($con);
... ... @@ -559,7 +587,7 @@ class database extends Step
559 587 private function connectMysql() {
560 588 $con = $this->_dbhandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname);
561 589 if (!$con) {
562   - $this->error[] = "Could not connect: ";
  590 + $this->error['con'] = "Could not connect: ";
563 591  
564 592 return false;
565 593 }
... ... @@ -579,16 +607,16 @@ class database extends Step
579 607 if($this->usedb($con)) { // attempt to use the db
580 608 if($this->dropdb($con)) { // attempt to drop the db
581 609 if(!$this->create($con)) { // attempt to create the db
582   - $this->error[] = "Could create database: ";
  610 + $this->error['con'] = "Could not create database: ";
583 611 return false;// cannot overwrite database
584 612 }
585 613 } else {
586   - $this->error[] = "Could not drop database: ";
  614 + $this->error['con'] = "Could not drop database: ";
587 615 return false;// cannot overwrite database
588 616 }
589 617 } else {
590 618 if(!$this->create($con)) { // attempt to create the db
591   - $this->error[] = "Could not create database: ";
  619 + $this->error['con'] = "Could not create database: ";
592 620 return false;// cannot overwrite database
593 621 }
594 622 }
... ... @@ -596,13 +624,13 @@ class database extends Step
596 624  
597 625 }
598 626 if(!$this->createSchema($con)) {
599   - $this->error[] = "Could not create schema ";
  627 + $this->error['con'] = "Could not create schema ";
600 628 }
601 629 if(!$this->populateSchema($con)) {
602   - $this->error[] = "Could not populate schema ";
  630 + $this->error['con'] = "Could not populate schema ";
603 631 }
604 632 if(!$this->applyUpgrades($con)) {
605   - $this->error[] = "Could not apply updates ";
  633 + $this->error['con'] = "Could not apply updates ";
606 634 }
607 635  
608 636 return true;
... ... @@ -638,7 +666,7 @@ class database extends Step
638 666 if($this->_dbhandler->useDb($this->dname)) {
639 667 return true;
640 668 } else {
641   - $this->error[] = "Error using database: ";
  669 + $this->error['con'] = "Error using database: {$this->dname}";
642 670 return false;
643 671 }
644 672 }
... ... @@ -655,11 +683,11 @@ class database extends Step
655 683 if($this->ddrop) {
656 684 $sql = "DROP DATABASE {$this->dname};";
657 685 if(!$this->_dbhandler->query($sql)) {
658   - $this->error[] = "Cannot drop database: ";
  686 + $this->error['con'] = "Cannot drop database: {$this->dname}";
659 687 return false;
660 688 }
661 689 } else {
662   - $this->error[] = "Cannot drop database: ";
  690 + $this->error['con'] = "Cannot drop database: {$this->dname}";
663 691 return false;
664 692 }
665 693 return true;
... ... @@ -688,7 +716,7 @@ class database extends Step
688 716 if ($this->_dbhandler->execute($user1) && $this->_dbhandler->execute($user2)) {
689 717 return true;
690 718 } else {
691   - $this->error[] = "Could not create users in database: ";
  719 + $this->error['con'] = "Could not create users for database: {$this->dname}";
692 720 return false;
693 721 }
694 722 }
... ... @@ -756,7 +784,7 @@ class database extends Step
756 784 try {
757 785 $this->_dbhandler->close();
758 786 } catch (Exeption $e) {
759   - $this->error[] = "Could not close: " . $e;
  787 + $this->error['con'] = "Could not close: " . $e;
760 788 }
761 789 }
762 790  
... ... @@ -784,5 +812,19 @@ class database extends Step
784 812 public function doAjaxTest($host, $uname, $dname) {
785 813  
786 814 }
  815 +
  816 + /**
  817 + * Initialize errors to false
  818 + *
  819 + * @author KnowledgeTree Team
  820 + * @param none
  821 + * @access private
  822 + * @return boolean
  823 + */
  824 + private function initErrors() {
  825 + foreach ($this->templateErrors as $e) {
  826 + $this->error[$e] = false;
  827 + }
  828 + }
787 829 }
788 830 ?>
789 831 \ No newline at end of file
... ...
setup/wizard/steps/registration.php
... ... @@ -430,7 +430,7 @@ class registration extends Step
430 430 'RO' => 'ROMANIA',
431 431 'RU' => 'RUSSIAN FEDERATION',
432 432 'RW' => 'RWANDA',
433   - 'BL' => 'SAINT BARTHฦ’LEMY',
  433 + 'BL' => 'SAINT BARTHรฏยฟยฝLEMY',
434 434 'SH' => 'SAINT HELENA',
435 435 'KN' => 'SAINT KITTS AND NEVIS',
436 436 'LC' => 'SAINT LUCIA',
... ...
setup/wizard/steps/services.php
... ... @@ -80,6 +80,24 @@ class services extends Step
80 80 private $javaCheck = 'cross';
81 81  
82 82 /**
  83 + * Flag if services are already Installed
  84 + *
  85 + * @author KnowledgeTree Team
  86 + * @access private
  87 + * @var mixed
  88 + */
  89 + private $alreadyInstalled = false;
  90 +
  91 + /**
  92 + * PHP Installed
  93 + *
  94 + * @author KnowledgeTree Team
  95 + * @access private
  96 + * @var mixed
  97 + */
  98 + private $phpCheck = 'cross_orange';
  99 +
  100 + /**
83 101 * Java Bridge Installed
84 102 *
85 103 * @author KnowledgeTree Team
... ... @@ -104,7 +122,7 @@ class services extends Step
104 122 * @access public
105 123 * @var boolean
106 124 */
107   - protected $storeInSession = false;
  125 + protected $storeInSession = true;
108 126  
109 127 /**
110 128 * List of variables to be loaded to template
... ... @@ -140,9 +158,17 @@ class services extends Step
140 158 * @access public
141 159 * @var mixed
142 160 */
143   - private $javaExeError = false;
  161 + private $javaExeError = '';
144 162  
145 163 /**
  164 + * Holds path error, if php is specified
  165 + *
  166 + * @author KnowledgeTree Team
  167 + * @access public
  168 + * @var mixed
  169 + */
  170 + private $phpExeError = '';
  171 + /**
146 172 * Constructs services object
147 173 *
148 174 * @author KnowledgeTree Team
... ... @@ -205,6 +231,7 @@ class services extends Step
205 231 if($this->java != '') { // Java JRE Found
206 232 $this->javaCheck = 'tick';
207 233 $this->javaInstalled();
  234 + $this->temp_variables['java']['location'] = $this->java;
208 235 }
209 236 }
210 237  
... ... @@ -217,23 +244,64 @@ class services extends Step
217 244 * @return boolean
218 245 */
219 246 private function doRun() {
220   - $this->java = $this->util->getJava(); // Get java, if it exists
221   - $this->javaChecks(); // Run Pre Checks
222   - $errors = $this->getErrors(); // Get errors
223   - if(empty($errors)) { // Install Service if there is no errors
224   - $this->installService();
225   - } else { // Services not installed
226   - foreach ($this->getServices() as $serviceName) {
227   - $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$serviceName." Could not be added as a Service");
  247 + if($this->alreadyInstalled()) {
  248 + $this->alreadyInstalled = true;
  249 + $this->serviceCheck = 'tick';
  250 + } else {
  251 + $this->php = $this->util->getPhp(); // Get java, if it exists
  252 + $this->java = $this->util->getJava(); // Get java, if it exists
  253 + $passedPhp = $this->phpChecks(); // Run Java Pre Checks
  254 + $passedJava = $this->javaChecks(); // Run Java Pre Checks
  255 + $errors = $this->getErrors(); // Get errors
  256 + if(empty($errors) && $passedJava && $passedPhp) { // Install Service if there is no errors
  257 + $this->installServices();
  258 + } elseif ($passedPhp) { // Install Scheduler
  259 + $this->installService('Scheduler');
  260 + } elseif ($passedJava) { // Install Lucene
  261 + $this->installService('Lucene');
  262 + } else { // All Services not installed
228 263 }
229   - $this->serviceCheck = 'cross_orange';
230   - }
  264 + }
  265 + $this->checkServiceStatus();
231 266 $this->storeSilent(); // Store info needed for silent mode
232 267 if(!empty($errors))
233 268 return false;
234 269 return true;
235 270 }
236 271  
  272 + function checkServiceStatus() {
  273 + $serverDetails = $this->getServices();
  274 + foreach ($serverDetails as $serviceName) {
  275 + $className = OS.$serviceName;
  276 + $service = new $className();
  277 + $status = $this->serviceStatus($service);
  278 + if($status != 'STARTED') {
  279 + $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$service->getName()." Could not be added as a Service");
  280 + $this->serviceCheck = 'cross_orange';
  281 + } else {
  282 + if(WINDOWS_OS) {
  283 + $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service"); }
  284 + else {
  285 + $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added and Started as a Service");
  286 + }
  287 + }
  288 + }
  289 + }
  290 +
  291 + function alreadyInstalled() {
  292 + $installed = true;
  293 + $serverDetails = $this->getServices();
  294 + foreach ($serverDetails as $serviceName) {
  295 + $className = OS.$serviceName;
  296 + $service = new $className();
  297 + $status = $this->serviceStatus($service);
  298 + if($status != 'STARTED') {
  299 + return false;
  300 + }
  301 + }
  302 + return true;
  303 + }
  304 +
237 305 /**
238 306 * Do some basic checks to help the user overcome java problems
239 307 *
... ... @@ -251,10 +319,36 @@ class services extends Step
251 319 $this->disableExtension = true; // Disable the use of the php bridge extension
252 320 return $this->detSettings(); // AutoDetect java settings
253 321 } else {
254   - return $this->useBridge(); // Use Bridge to get java settings
  322 + $auto = $this->useBridge(); // Use Bridge to get java settings
  323 + if($auto) {
  324 + return $auto;
  325 + } else {
  326 + $this->specifyJava(); // Ask for settings
  327 + }
  328 + return $auto;
255 329 }
256 330 }
257   -
  331 +
  332 + private function specifyJava() {
  333 + $this->javaExeError = true;
  334 + }
  335 +
  336 + private function specifyPhp() {
  337 + $this->phpExeError = true;
  338 + }
  339 +
  340 + private function phpChecks() {
  341 + // TODO: Better detection
  342 + return true;
  343 + $this->setPhp();
  344 + if($this->util->phpSpecified()) {
  345 + return $this->detPhpSettings();
  346 + } else {
  347 + $this->specifyPhp();// Ask for settings
  348 + return false;
  349 + }
  350 + }
  351 +
258 352 /**
259 353 * Attempts to use user input and configure java settings
260 354 *
... ... @@ -280,18 +374,41 @@ class services extends Step
280 374 $this->javaVersionCorrect();
281 375 $this->javaInstalled();
282 376 $this->javaCheck = 'tick';
  377 +
283 378 return true;
284 379 }
285 380 } else {
286 381 $this->javaVersionWarning();
287 382 $this->javaCheck = 'cross_orange';
288   - $this->javaExeError = "Incorrect path specified";
  383 + $this->javaExeError = "Java : Incorrect path specified";
289 384 $this->error[] = "Requires Java 1.5+ to be installed";
290 385 return false;
291 386 }
292 387 }
293 388 }
294 389  
  390 + function detPhpSettings() {
  391 + // TODO: Better php handling
  392 + return true;
  393 + $phpExecutable = $this->util->phpSpecified();// Retrieve java bin
  394 + $cmd = "$phpExecutable -version > output/outPHP 2>&1 echo $!";
  395 + $response = $this->util->pexec($cmd);
  396 + if(file_exists(OUTPUT_DIR.'outPHP')) {
  397 + $tmp = file_get_contents(OUTPUT_DIR.'outPHP');
  398 + preg_match('/PHP/',$tmp, $matches);
  399 + if($matches) {
  400 + $this->phpCheck = 'tick';
  401 +
  402 + return true;
  403 + } else {
  404 + $this->phpCheck = 'cross_orange';
  405 + $this->phpExeError = "PHP : Incorrect path specified";
  406 + $this->error[] = "PHP executable required";
  407 +
  408 + return false;
  409 + }
  410 + }
  411 + }
295 412 /**
296 413 * Attempts to use bridge and configure java settings
297 414 *
... ... @@ -320,6 +437,7 @@ class services extends Step
320 437 return true;
321 438 }
322 439 } else {
  440 + $this->javaCheck = 'cross_orange';
323 441 $this->javaVersionWarning();
324 442 $this->zendBridgeWarning();
325 443 $this->warnings[] = "Zend Java Bridge Not Functional";
... ... @@ -370,27 +488,36 @@ class services extends Step
370 488 *
371 489 * @author KnowledgeTree Team
372 490 * @param none
373   - * @access public
  491 + * @access private
374 492 * @return boolean
375 493 */
376   - public function installService() {
  494 + private function installServices() {
377 495 foreach ($this->getServices() as $serviceName) {
378   - $className = OS.$serviceName;
379   - $service = new $className();
380   - $status = $this->serviceHelper($service);
381   - if ($status) {
382   - $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service");
383   - } else {
384   - $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$service->getName()." Could not be added as a Service");
385   - $this->serviceCheck = 'cross_orange';
386   - }
  496 + $this->installService($serviceName);
387 497 }
388 498  
389 499 return true;
390 500 }
391 501  
  502 + /**
  503 + * Installs services helper
  504 + *
  505 + * @author KnowledgeTree Team
  506 + * @param none
  507 + * @access private
  508 + * @return boolean
  509 + */
  510 + private function installService($serviceName) {
  511 + $className = OS.$serviceName;
  512 + $service = new $className();
  513 + $status = $this->serviceHelper($service);
  514 + if (!$status) {
  515 + $this->serviceCheck = 'cross_orange';
  516 + }
  517 + }
  518 +
392 519 /**
393   - * Executes services
  520 + * Installs services
394 521 *
395 522 * @author KnowledgeTree Team
396 523 * @param object
... ... @@ -405,6 +532,20 @@ class services extends Step
405 532 }
406 533  
407 534 /**
  535 + * Returns service status
  536 + *
  537 + * @author KnowledgeTree Team
  538 + * @param object
  539 + * @access private
  540 + * @return string
  541 + */
  542 + private function serviceStatus($service) {
  543 + $service->load(); // Load Defaults
  544 + $statusCheck = OS."ServiceInstalled";
  545 + return $this->$statusCheck($service);
  546 + }
  547 +
  548 + /**
408 549 * Check if windows service installed
409 550 *
410 551 * @author KnowledgeTree Team
... ... @@ -414,8 +555,7 @@ class services extends Step
414 555 */
415 556 public function windowsServiceInstalled($service) {
416 557 $status = $service->status(); // Check if service has been installed
417   - if($status != 'STOPPED') { // Check service status
418   - $this->error[] = $service->getName()." Could not be added as a Service";
  558 + if($status == '') { // Check service status
419 559 return false;
420 560 }
421 561 return true;
... ... @@ -432,7 +572,6 @@ class services extends Step
432 572 public function unixServiceInstalled($service) {
433 573 $status = $service->status(); // Check if service has been installed
434 574 if($status != 'STARTED') { // Check service status
435   - $this->error[] = $service->getName()." Could not be added as a Service";
436 575 return false;
437 576 }
438 577 return true;
... ... @@ -451,9 +590,7 @@ class services extends Step
451 590 $className = OS.$serviceName;
452 591 $service = new $className();
453 592 $status = $this->serviceStart($service);
454   -
455 593 }
456   -
457 594 return true;
458 595 }
459 596  
... ... @@ -621,11 +758,29 @@ class services extends Step
621 758 * @return void
622 759 */
623 760 private function storeSilent() {
624   - $this->temp_variables['javaExeError'] = $this->javaExeError;
625   - $this->temp_variables['javaCheck'] = $this->javaCheck;
626   - $this->temp_variables['javaExtCheck'] = $this->javaExtCheck;
627   - $this->temp_variables['serviceCheck'] = $this->serviceCheck;
628   - $this->temp_variables['disableExtension'] = $this->disableExtension;
  761 + $this->temp_variables['alreadyInstalled'] = $this->alreadyInstalled;
  762 + $this->temp_variables['javaExeError'] = $this->javaExeError;
  763 + $this->temp_variables['javaCheck'] = $this->javaCheck;
  764 + $this->temp_variables['javaExtCheck'] = $this->javaExtCheck;
  765 + $this->temp_variables['phpCheck'] = 'tick';//$this->phpCheck;
  766 + $this->temp_variables['phpExeError'] = '';//$this->phpExeError;
  767 + $this->temp_variables['serviceCheck'] = $this->serviceCheck;
  768 + $this->temp_variables['disableExtension'] = $this->disableExtension;
  769 + }
  770 +
  771 + private function setPhp() {
  772 + if($this->php != '') { // PHP Found
  773 + $this->phpCheck = 'tick';
  774 + } elseif (PHP_DIR != '') { // Use System Defined Settings
  775 + $this->php = PHP_DIR;
  776 + } else {
  777 +
  778 + }
  779 + $this->temp_variables['php']['location'] = $this->php;
629 780 }
  781 +
  782 + public function getPhpDir() {
  783 + return $this->php;
  784 + }
630 785 }
631 786 ?>
632 787 \ No newline at end of file
... ...
setup/wizard/templates/complete.tpl
... ... @@ -33,7 +33,6 @@ if($errors || $warnings){
33 33 </div>
34 34 <?php } ?>
35 35 </div>
36   -<br/>
37 36 <div>
38 37 <h3><?php echo "<span class='{$database_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Database connectivity</h3>
39 38 <?php if($silent) { ?>
... ... @@ -60,7 +59,6 @@ if($errors || $warnings){
60 59 </div>
61 60 <?php } ?>
62 61 </div>
63   -<br/>
64 62 <div>
65 63 <h3><?php echo "<span class='{$services_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Services</h3>
66 64 <?php if($silent) { ?>
... ... @@ -68,8 +66,12 @@ if($errors || $warnings){
68 66 <div class="services_check" style="display:none">
69 67 <?php } ?>
70 68 <table>
71   - <tr><?php echo $LuceneServiceStatus; ?></tr>
72   - <tr><?php echo $SchedulerServiceStatus; ?></tr>
  69 + <tr>
  70 + <td><?php echo "<span class='{$LuceneStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Lucene Service</td>
  71 + </tr>
  72 + <tr>
  73 + <td><?php echo "<span class='{$SchedulerStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Scheduler Service</td>
  74 + </tr>
73 75 </table>
74 76 <?php if($silent) { ?>
75 77 </div>
... ...
setup/wizard/templates/configuration.tpl
... ... @@ -55,7 +55,7 @@ The settings below have been drawn from the system information. The host and por
55 55 <div class="paths_perms" style="display:none">
56 56 <?php } ?>
57 57 <p class="description">
58   -The following folders must be writable for KnowledgeTree to be able to run. The permissions on the configuration file can be reset to read-only once the installation has completed.
  58 +The following folders must be writable for KnowledgeTree to be able to run. The permissions on the configuration file may be reset to read-only once the installation has completed.
59 59 </p>
60 60 <table>
61 61 <?php
... ...
setup/wizard/templates/database.tpl
1 1 <h1>Database Configuration</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 id="dbsettings" action="index.php?step_name=<?php echo $step_name; ?>" method="post" onsubmit="w.onSubmitValidate();return false;">
12   -<!--Hidden Fields-->
  2 +<!-- Check For immediate Errors -->
  3 +<span class="error"> <?php if($errors['con']) { echo $errors['con']; } ?> </span>
  4 +<form id="dbsettings" action="index.php?step_name=<?php echo $step_name; ?>" method="post" onsubmit="w.onSubmitValidate(<?php if ($silent) echo 'true'; else echo 'false'; ?>);return false;">
  5 +<!-- Hidden Fields -->
13 6 <input type="hidden" id='ddrop' name="ddrop" <?php echo ($ddrop) ? 'CHECKED' : ''; ?>/>
14 7 <input type="hidden" id="sendAll" name="" value="" />
15 8 <!-- STEP 1 of the database configuration - server settings -->
... ... @@ -30,16 +23,18 @@
30 23 <tr>
31 24 <td><label for='dname'>Enter a name for the database: </label></td>
32 25 <td><input type='text' value="<?php echo $dname?>" id='dname' name='dname' size='40'/></td>
  26 + <td id="error" class="error"><?php if($errors['dname']) echo $errors['dname']; ?></td>
33 27 </tr>
34 28 <tr>
35   - <td><label for='duname'>Enter the username for the Root or Administrative User: </label></td>
  29 + <td><label for='duname'>Enter Database Administrative username: </label></td>
36 30 <td><input type='text' value="<?php echo $duname?>" id='duname' name='duname' size='40' /></td>
  31 + <td id="error" class="error"><?php if($errors['duname']) echo $errors['duname']; ?></td>
37 32 </tr>
38 33 <tr>
39 34 <td><label for='dpassword'>Enter the password for the user: </label></td>
40 35 <td><input type='password' value="<?php echo $dpassword?>" id='dpassword' name='dpassword' size='40' /></td>
  36 + <td id="error" class="error"><?php if($errors['dpassword']) echo $errors['dpassword']; ?></td>
41 37 </tr>
42   -
43 38 </table>
44 39  
45 40 <div id="options" class="onclick" onclick="javascript:{w.toggleClass('adv_options');}">Advanced Options</div>
... ... @@ -68,7 +63,11 @@
68 63 </div>
69 64 <div class="buttons">
70 65 <input type="submit" name="Previous" value="previous" />
  66 + <?php if ($silent) { ?>
  67 + <input type="submit" name="Next" value="next" />
  68 + <?php } else { ?>
71 69 <input type="button" name="Next" value="next" onclick="javascript:{w.showStep(1, 'n');}"/>
  70 + <?php } ?>
72 71 </div>
73 72 </div>
74 73  
... ... @@ -78,19 +77,19 @@
78 77 An administrative user is required for creating tables within the database.
79 78 </div>
80 79 <table class="dbconf">
81   - <tr>
  80 + <tr style="<?php if ($silent) echo 'display:none' ;?>">
82 81 <td><label for='dmsname'>Enter the name of the Database Administrative User: </label></td>
83 82 <td><input type='text' value="<?php echo $dmsname; ?>" id='dmsname' name='dmsname' size='40' /></td>
84 83 <td id="error_1_2" class="error" style="display:none">Please Enter A Username</td>
85 84 </tr>
86 85 <tr>
87   - <td><label for='dmspassword'>Enter a password for the Database Administrative User: </label></td>
  86 + <td><label for='dmspassword'>Enter a password for the Administrative User: </label></td>
88 87 <td><input type='password' value="<?php echo $dmspassword; ?>" id='dmspassword' name='dmspassword' size='40' /></td>
89 88 <td id="error_2_2" class="error" style="display:none">Please Enter A Password</td>
90 89 </tr>
91 90 <tr>
92 91 <td><label for='dmspassword2'>Please confirm the password: </label></td>
93   - <td><input type='password' value="" id='dmspassword2' name='dmspassword2' size='40' /></td>
  92 + <td><input type='password' value="<?php echo $dmspassword; ?>" id='dmspassword2' name='dmspassword2' size='40' /></td>
94 93 <td id="error_3_2" class="error" style="display:none">Please Confirm Password</td>
95 94 <td id="error_4_2" class="error" style="display:none">Passwords Do Not Match</td>
96 95 </tr>
... ... @@ -103,13 +102,13 @@ An administrative user is required for creating tables within the database.
103 102 </div>
104 103  
105 104 <!-- STEP 3 of the database configuration - default user password settings -->
106   -<div id="database" class="step3" style="display:none;":>
  105 +<div id="database" class="step3" style="display:none;">
107 106 <div class="description">
108 107 An second user is required for normal database interaction, the reading and writing of data.
109 108 </div>
110 109  
111 110 <table class="dbconf">
112   - <tr>
  111 + <tr style="<?php if ($silent) echo 'display:none' ;?>">
113 112 <td><label for='dmsusername'>Enter a name for the User: </label></td>
114 113 <td><input type='text' value="<?php echo $dmsusername; ?>" id='dmsusername' name='dmsusername' size='40' /></td>
115 114 <td id="error_1_3" class="error" style="display:none">Please Enter A Username</td>
... ... @@ -121,7 +120,7 @@ An second user is required for normal database interaction, the reading and writ
121 120 </tr>
122 121 <tr>
123 122 <td><label for='dmsuserpassword2'>Please confirm the password: </label></td>
124   - <td><input type='password' value="" id='dmsuserpassword2' name='dmsuserpassword2' size='40' /></td>
  123 + <td><input type='password' value="<?php echo $dmsuserpassword?>" id='dmsuserpassword2' name='dmsuserpassword2' size='40' /></td>
125 124 <td id="error_3_3" class="error" style="display:none">Please Confirm Password</td>
126 125 <td id="error_4_3" class="error" style="display:none">Passwords Do Not Match</td>
127 126 </tr>
... ...
setup/wizard/templates/database_confirm.tpl
... ... @@ -20,9 +20,7 @@ if($dtypes) {
20 20 <td><b>Database type: </b></td>
21 21 <td><?php echo $type; ?></td>
22 22 </tr>
23   - <?php
24   -}
25   -?>
  23 +<?php } ?>
26 24 <tr>
27 25 <td><b>Name: </b></td>
28 26 <td><?php echo $dname; ?></td>
... ... @@ -61,27 +59,33 @@ if($dtypes) {
61 59 <td><b>Mysql Binary: </b></td>
62 60 <td><?php echo $dbbinary; ?></td>
63 61 </tr>
  62 + <?php if (!$silent) { ?>
64 63 <tr>
65 64 <td><b>Table Prefix: </b></td>
66 65 <td><?php echo $tprefix; ?></td>
67 66 </tr>
  67 +<?php } ?>
68 68 </table>
69 69  
70 70 <h3>Database Users</h3>
71 71  
72   -<table width="16%" class="dbconf">
  72 +<table width="46%" class="dbconf">
  73 + <?php //if (!$silent) { ?>
73 74 <tr>
74 75 <td><b>DMS Admin Username: </b></td>
75 76 <td><?php echo $dmsname; ?></td>
76 77 </tr>
  78 + <?php //} ?>
77 79 <tr>
78 80 <td><b>DMS Admin Password: </b></td>
79 81 <td><?php echo $dmspassword; ?></td>
80 82 </tr>
  83 + <?php //if (!$silent) { ?>
81 84 <tr>
82 85 <td><b>DMS User Username: </b></td>
83 86 <td><?php echo $dmsusername; ?></td>
84 87 </tr>
  88 + <?php //} ?>
85 89 <tr>
86 90 <td><b>DMS User Password: </b></td>
87 91 <td><?php echo $dmsuserpassword; ?></td>
... ...
setup/wizard/templates/services.tpl
... ... @@ -11,15 +11,29 @@ if($errors || $warnings){
11 11 . 'Click Here for help on overcoming service issues</a></div><br/>';
12 12 }
13 13 ?>
14   -<?php if($javaExtCheck != 'tick') { ?>
  14 +<?php if(!$alreadyInstalled) { ?>
  15 +<?php if($javaExeError != '') { ?>
15 16 Specify the location of your Java executable
16 17 <br />
17   -<input name='java' id='port' size='25' value=''/>&nbsp;&nbsp;&nbsp;<input type="submit" name="Refresh" value="Submit"/>
  18 +<input name='java' id='port' size='25' value='<?php echo $java['location']; ?>'/>
  19 +&nbsp;&nbsp;&nbsp;
  20 +<?php if($javaExeError != true) { ?><span class="error"><?php echo $javaExeError; ?></span><?php } ?>
  21 +<?php } ?>
  22 +<?php if($phpExeError != '') { ?>
  23 +<br />
  24 +Specify the location of your PHP executable
18 25 <br />
19   -<?php if($javaExeError) { ?>
20   - <span class="error"><?php echo $javaExeError; ?></span>
  26 +<?php if($php['location'] == '') { ?>
  27 + <input name='php' id='port' size='25' value='<?php echo $php['location']; ?>'/>
  28 +<?php } else {?>
  29 + <input type="hidden" name='php' id='port' size='25' value='<?php echo $php['location']; ?>'/>
21 30 <?php } ?>
22   -
  31 +&nbsp;&nbsp;&nbsp;
  32 +<?php if($phpExeError != true) { ?><span class="error"><?php echo $phpExeError; ?></span><?php } ?>
  33 +<?php } ?>
  34 +<?php if($javaExeError != '' || $phpExeError != '') { ?>
  35 +<br />
  36 +<input type="submit" name="Refresh" value="Submit"/>
23 37 <?php } ?>
24 38 <h3><?php echo "<span class='{$javaCheck}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Java Check</h3>
25 39 <?php if($silent) { ?>
... ... @@ -50,6 +64,11 @@ A PHP Java Bridge is required for KnowledgeTree to perform at an optimal level.
50 64 </div>
51 65 <?php } ?>
52 66 <?php } ?>
  67 +<?php } else { ?>
  68 +<p class="description">
  69 +All services are already installed.
  70 +</p>
  71 +<?php } ?>
53 72 <h3><?php echo "<span class='{$serviceCheck}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Services Check</h3>
54 73 <?php if($silent) { ?>
55 74 <div id="options" class="onclick" onclick="javascript:{w.toggleClass('service_details');}">Show Details</div>
... ...