Commit 1adacb8c5816473271dd1d7ddf81f8c76b48509e

Authored by jarrett
1 parent 350839c4

Updated Upgrade Wizard Services

Commited By: Jarrett Jordaan

Reviewed By: Paul Barrett
setup/migrate/migrateWizard.php
@@ -257,7 +257,7 @@ class MigrateWizard { @@ -257,7 +257,7 @@ class MigrateWizard {
257 } 257 }
258 } else { 258 } else {
259 // TODO: Die gracefully 259 // TODO: Die gracefully
260 - $this->util->error("System has been migrated <a href='../../login.php' class='back' style='width:90px;float:none' back button_next>Finish</a>"); 260 + $this->util->error("System has been migrated <a href='../../login.php' class='back' style='width:40px;float:none' back button_next>Finish</a>");
261 } 261 }
262 } 262 }
263 } 263 }
setup/migrate/session.php
@@ -63,7 +63,7 @@ class Session @@ -63,7 +63,7 @@ class Session
63 */ 63 */
64 public function startSession() { 64 public function startSession() {
65 if(!isset($_SESSION[$this->salt]['ready'])) { 65 if(!isset($_SESSION[$this->salt]['ready'])) {
66 - session_start(); 66 + @session_start();
67 $_SESSION[$this->salt] ['ready'] = TRUE; 67 $_SESSION[$this->salt] ['ready'] = TRUE;
68 } 68 }
69 } 69 }
setup/migrate/steps/migrateDatabase.php
@@ -122,16 +122,14 @@ class migrateDatabase extends Step @@ -122,16 +122,14 @@ class migrateDatabase extends Step
122 $manual = false; // If file was exported manually 122 $manual = false; // If file was exported manually
123 $dbSettings = $installation['dbSettings']; 123 $dbSettings = $installation['dbSettings'];
124 $location = $installation['location']; 124 $location = $installation['location'];
125 -// $uname = $this->temp_variables['duname'];  
126 -// $pwrd = $this->temp_variables['dpassword'];  
127 $port = $this->util->getPort($location); 125 $port = $this->util->getPort($location);
128 $tmpFolder = $this->resolveTempDir(); 126 $tmpFolder = $this->resolveTempDir();
129 if(WINDOWS_OS) { 127 if(WINDOWS_OS) {
130 $termOrBash = "command prompt window"; 128 $termOrBash = "command prompt window";
131 - $exe = DS."$location".DS."mysql".DS."bin".DS."mysqldump.exe".DS; // Location of dump 129 + $exe = "\"$location".DS."mysql".DS."bin".DS."mysqldump\""; // Location of dump
132 } else { 130 } else {
133 $termOrBash = "terminal window"; 131 $termOrBash = "terminal window";
134 - $exe = "'$location".DS."mysql".DS."bin".DS."mysqldump'"; // Location of dump 132 + $exe = DS."$location".DS."mysql".DS."bin".DS."mysqldump.exe".DS;
135 } 133 }
136 $date = date('Y-m-d-H-i-s'); 134 $date = date('Y-m-d-H-i-s');
137 if(isset($database['manual_export'])) { 135 if(isset($database['manual_export'])) {
@@ -157,7 +155,11 @@ class migrateDatabase extends Step @@ -157,7 +155,11 @@ class migrateDatabase extends Step
157 } 155 }
158 } 156 }
159 // Handle failed dump 157 // Handle failed dump
160 - $sqlFile = "/tmp/kt-backup-$date.sql"; // Use tmp instead due to permissions 158 + if(WINDOWS_OS) {
  159 + $sqlFile = "/tmp/kt-backup-$date.sql"; // Use tmp instead due to permissions
  160 + } else {
  161 + $sqlFile = "C:\kt-backup-$date.sql"; // Use tmp instead due to permissions
  162 + }
161 $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile; 163 $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile;
162 $this->error[]['error'] = "Could not export database:"; 164 $this->error[]['error'] = "Could not export database:";
163 $this->error[]['msg'] = "Execute the following command in a $termOrBash."; 165 $this->error[]['msg'] = "Execute the following command in a $termOrBash.";
setup/upgrade/lib/UpgradeItems.inc.php
@@ -67,15 +67,15 @@ class Upgrade_Already_Applied { @@ -67,15 +67,15 @@ class Upgrade_Already_Applied {
67 67
68 class UpgradeItem { 68 class UpgradeItem {
69 69
70 - var $type = "";  
71 - var $name;  
72 - var $version;  
73 - var $description;  
74 - var $phase;  
75 - var $priority = 0;  
76 - var $parent;  
77 - var $date;  
78 - var $result; 70 + public $type = "";
  71 + public $name;
  72 + public $version;
  73 + public $description;
  74 + public $phase;
  75 + public $priority = 0;
  76 + public $parent;
  77 + public $date;
  78 + public $result;
79 79
80 function UpgradeItem($name, $version, $description = null, $phase = 0, $priority = 0) { 80 function UpgradeItem($name, $version, $description = null, $phase = 0, $priority = 0) {
81 $this->name = $name; 81 $this->name = $name;
@@ -326,6 +326,7 @@ class SQLUpgradeItem extends UpgradeItem { @@ -326,6 +326,7 @@ class SQLUpgradeItem extends UpgradeItem {
326 326
327 public static function _getDetailsFromFileName($path) { 327 public static function _getDetailsFromFileName($path) {
328 // Old format (pre 2.0.6) 328 // Old format (pre 2.0.6)
  329 + $matches = false;
329 $matched = preg_match('#^([\d.]*)-to-([\d.]*).sql$#', $path, $matches); 330 $matched = preg_match('#^([\d.]*)-to-([\d.]*).sql$#', $path, $matches);
330 if ($matched != 0) { 331 if ($matched != 0) {
331 $fromVersion = $matches[1]; 332 $fromVersion = $matches[1];
@@ -345,6 +346,7 @@ class SQLUpgradeItem extends UpgradeItem { @@ -345,6 +346,7 @@ class SQLUpgradeItem extends UpgradeItem {
345 346
346 //$priority = (int)$matches[4]; 347 //$priority = (int)$matches[4];
347 $priority = 0; 348 $priority = 0;
  349 + $priorities = false;
348 $iPriority = preg_match('#^(.*)-(\d*)$#', $matches[3], $priorities); 350 $iPriority = preg_match('#^(.*)-(\d*)$#', $matches[3], $priorities);
349 if($iPriority != 0){ 351 if($iPriority != 0){
350 $priority = $priorities[2]; 352 $priority = $priorities[2];
setup/upgrade/lib/sqlfile.inc.php
@@ -42,8 +42,8 @@ class SQLFile { @@ -42,8 +42,8 @@ class SQLFile {
42 } 42 }
43 43
44 function splitSQL($sql) { 44 function splitSQL($sql) {
45 - $instring = false;  
46 - $i = 0; 45 +// $instring = false;
  46 +// $i = 0;
47 $remaining = $sql; 47 $remaining = $sql;
48 $query = ""; 48 $query = "";
49 $aQueries = array(); 49 $aQueries = array();
setup/upgrade/session.php
@@ -63,7 +63,7 @@ class session @@ -63,7 +63,7 @@ class session
63 */ 63 */
64 public function startSession() { 64 public function startSession() {
65 if(!isset($_SESSION[$this->salt]['ready'])) { 65 if(!isset($_SESSION[$this->salt]['ready'])) {
66 - session_start(); 66 + @session_start();
67 $_SESSION[$this->salt] ['ready'] = TRUE; 67 $_SESSION[$this->salt] ['ready'] = TRUE;
68 } 68 }
69 } 69 }
setup/upgrade/stepAction.php
@@ -229,12 +229,12 @@ class stepAction { @@ -229,12 +229,12 @@ class stepAction {
229 } else { 229 } else {
230 $this->_clearErrors($this->stepName); // Send Errors to session 230 $this->_clearErrors($this->stepName); // Send Errors to session
231 } 231 }
232 - return $response;  
233 } else { 232 } else {
234 $this->stepName = 'errors'; 233 $this->stepName = 'errors';
235 $this->action = $this->createStep(); 234 $this->action = $this->createStep();
236 $this->action->error = array('Class File Missing in Step Directory'); 235 $this->action->error = array('Class File Missing in Step Directory');
237 } 236 }
  237 + return $response;
238 } 238 }
239 239
240 /** 240 /**
@@ -308,7 +308,7 @@ class stepAction { @@ -308,7 +308,7 @@ class stepAction {
308 $menu = ''; 308 $menu = '';
309 $active = false; 309 $active = false;
310 if($this->stepClassNames) { 310 if($this->stepClassNames) {
311 - foreach ($this->stepClassNames as $k=>$step) { 311 + foreach ($this->stepClassNames as $step) {
312 if($this->step_names[$step] != '') { 312 if($this->step_names[$step] != '') {
313 $item = $this->step_names[$step]; 313 $item = $this->step_names[$step];
314 } else { 314 } else {
@@ -452,7 +452,7 @@ class stepAction { @@ -452,7 +452,7 @@ class stepAction {
452 * @access private 452 * @access private
453 * @return void 453 * @return void
454 */ 454 */
455 - private function _loadValueToSession($class, $k, $v, $overwrite = false) { 455 + private function _loadValueToSession($class, $k, $v) {
456 if($this->session != null) { 456 if($this->session != null) {
457 $this->session->setClass($class, $k, $v); 457 $this->session->setClass($class, $k, $v);
458 } else { 458 } else {
@@ -502,8 +502,7 @@ class stepAction { @@ -502,8 +502,7 @@ class stepAction {
502 * @access private 502 * @access private
503 * @return void 503 * @return void
504 */ 504 */
505 - private function _loadErrorToSession($class, $k, $v, $overwrite = false) {  
506 - $k = "errors"; 505 + private function _loadErrorToSession($class, $k = "errors", $v) {
507 if($this->session != null) { 506 if($this->session != null) {
508 $this->session->setClassError($class, $k, $v); 507 $this->session->setClassError($class, $k, $v);
509 } else { 508 } else {
setup/upgrade/steps/upgradeBackup.php
@@ -188,7 +188,7 @@ class upgradeBackup extends Step { @@ -188,7 +188,7 @@ class upgradeBackup extends Step {
188 { 188 {
189 $adminUser = $this->dbSettings['dbAdminUser']; 189 $adminUser = $this->dbSettings['dbAdminUser'];
190 $adminPwd = $this->dbSettings['dbAdminPass']; 190 $adminPwd = $this->dbSettings['dbAdminPass'];
191 - $dbHost = $this->dbSettings['dbHost']; 191 +// $dbHost = $this->dbSettings['dbHost'];
192 $dbName = $this->dbSettings['dbName']; 192 $dbName = $this->dbSettings['dbName'];
193 193
194 $dbPort = trim($this->dbSettings['dbPort']); 194 $dbPort = trim($this->dbSettings['dbPort']);
setup/upgrade/steps/upgradeComplete.php
@@ -42,19 +42,42 @@ @@ -42,19 +42,42 @@
42 42
43 class upgradeComplete extends Step { 43 class upgradeComplete extends Step {
44 44
45 - protected $silent = false; 45 + protected $silent = true;
46 protected $temp_variables = array(); 46 protected $temp_variables = array();
47 -  
48 - 47 + private $migrateCheck = false;
  48 + private $servicesCheck = 'tick';
  49 +
49 public function doStep() { 50 public function doStep() {
50 $this->temp_variables = array("step_name"=>"complete", "silent"=>$this->silent); 51 $this->temp_variables = array("step_name"=>"complete", "silent"=>$this->silent);
51 -  
52 $this->doRun(); 52 $this->doRun();
  53 + $this->storeSilent();
53 return 'landing'; 54 return 'landing';
54 } 55 }
55 56
56 private function doRun() { 57 private function doRun() {
57 - $this->storeSilent();// Set silent mode variables 58 + if($this->util->isMigration()) {
  59 + $this->storeSilent();// Set silent mode variables
  60 + require_once("../wizard/steps/services.php"); // configuration to read the ini path
  61 + $wizServices = new services();
  62 + foreach ($wizServices->getServices() as $serviceName) {
  63 + $className = OS.$serviceName;
  64 + require_once("../wizard/lib/services/service.php");
  65 + require_once("../wizard/lib/services/".OS."Service.php");
  66 + require_once("../wizard/lib/services/$className.php");
  67 + $aService = new $className();
  68 + $aService->load(); // Load Defaults
  69 + $aService->start(); // Start Service
  70 + $status = $aService->status(); // Get service status
  71 + if($status) {
  72 + $this->temp_variables[$serviceName."Status"] = 'tick';
  73 + } else {
  74 + $this->temp_variables[$serviceName."Status"] = 'cross_orange';
  75 + $this->servicesCheck = 'cross_orange';
  76 + }
  77 + }
  78 + $this->migrateCheck = true;
  79 + }
  80 + return true;
58 } 81 }
59 82
60 /** 83 /**
@@ -64,6 +87,8 @@ class upgradeComplete extends Step { @@ -64,6 +87,8 @@ class upgradeComplete extends Step {
64 protected function storeSilent() { 87 protected function storeSilent() {
65 $v = $this->getDataFromSession('upgradeProperties'); 88 $v = $this->getDataFromSession('upgradeProperties');
66 $this->temp_variables['sysVersion'] = $v['upgrade_version']; 89 $this->temp_variables['sysVersion'] = $v['upgrade_version'];
  90 + $this->temp_variables['migrateCheck'] = $this->migrateCheck;
  91 + $this->temp_variables['servicesCheck'] = $this->servicesCheck;
67 } 92 }
68 93
69 } 94 }
setup/upgrade/steps/upgradeDatabase.php
@@ -135,7 +135,7 @@ class upgradeDatabase extends Step @@ -135,7 +135,7 @@ class upgradeDatabase extends Step
135 private function doRun($action = null) { 135 private function doRun($action = null) {
136 $this->readConfig(); 136 $this->readConfig();
137 137
138 - $con = $this->util->dbUtilities->load($this->dbSettings['dbHost'], $this->dbSettings['dbPort'], $this->dbSettings['dbUser'],$this->dbSettings['dbPass'], $this->dbSettings['dbName']); 138 + $this->util->dbUtilities->load($this->dbSettings['dbHost'], $this->dbSettings['dbPort'], $this->dbSettings['dbUser'],$this->dbSettings['dbPass'], $this->dbSettings['dbName']);
139 $this->temp_variables['action'] = $action; 139 $this->temp_variables['action'] = $action;
140 140
141 if (is_null($action) || ($action == 'preview')) { 141 if (is_null($action) || ($action == 'preview')) {
@@ -238,7 +238,7 @@ class upgradeDatabase extends Step @@ -238,7 +238,7 @@ class upgradeDatabase extends Step
238 $this->temp_variables['detail'] = '<p>The table below describes the upgrades that have occurred to 238 $this->temp_variables['detail'] = '<p>The table below describes the upgrades that have occurred to
239 upgrade your KnowledgeTree installation to <strong>' . $this->sysVersion . '</strong>'; 239 upgrade your KnowledgeTree installation to <strong>' . $this->sysVersion . '</strong>';
240 240
241 - $pre_res = $this->performPreUpgradeActions(); 241 + $this->performPreUpgradeActions();
242 242
243 $res = $this->performAllUpgrades(); 243 $res = $this->performAllUpgrades();
244 if (!$res) { 244 if (!$res) {
@@ -256,7 +256,7 @@ class upgradeDatabase extends Step @@ -256,7 +256,7 @@ class upgradeDatabase extends Step
256 $this->temp_variables['upgradeStatus'] = '<font color="green">Upgrade succeeded.</font>'; 256 $this->temp_variables['upgradeStatus'] = '<font color="green">Upgrade succeeded.</font>';
257 } 257 }
258 258
259 - $post_pres = $this->performPostUpgradeActions(); 259 + $this->performPostUpgradeActions();
260 260
261 261
262 return !$errors; 262 return !$errors;
@@ -311,7 +311,7 @@ class upgradeDatabase extends Step @@ -311,7 +311,7 @@ class upgradeDatabase extends Step
311 311
312 // Ensure all plugins are re-registered. 312 // Ensure all plugins are re-registered.
313 $sql = "TRUNCATE plugin_helper"; 313 $sql = "TRUNCATE plugin_helper";
314 - $res = $this->util->dbUtilities->query($sql); 314 + $this->util->dbUtilities->query($sql);
315 315
316 // Clear out all caches and proxies - they need to be regenerated with the new code 316 // Clear out all caches and proxies - they need to be regenerated with the new code
317 $this->deleteDirectory($this->proxyPath); 317 $this->deleteDirectory($this->proxyPath);
setup/upgrade/steps/upgradeRestore.php
@@ -104,7 +104,7 @@ class upgradeRestore extends Step { @@ -104,7 +104,7 @@ class upgradeRestore extends Step {
104 private function restoreDatabase() 104 private function restoreDatabase()
105 { 105 {
106 $this->temp_variables['restore'] = true; 106 $this->temp_variables['restore'] = true;
107 - $status = $_SESSION['backupStatus']; 107 + //$status = $_SESSION['backupStatus'];
108 $filename = $_SESSION['backupFile']; 108 $filename = $_SESSION['backupFile'];
109 $stmt = $this->util->create_restore_stmt($filename, $this->dbSettings); 109 $stmt = $this->util->create_restore_stmt($filename, $this->dbSettings);
110 $dir = $stmt['dir']; 110 $dir = $stmt['dir'];
@@ -174,7 +174,8 @@ class upgradeRestore extends Step { @@ -174,7 +174,8 @@ class upgradeRestore extends Step {
174 $dir = $this->util->resolveTempDir(); 174 $dir = $this->util->resolveTempDir();
175 175
176 $files = array(); 176 $files = array();
177 - if ($dh = opendir($dir)) 177 + $dh = opendir($dir);
  178 + if ($dh)
178 { 179 {
179 while (($file = readdir($dh)) !== false) 180 while (($file = readdir($dh)) !== false)
180 { 181 {
@@ -210,7 +211,7 @@ class upgradeRestore extends Step { @@ -210,7 +211,7 @@ class upgradeRestore extends Step {
210 return; 211 return;
211 } 212 }
212 213
213 - $status = $_SESSION['backupStatus']; 214 +// $status = $_SESSION['backupStatus'];
214 $filename = $_SESSION['backupFile']; 215 $filename = $_SESSION['backupFile'];
215 $stmt = $this->util->create_restore_stmt($filename, $this->dbSettings); 216 $stmt = $this->util->create_restore_stmt($filename, $this->dbSettings);
216 217
setup/upgrade/steps/upgradeWelcome.php
@@ -49,8 +49,11 @@ class upgradeWelcome extends step { @@ -49,8 +49,11 @@ class upgradeWelcome extends step {
49 49
50 public function doStep() { 50 public function doStep() {
51 $upgradeOnly = false; 51 $upgradeOnly = false;
52 - if(isset($_GET['action'])) if($_GET['action'] == 'installer') $upgradeOnly = true;  
53 -// print_r($_GET['action']); 52 + if(isset($_GET['action'])) {
  53 + if($_GET['action'] == 'installer') {
  54 + $upgradeOnly = true;
  55 + }
  56 + }
54 $this->temp_variables = array("step_name"=>"welcome", "upgradeOnly"=>$upgradeOnly); 57 $this->temp_variables = array("step_name"=>"welcome", "upgradeOnly"=>$upgradeOnly);
55 if($this->next()) { 58 if($this->next()) {
56 if ($this->doRun()) { 59 if ($this->doRun()) {
@@ -114,7 +117,6 @@ class upgradeWelcome extends step { @@ -114,7 +117,6 @@ class upgradeWelcome extends step {
114 if($ass[0]['match_count'] == 1) 117 if($ass[0]['match_count'] == 1)
115 return true; 118 return true;
116 } 119 }
117 - print_r($this->util->dbUtilities);  
118 $this->error[] = 'Could Not Authenticate User'; 120 $this->error[] = 'Could Not Authenticate User';
119 return false; 121 return false;
120 122
setup/upgrade/templates/complete.tpl
@@ -8,6 +8,60 @@ @@ -8,6 +8,60 @@
8 <div> 8 <div>
9 Your database has been upgraded to <?php echo $sysVersion; ?> 9 Your database has been upgraded to <?php echo $sysVersion; ?>
10 </div> 10 </div>
  11 +<br/><br/>
  12 + <?php if($migrateCheck) { ?>
  13 + <div>
  14 + <h3><?php echo "<span class='{$servicesCheck}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Services</h3>
  15 + <?php if($silent) { ?>
  16 + <div id="option2" class="onclick" onclick="javascript:{w.toggleClass('services_check', 'option2');}">Show Details</div>
  17 + <div class="services_check" style="display:none">
  18 + <?php } ?>
  19 + <table style="width:755px;">
  20 + <tr>
  21 + <td style="width:15px;"> <?php echo "<span class='{$LuceneStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?> </td>
  22 + <td style="width:640px;"> Lucene Service <?php if ($LuceneStatus != 'tick') { ?> Could not be started <?php } else { ?> Started <?php } ?></td>
  23 + <?php if ($LuceneStatus != 'tick') { ?>
  24 + <td>
  25 + <?php if (AJAX) { ?>
  26 +<!-- <a href="#" class="refresh" onclick="w.refresh('complete')">Refresh</a>-->
  27 + <?php } else { ?>
  28 +<!-- <a href="javascript:this.location.reload();" class="refresh">Refresh</a>-->
  29 + <?php } ?>
  30 + </td>
  31 + <?php } ?>
  32 + </tr>
  33 + <tr>
  34 + <td> <?php echo "<span class='{$SchedulerStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?> </td>
  35 + <td> Scheduler Service <?php if ($SchedulerStatus != 'tick') { ?> Could not be started <?php } else { ?> Started <?php } ?></td>
  36 + <?php if ($SchedulerStatus != 'tick') { ?>
  37 + <td>
  38 + <?php if (AJAX) { ?>
  39 +<!-- <a href="#" class="refresh" onclick="w.refresh('complete')">Refresh</a>-->
  40 + <?php } else { ?>
  41 +<!-- <a href="javascript:this.location.reload();" class="refresh">Refresh</a>-->
  42 + <?php } ?>
  43 + </td>
  44 + <?php } ?>
  45 + </tr>
  46 + <tr>
  47 + <td> <?php echo "<span class='{$OpenOfficeStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?> </td>
  48 + <td> OpenOffice Service <?php if ($OpenOfficeStatus != 'tick') { ?> Could not be started <?php } else { ?> Started <?php } ?></td>
  49 + <?php if ($OpenOfficeStatus != 'tick') { ?>
  50 + <td>
  51 + <?php if (AJAX) { ?>
  52 +<!-- <a href="#" class="refresh" onclick="w.refresh('complete')">Refresh</a>-->
  53 + <?php } else { ?>
  54 +<!-- <a href="javascript:this.location.reload();" class="refresh">Refresh</a>-->
  55 + <?php } ?>
  56 + </td>
  57 + <?php } ?>
  58 + </tr>
  59 + </table>
  60 + <?php if($silent) { ?>
  61 + </div>
  62 + <?php } ?>
  63 + </div>
  64 + <?php } ?>
11 </div> 65 </div>
12 - <a href="../../login.php" class="back button_next" style="width:90px;" onclick="javascript:{w.clearSessions();}">Finish</a> 66 + <a href="../../login.php" class="back button_next" style="width:40px;" onclick="javascript:{w.clearSessions();}">Finish</a>
13 </form> 67 </form>
14 \ No newline at end of file 68 \ No newline at end of file
setup/upgrade/templates/welcome.tpl
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 <p class="empty_space"> Only administrator users may access the upgrade wizard. </p> 9 <p class="empty_space"> Only administrator users may access the upgrade wizard. </p>
10 <div class="demo"> 10 <div class="demo">
11 <table> 11 <table>
12 - <tr><td>Username</td><td><input name=username></td></tr> 12 + <tr><td>Username</td><td><input id="username" name=username></td></tr>
13 <tr><td>Password</td><td><input name=password type="password"></td></tr> 13 <tr><td>Password</td><td><input name=password type="password"></td></tr>
14 <?php if (!empty($errors)) { ?><tr><td></td><td><span class="error">Could Not Authenticate User</span></td></tr> <?php } ?> 14 <?php if (!empty($errors)) { ?><tr><td></td><td><span class="error">Could Not Authenticate User</span></td></tr> <?php } ?>
15 <?php 15 <?php
@@ -29,4 +29,7 @@ @@ -29,4 +29,7 @@
29 } 29 }
30 ?> 30 ?>
31 <input type="submit" name="Next" value="Next" class="button_next"/> 31 <input type="submit" name="Next" value="Next" class="button_next"/>
32 -</form>  
33 \ No newline at end of file 32 \ No newline at end of file
  33 +</form>
  34 +<script type="text/javascript">
  35 + $('#username').focus();
  36 +</script>
34 \ No newline at end of file 37 \ No newline at end of file
setup/upgrade/upgradeUtil.php
@@ -60,6 +60,19 @@ class UpgradeUtil extends InstallUtil { @@ -60,6 +60,19 @@ class UpgradeUtil extends InstallUtil {
60 return false; 60 return false;
61 } 61 }
62 62
  63 + /**
  64 + * Check if we are migrating an existing installation
  65 + *
  66 + * @author KnowledgeTree Team
  67 + * @access public
  68 + * @return boolean
  69 + */
  70 + public function isMigration() {
  71 + if(file_exists("../wizard/migrate.lock"))
  72 + return true;
  73 + return false;
  74 + }
  75 +
63 public function error($error) { 76 public function error($error) {
64 $template_vars['error'] = $error; 77 $template_vars['error'] = $error;
65 $file = "templates/error.tpl"; 78 $file = "templates/error.tpl";
@@ -122,7 +135,7 @@ class UpgradeUtil extends InstallUtil { @@ -122,7 +135,7 @@ class UpgradeUtil extends InstallUtil {
122 135
123 $adminUser = $dbConfig['dbAdminUser']; 136 $adminUser = $dbConfig['dbAdminUser'];
124 $adminPwd = $dbConfig['dbAdminPass']; 137 $adminPwd = $dbConfig['dbAdminPass'];
125 - $dbHost = $dbConfig['dbHost']; 138 +// $dbHost = $dbConfig['dbHost'];
126 $dbName = $dbConfig['dbName']; 139 $dbName = $dbConfig['dbName'];
127 $dbPort = trim($dbConfig['dbPort']); 140 $dbPort = trim($dbConfig['dbPort']);
128 if ($dbPort=='' || $dbPort=='default')$dbPort = get_cfg_var('mysql.default_port'); 141 if ($dbPort=='' || $dbPort=='default')$dbPort = get_cfg_var('mysql.default_port');
@@ -147,7 +160,8 @@ class UpgradeUtil extends InstallUtil { @@ -147,7 +160,8 @@ class UpgradeUtil extends InstallUtil {
147 $mechanism = "--port=\"$dbPort\""; 160 $mechanism = "--port=\"$dbPort\"";
148 } 161 }
149 162
150 - $tmpdir = $this->resolveTempDir(); 163 +// $tmpdir = $this->resolveTempDir();
  164 + $this->resolveTempDir();
151 165
152 $stmt = $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism drop \"$dbName\"<br/>"; 166 $stmt = $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism drop \"$dbName\"<br/>";
153 $stmt .= $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism create \"$dbName\"<br/>"; 167 $stmt .= $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism create \"$dbName\"<br/>";
setup/upgrade/upgrader.php
@@ -157,7 +157,7 @@ class Upgrader { @@ -157,7 +157,7 @@ class Upgrader {
157 $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name); 157 $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name);
158 } catch (Exception $e) { 158 } catch (Exception $e) {
159 $util = new UpgradeUtil(); 159 $util = new UpgradeUtil();
160 - $util->error("Error reading configuration file: $name"); 160 + $util->error("Error reading configuration file: $e");
161 exit(); 161 exit();
162 } 162 }
163 } 163 }
@@ -431,8 +431,7 @@ class Upgrader { @@ -431,8 +431,7 @@ class Upgrader {
431 if($class->runUpgrade()) { // Check if step needs to be upgraded 431 if($class->runUpgrade()) { // Check if step needs to be upgraded
432 $class->setDataFromSession($className); // Set Session Information 432 $class->setDataFromSession($className); // Set Session Information
433 $class->setPostConfig(); // Set any posted variables 433 $class->setPostConfig(); // Set any posted variables
434 - $response = $class->upgradeStep(); // Run upgrade step  
435 - // TODO : Break on error response 434 + $class->upgradeStep(); // Run upgrade step
436 } 435 }
437 } else { 436 } else {
438 $util = new UpgradeUtil(); 437 $util = new UpgradeUtil();
setup/wizard/installWizard.php
@@ -294,7 +294,7 @@ class InstallWizard { @@ -294,7 +294,7 @@ class InstallWizard {
294 } 294 }
295 } else { 295 } else {
296 // TODO: Die gracefully 296 // TODO: Die gracefully
297 - $this->util->error("System has been installed <a href='../../login.php' class='back' style='width:90px;float:none' class='back button_next'>Finish</a>"); 297 + $this->util->error("System has been installed <a href='../../login.php' class='back' style='width:40px;float:none' class='back button_next'>Finish</a>");
298 } 298 }
299 } 299 }
300 } 300 }
setup/wizard/lib/services/unixScheduler.php
@@ -57,7 +57,7 @@ class unixScheduler extends unixService { @@ -57,7 +57,7 @@ class unixScheduler extends unixService {
57 * @param string 57 * @param string
58 * @return void 58 * @return void
59 */ 59 */
60 - public function load($options = null) { 60 + public function load() {
61 $this->setPhpCli(); 61 $this->setPhpCli();
62 $this->scheduler = 'scheduler'; 62 $this->scheduler = 'scheduler';
63 $this->setSchedulerSource('schedulerTask.sh'); 63 $this->setSchedulerSource('schedulerTask.sh');
@@ -155,6 +155,7 @@ class unixScheduler extends unixService { @@ -155,6 +155,7 @@ class unixScheduler extends unixService {
155 if(is_array($response['out'])) { 155 if(is_array($response['out'])) {
156 if(count($response['out']) > 1) { 156 if(count($response['out']) > 1) {
157 foreach ($response['out'] as $r) { 157 foreach ($response['out'] as $r) {
  158 + $matches = false;
158 preg_match('/grep/', $r, $matches); // Ignore grep 159 preg_match('/grep/', $r, $matches); // Ignore grep
159 if(!$matches) { 160 if(!$matches) {
160 return 'STARTED'; 161 return 'STARTED';
setup/wizard/lib/services/windowsLucene.php
@@ -140,7 +140,7 @@ class windowsLucene extends windowsService { @@ -140,7 +140,7 @@ class windowsLucene extends windowsService {
140 * @param string 140 * @param string
141 * @return void 141 * @return void
142 */ 142 */
143 - public function load($options = null) { 143 + public function load() {
144 $this->setJavaBin(); 144 $this->setJavaBin();
145 $this->setLuceneDIR(SYSTEM_DIR."bin".DS."luceneserver"); 145 $this->setLuceneDIR(SYSTEM_DIR."bin".DS."luceneserver");
146 $this->setLuceneExe("KTLuceneService.exe"); 146 $this->setLuceneExe("KTLuceneService.exe");
@@ -179,7 +179,7 @@ class windowsLucene extends windowsService { @@ -179,7 +179,7 @@ class windowsLucene extends windowsService {
179 * @param string 179 * @param string
180 * @return void 180 * @return void
181 */ 181 */
182 - private function setJavaBin($javaBin = '') { 182 + private function setJavaBin() {
183 if($this->util->zendBridge()) { 183 if($this->util->zendBridge()) {
184 if($this->util->javaBridge()) { 184 if($this->util->javaBridge()) {
185 $this->javaSystem = new Java('java.lang.System'); 185 $this->javaSystem = new Java('java.lang.System');
@@ -391,7 +391,7 @@ class windowsLucene extends windowsService { @@ -391,7 +391,7 @@ class windowsLucene extends windowsService {
391 array_pop($sysdir); 391 array_pop($sysdir);
392 array_pop($sysdir); 392 array_pop($sysdir);
393 $zendsys = ''; 393 $zendsys = '';
394 - foreach ($sysdir as $k=>$v) { 394 + foreach ($sysdir as $v) {
395 $zendsys .= $v.DS; 395 $zendsys .= $v.DS;
396 } 396 }
397 $jvm = $zendsys."jre".DS."bin".DS."client".DS."jvm.dll"; 397 $jvm = $zendsys."jre".DS."bin".DS."client".DS."jvm.dll";
@@ -429,12 +429,12 @@ class windowsLucene extends windowsService { @@ -429,12 +429,12 @@ class windowsLucene extends windowsService {
429 $luceneExe = $this->getLuceneExe(); 429 $luceneExe = $this->getLuceneExe();
430 $luceneSource = $this->getLuceneSource(); 430 $luceneSource = $this->getLuceneSource();
431 $luceneDir = $this->getluceneDir(); 431 $luceneDir = $this->getluceneDir();
432 - $javaJVM = $this->getJavaJVM(); 432 +// $javaJVM = $this->getJavaJVM();
433 if($luceneExe && $luceneSource && $luceneDir) { 433 if($luceneExe && $luceneSource && $luceneDir) {
434 $cmd = "\"{$luceneExe}\""." -install \"".$this->getName()."\" \"".$this->getJavaJVM(). "\" -Djava.class.path=\"".$luceneSource."\"". " -start ".$this->getLuceneServer(). " -out \"".$this->getLuceneOut()."\" -err \"".$this->getLuceneError()."\" -current \"".$luceneDir."\" -auto"; 434 $cmd = "\"{$luceneExe}\""." -install \"".$this->getName()."\" \"".$this->getJavaJVM(). "\" -Djava.class.path=\"".$luceneSource."\"". " -start ".$this->getLuceneServer(). " -out \"".$this->getLuceneOut()."\" -err \"".$this->getLuceneError()."\" -current \"".$luceneDir."\" -auto";
435 if(DEBUG) { 435 if(DEBUG) {
436 echo "$cmd<br/>"; 436 echo "$cmd<br/>";
437 - return ; 437 + return false;
438 } 438 }
439 $response = $this->util->pexec($cmd); 439 $response = $this->util->pexec($cmd);
440 return $response; 440 return $response;
setup/wizard/lib/services/windowsOpenOffice.php
@@ -183,10 +183,11 @@ class windowsOpenOffice extends windowsService { @@ -183,10 +183,11 @@ class windowsOpenOffice extends windowsService {
183 } 183 }
184 184
185 private function setWinservice($winservice = "winserv.exe") { 185 private function setWinservice($winservice = "winserv.exe") {
186 - if(file_exists(SYS_BIN_DIR . $winservice)) 186 + if(file_exists(SYS_BIN_DIR . $winservice)) {
187 $this->winservice = SYS_BIN_DIR . $winservice; 187 $this->winservice = SYS_BIN_DIR . $winservice;
188 - else if(file_exists(SYS_BIN_DIR . "win32" . DS. $winservice)) 188 + } else if(file_exists(SYS_BIN_DIR . "win32" . DS. $winservice)) {
189 $this->winservice = SYS_BIN_DIR . "win32" . DS. $winservice; 189 $this->winservice = SYS_BIN_DIR . "win32" . DS. $winservice;
  190 + }
190 } 191 }
191 192
192 public function getWinservice() { 193 public function getWinservice() {
@@ -206,7 +207,7 @@ class windowsOpenOffice extends windowsService { @@ -206,7 +207,7 @@ class windowsOpenOffice extends windowsService {
206 $cmd = "\"{$this->winservice}\" install $this->name "."-displayname {$this->name} -start auto \"".$binary."\" -headless -invisible -nofirststartwizard -\"accept=socket,host={$this->host},port={$this->port};urp;\"";; 207 $cmd = "\"{$this->winservice}\" install $this->name "."-displayname {$this->name} -start auto \"".$binary."\" -headless -invisible -nofirststartwizard -\"accept=socket,host={$this->host},port={$this->port};urp;\"";;
207 if(DEBUG) { 208 if(DEBUG) {
208 echo "$cmd<br/>"; 209 echo "$cmd<br/>";
209 - return ; 210 + return false;
210 } 211 }
211 $response = $this->util->pexec($cmd); 212 $response = $this->util->pexec($cmd);
212 return $response; 213 return $response;
setup/wizard/lib/services/windowsScheduler.php
@@ -85,7 +85,7 @@ class windowsScheduler extends windowsService { @@ -85,7 +85,7 @@ class windowsScheduler extends windowsService {
85 * @param string 85 * @param string
86 * @return void 86 * @return void
87 */ 87 */
88 - function load($options = null) { 88 + function load() {
89 $this->setSchedulerDIR($this->varDir."bin"); 89 $this->setSchedulerDIR($this->varDir."bin");
90 $this->setSchedulerScriptPath("taskrunner.bat"); 90 $this->setSchedulerScriptPath("taskrunner.bat");
91 $this->setSchedulerSource("schedulerService.php"); 91 $this->setSchedulerSource("schedulerService.php");
@@ -227,7 +227,7 @@ class windowsScheduler extends windowsService { @@ -227,7 +227,7 @@ class windowsScheduler extends windowsService {
227 $cmd = "\"{$this->winservice}\" install $this->name $this->options"; 227 $cmd = "\"{$this->winservice}\" install $this->name $this->options";
228 if(DEBUG) { 228 if(DEBUG) {
229 echo "$cmd<br/>"; 229 echo "$cmd<br/>";
230 - return ; 230 + return false;
231 } 231 }
232 $response = $this->util->pexec($cmd); 232 $response = $this->util->pexec($cmd);
233 return $response; 233 return $response;
setup/wizard/lib/services/windowsService.php
@@ -163,7 +163,7 @@ class windowsService extends Service { @@ -163,7 +163,7 @@ class windowsService extends Service {
163 * @return array 163 * @return array
164 */ 164 */
165 public function restart() { 165 public function restart() {
166 - $response = $this->stop(); 166 + $this->stop();
167 sleep(1); 167 sleep(1);
168 $this->start(); 168 $this->start();
169 } 169 }
setup/wizard/lib/tests/configurationStep.php 0 โ†’ 100644
  1 +<?php
  2 +/**
  3 +* Configuration Step Tests.
  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 +if(isset($_GET['action'])) {
  43 + $func = $_GET['action'];
  44 + if($func != '' && $func != 'installer') {
  45 + require_once("../iniUtilities.php");
  46 + require_once("../step.php");
  47 + require_once("../path.php");
  48 + require_once("../dbUtilities.php");
  49 + require_once("../installUtil.php");
  50 + }
  51 +}
  52 +
  53 +class configurationStep {
  54 +
  55 +}
  56 +
  57 +if(isset($_GET['action'])) {
  58 + $func = $_GET['action'];
  59 + if($func != '' && $func != 'installer') {
  60 + $serv = new configuration();
  61 + $func_call = strtoupper(substr($func,0,1)).substr($func,1);
  62 + $method = "do$func_call";
  63 + $serv->$method();
  64 + }
  65 +}
  66 +?>
0 \ No newline at end of file 67 \ No newline at end of file
setup/wizard/lib/tests/databaseStep.php 0 โ†’ 100644
  1 +<?php
  2 +/**
  3 +* Database Step Tests.
  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 +if(isset($_GET['action'])) {
  44 + $func = $_GET['action'];
  45 + if($func != '') {
  46 + require_once("../step.php");
  47 + require_once("../installUtil.php");
  48 + require_once("../path.php");
  49 + require_once("../dbUtilities.php");
  50 + }
  51 +}
  52 +
  53 +class databaseStep {
  54 +
  55 + public function doCreateSchema() {
  56 + $this->dhost = '127.0.0.1';
  57 + $this->duname = 'root';
  58 + $this->dpassword = 'root';
  59 + $this->dname = 'dms_install';
  60 + $this->dbbinary = 'mysql';
  61 + $this->util->dbUtilities->load($this->dhost, '', $this->duname, $this->dpassword, $this->dname);
  62 + $this->createSchema();
  63 + echo 'Schema loaded<br>';
  64 + }
  65 +}
  66 +
  67 +if(isset($_GET['action'])) {
  68 + $func = $_GET['action'];
  69 + if($func != '') {
  70 + $serv = new database();
  71 + $func_call = strtoupper(substr($func,0,1)).substr($func,1);
  72 + $method = "do$func_call";
  73 + $serv->$method();
  74 + }
  75 +}
  76 +?>
0 \ No newline at end of file 77 \ No newline at end of file
setup/wizard/lib/tests/servicesStep.php 0 โ†’ 100644
  1 +<?php
  2 +/**
  3 +* Services Step Tests.
  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 +if(isset($_GET['action'])) {
  43 + $func = $_GET['action'];
  44 + if($func != '') {
  45 + require_once(WIZARD_DIR. "step.php");
  46 + require_once(WIZARD_DIR. "installUtil.php");
  47 + require_once(WIZARD_DIR. "path.php");
  48 + require_once(WIZARD_DIR. "dbUtilities.php");
  49 + }
  50 +}
  51 +
  52 +class servicesStep {
  53 + /** External Access **/
  54 + public function doDeleteAll() {
  55 + $serverDetails = $this->getServices();
  56 + foreach ($serverDetails as $serviceName) {
  57 + $className = OS.$serviceName;
  58 + require_once("../lib/services/service.php");
  59 + require_once("../lib/services/".OS."Service.php");
  60 + require_once("../lib/services/$className.php");
  61 + $service = new $className();
  62 + $service->uninstall();
  63 + echo "Delete Service {$service->getName()}<br/>";
  64 + echo "Status of service ".$service->status()."<br/>";
  65 + }
  66 + }
  67 +
  68 + public function doInstallAll() {
  69 + $serverDetails = $this->getServices();
  70 + if(!empty($serverDetails)) {
  71 + require_once("../lib/validation/serviceValidation.php");
  72 + require_once("../lib/services/service.php");
  73 + }
  74 + foreach ($serverDetails as $serviceName) {
  75 + $className = OS.$serviceName;
  76 + $serv = strtolower($serviceName); // Linux Systems.
  77 + require_once("../lib/services/".OS."Service.php");
  78 + require_once("../lib/validation/$serv"."Validation.php");
  79 + require_once("../lib/services/$className.php");
  80 + $service = new $className();
  81 + $class = strtolower($serviceName)."Validation";
  82 + $vClass = new $class();
  83 + $passed = $vClass->binaryChecks(); // Run Binary Pre Checks
  84 + $service->load(array('binary'=>$passed));
  85 + $service->install();
  86 + echo "Install Service {$service->getName()}<br/>";
  87 + echo "Status of service ".$service->status()."<br/>";
  88 + }
  89 + }
  90 +
  91 + public function doStatusAll() {
  92 + $serverDetails = $this->getServices();
  93 + foreach ($serverDetails as $serviceName) {
  94 + $className = OS.$serviceName;
  95 + require_once("../lib/services/service.php");
  96 + require_once("../lib/services/".OS."Service.php");
  97 + require_once("../lib/services/$className.php");
  98 + $service = new $className();
  99 + $service->load();
  100 + echo "{$service->getName()} : Status of service = ".$service->status()."<br/>";
  101 + }
  102 + }
  103 +}
  104 +
  105 +if(isset($_GET['action'])) {
  106 + $func = $_GET['action'];
  107 + if(isset($_GET['debug'])) {
  108 + define('DEBUG', $_GET['debug']);
  109 + } else {
  110 + define('DEBUG', 0);
  111 + }
  112 + if($func != '') {
  113 + $serv = new services();
  114 + $func_call = strtoupper(substr($func,0,1)).substr($func,1);
  115 + $method = "do$func_call";
  116 + $serv->$method();
  117 + }
  118 +}
  119 +?>
0 \ No newline at end of file 120 \ No newline at end of file
setup/wizard/lib/tests/tests.php 0 โ†’ 100644
  1 +<?php
  2 +/**
  3 +* Step Tests.
  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 +?>
0 \ No newline at end of file 44 \ No newline at end of file
setup/wizard/session.php
@@ -69,7 +69,7 @@ class Session @@ -69,7 +69,7 @@ class Session
69 */ 69 */
70 public function startSession() { 70 public function startSession() {
71 if(!isset($_SESSION[$this->salt]['ready'])) { 71 if(!isset($_SESSION[$this->salt]['ready'])) {
72 - session_start(); 72 + @session_start();
73 $_SESSION[$this->salt] ['ready'] = TRUE; 73 $_SESSION[$this->salt] ['ready'] = TRUE;
74 } 74 }
75 } 75 }
setup/wizard/steps/configuration.php
@@ -39,18 +39,6 @@ @@ -39,18 +39,6 @@
39 * @package Installer 39 * @package Installer
40 * @version Version 0.1 40 * @version Version 0.1
41 */ 41 */
42 -  
43 -if(isset($_GET['action'])) {  
44 - $func = $_GET['action'];  
45 - if($func != '' && $func != 'installer') {  
46 - require_once("../iniUtilities.php");  
47 - require_once("../step.php");  
48 - require_once("../path.php");  
49 - require_once("../dbUtilities.php");  
50 - require_once("../installUtil.php");  
51 - }  
52 -}  
53 -  
54 class configuration extends Step 42 class configuration extends Step
55 { 43 {
56 private $allConfs; 44 private $allConfs;
@@ -680,26 +668,6 @@ class configuration extends Step @@ -680,26 +668,6 @@ class configuration extends Step
680 * @return boolean 668 * @return boolean
681 */ 669 */
682 private function writeConfigPath($configPath, $configContent) { 670 private function writeConfigPath($configPath, $configContent) {
683 -// $conf = $this->getDataFromSession("configuration"); // get data from the server  
684 -// $paths = $conf['paths'];  
685 -// if(isset($paths['configFile']['path'])) {  
686 -// $configPath = $this->getContentPath();  
687 -// $configContent = $paths['configFile']['path'];  
688 -// } else {  
689 -// $configPath = $this->getContentPath();  
690 -// if(!$configPath) return false;  
691 -// $this->util->iniHandler->load($configPath);  
692 -// $data = $this->util->iniHandler->getFileByLine();  
693 -// $configContent = '';  
694 -// foreach ($data as $k=>$v) {  
695 -// if(preg_match('/config.ini/', $k)) {  
696 -// $configContent = $k;  
697 -// break;  
698 -// }  
699 -// }  
700 -// }  
701 -// print_r($configPath);  
702 -// print_r($configContent);  
703 $fp = fopen($configPath, 'w+'); 671 $fp = fopen($configPath, 'w+');
704 if(fwrite($fp, $configContent)) 672 if(fwrite($fp, $configContent))
705 return true; 673 return true;
@@ -707,19 +675,6 @@ class configuration extends Step @@ -707,19 +675,6 @@ class configuration extends Step
707 } 675 }
708 676
709 private function writeCachePath($cachePath, $cacheContent) { 677 private function writeCachePath($cachePath, $cacheContent) {
710 -// $cachePath = $this->getCachePath();  
711 -// if(!$cachePath) return false;  
712 -// $configPath = $this->getContentPath();  
713 -// if(!$configPath) return false;  
714 -// $this->util->iniHandler->load($configPath);  
715 -// $data = $this->util->iniHandler->getFileByLine();  
716 -// $cacheContent = '';  
717 -// foreach ($data as $k=>$v) {  
718 -// if(preg_match('/cache/', $k)) {  
719 -// $cacheContent = $k;  
720 -// break;  
721 -// }  
722 -// }  
723 $fp = fopen($cachePath, 'w+'); 678 $fp = fopen($cachePath, 'w+');
724 if($cacheContent != '') { 679 if($cacheContent != '') {
725 if(fwrite($fp, $cacheContent)) 680 if(fwrite($fp, $cacheContent))
@@ -753,13 +708,4 @@ class configuration extends Step @@ -753,13 +708,4 @@ class configuration extends Step
753 } 708 }
754 } 709 }
755 710
756 -if(isset($_GET['action'])) {  
757 - $func = $_GET['action'];  
758 - if($func != '' && $func != 'installer') {  
759 - $serv = new configuration();  
760 - $func_call = strtoupper(substr($func,0,1)).substr($func,1);  
761 - $method = "do$func_call";  
762 - $serv->$method();  
763 - }  
764 -}  
765 ?> 711 ?>
766 \ No newline at end of file 712 \ No newline at end of file
setup/wizard/steps/database.php
@@ -40,16 +40,6 @@ @@ -40,16 +40,6 @@
40 * @version Version 0.1 40 * @version Version 0.1
41 */ 41 */
42 42
43 -if(isset($_GET['action'])) {  
44 - $func = $_GET['action'];  
45 - if($func != '') {  
46 - require_once("../step.php");  
47 - require_once("../installUtil.php");  
48 - require_once("../path.php");  
49 - require_once("../dbUtilities.php");  
50 - }  
51 -}  
52 -  
53 class database extends Step 43 class database extends Step
54 { 44 {
55 /** 45 /**
@@ -811,18 +801,6 @@ class database extends Step @@ -811,18 +801,6 @@ class database extends Step
811 } 801 }
812 802
813 /** 803 /**
814 - * Test database connectivity  
815 - *  
816 - * @author KnowledgeTree Team  
817 - * @param none  
818 - * @access public  
819 - * @return boolean  
820 - */  
821 - public function doAjaxTest($host, $uname, $dname) {  
822 -  
823 - }  
824 -  
825 - /**  
826 * Initialize errors to false 804 * Initialize errors to false
827 * 805 *
828 * @author KnowledgeTree Team 806 * @author KnowledgeTree Team
@@ -836,25 +814,6 @@ class database extends Step @@ -836,25 +814,6 @@ class database extends Step
836 } 814 }
837 } 815 }
838 816
839 - public function doCreateSchema() {  
840 - $this->dhost = '127.0.0.1';  
841 - $this->duname = 'root';  
842 - $this->dpassword = 'root';  
843 - $this->dname = 'dms_install';  
844 - $this->dbbinary = 'mysql';  
845 - $this->util->dbUtilities->load($this->dhost, '', $this->duname, $this->dpassword, $this->dname);  
846 - $this->createSchema();  
847 - echo 'Schema loaded<br>';  
848 - }  
849 } 817 }
850 818
851 -if(isset($_GET['action'])) {  
852 - $func = $_GET['action'];  
853 - if($func != '') {  
854 - $serv = new database();  
855 - $func_call = strtoupper(substr($func,0,1)).substr($func,1);  
856 - $method = "do$func_call";  
857 - $serv->$method();  
858 - }  
859 -}  
860 ?> 819 ?>
861 \ No newline at end of file 820 \ No newline at end of file
setup/wizard/steps/services.php
@@ -40,16 +40,6 @@ @@ -40,16 +40,6 @@
40 * @version Version 0.1 40 * @version Version 0.1
41 */ 41 */
42 42
43 -if(isset($_GET['action'])) {  
44 - $func = $_GET['action'];  
45 - if($func != '') {  
46 - require_once("../step.php");  
47 - require_once("../installUtil.php");  
48 - require_once("../path.php");  
49 - require_once("../dbUtilities.php");  
50 - }  
51 -}  
52 -  
53 class services extends Step 43 class services extends Step
54 { 44 {
55 /** 45 /**
@@ -522,7 +512,7 @@ class services extends Step @@ -522,7 +512,7 @@ class services extends Step
522 * @access private 512 * @access private
523 * @return void 513 * @return void
524 */ 514 */
525 - private function storeSilent() { 515 + public function storeSilent() {
526 foreach ($this->getServices() as $service) { 516 foreach ($this->getServices() as $service) {
527 $class = strtolower($service)."Validation"; 517 $class = strtolower($service)."Validation";
528 $serv = $this->$class->storeSilent(); 518 $serv = $this->$class->storeSilent();
@@ -546,71 +536,6 @@ class services extends Step @@ -546,71 +536,6 @@ class services extends Step
546 536
547 return $services; 537 return $services;
548 } 538 }
549 -  
550 - /** External Access **/  
551 - public function doDeleteAll() {  
552 - $serverDetails = $this->getServices();  
553 - foreach ($serverDetails as $serviceName) {  
554 - $className = OS.$serviceName;  
555 - require_once("../lib/services/service.php");  
556 - require_once("../lib/services/".OS."Service.php");  
557 - require_once("../lib/services/$className.php");  
558 - $service = new $className();  
559 - $service->uninstall();  
560 - echo "Delete Service {$service->getName()}<br/>";  
561 - echo "Status of service ".$service->status()."<br/>";  
562 - }  
563 - }  
564 -  
565 - public function doInstallAll() {  
566 - $serverDetails = $this->getServices();  
567 - if(!empty($serverDetails)) {  
568 - require_once("../lib/validation/serviceValidation.php");  
569 - require_once("../lib/services/service.php");  
570 - }  
571 - foreach ($serverDetails as $serviceName) {  
572 - $className = OS.$serviceName;  
573 - $serv = strtolower($serviceName); // Linux Systems.  
574 - require_once("../lib/services/".OS."Service.php");  
575 - require_once("../lib/validation/$serv"."Validation.php");  
576 - require_once("../lib/services/$className.php");  
577 - $service = new $className();  
578 - $class = strtolower($serviceName)."Validation";  
579 - $vClass = new $class();  
580 - $passed = $vClass->binaryChecks(); // Run Binary Pre Checks  
581 - $service->load(array('binary'=>$passed));  
582 - $service->install();  
583 - echo "Install Service {$service->getName()}<br/>";  
584 - echo "Status of service ".$service->status()."<br/>";  
585 - }  
586 - }  
587 -  
588 - public function doStatusAll() {  
589 - $serverDetails = $this->getServices();  
590 - foreach ($serverDetails as $serviceName) {  
591 - $className = OS.$serviceName;  
592 - require_once("../lib/services/service.php");  
593 - require_once("../lib/services/".OS."Service.php");  
594 - require_once("../lib/services/$className.php");  
595 - $service = new $className();  
596 - $service->load();  
597 - echo "{$service->getName()} : Status of service = ".$service->status()."<br/>";  
598 - }  
599 - }  
600 } 539 }
601 540
602 -if(isset($_GET['action'])) {  
603 - $func = $_GET['action'];  
604 - if(isset($_GET['debug'])) {  
605 - define('DEBUG', $_GET['debug']);  
606 - } else {  
607 - define('DEBUG', 0);  
608 - }  
609 - if($func != '') {  
610 - $serv = new services();  
611 - $func_call = strtoupper(substr($func,0,1)).substr($func,1);  
612 - $method = "do$func_call";  
613 - $serv->$method();  
614 - }  
615 -}  
616 ?> 541 ?>
setup/wizard/templates/complete.tpl
@@ -79,9 +79,9 @@ @@ -79,9 +79,9 @@
79 <?php if ($LuceneStatus != 'tick') { ?> 79 <?php if ($LuceneStatus != 'tick') { ?>
80 <td> 80 <td>
81 <?php if (AJAX) { ?> 81 <?php if (AJAX) { ?>
82 - <a href="#" class="refresh" onclick="w.refresh('complete')">Refresh</a> 82 +<!-- <a href="#" class="refresh" onclick="w.refresh('complete')">Refresh</a>-->
83 <?php } else { ?> 83 <?php } else { ?>
84 - <a href="javascript:this.location.reload();" class="refresh">Refresh</a> 84 +<!-- <a href="javascript:this.location.reload();" class="refresh">Refresh</a>-->
85 <?php } ?> 85 <?php } ?>
86 </td> 86 </td>
87 <?php } ?> 87 <?php } ?>
@@ -92,9 +92,9 @@ @@ -92,9 +92,9 @@
92 <?php if ($SchedulerStatus != 'tick') { ?> 92 <?php if ($SchedulerStatus != 'tick') { ?>
93 <td> 93 <td>
94 <?php if (AJAX) { ?> 94 <?php if (AJAX) { ?>
95 - <a href="#" class="refresh" onclick="w.refresh('complete')">Refresh</a> 95 +<!-- <a href="#" class="refresh" onclick="w.refresh('complete')">Refresh</a>-->
96 <?php } else { ?> 96 <?php } else { ?>
97 - <a href="javascript:this.location.reload();" class="refresh">Refresh</a> 97 +<!-- <a href="javascript:this.location.reload();" class="refresh">Refresh</a>-->
98 <?php } ?> 98 <?php } ?>
99 </td> 99 </td>
100 <?php } ?> 100 <?php } ?>
@@ -105,9 +105,9 @@ @@ -105,9 +105,9 @@
105 <?php if ($OpenOfficeStatus != 'tick') { ?> 105 <?php if ($OpenOfficeStatus != 'tick') { ?>
106 <td> 106 <td>
107 <?php if (AJAX) { ?> 107 <?php if (AJAX) { ?>
108 - <a href="#" class="refresh" onclick="w.refresh('complete')">Refresh</a> 108 +<!-- <a href="#" class="refresh" onclick="w.refresh('complete')">Refresh</a>-->
109 <?php } else { ?> 109 <?php } else { ?>
110 - <a href="javascript:this.location.reload();" class="refresh">Refresh</a> 110 +<!-- <a href="javascript:this.location.reload();" class="refresh">Refresh</a>-->
111 <?php } ?> 111 <?php } ?>
112 </td> 112 </td>
113 <?php } ?> 113 <?php } ?>
@@ -134,9 +134,9 @@ @@ -134,9 +134,9 @@
134 $redirect = "http://".$_SERVER['SERVER_NAME'].":$port".$root_url."/admin.php"; 134 $redirect = "http://".$_SERVER['SERVER_NAME'].":$port".$root_url."/admin.php";
135 ?> 135 ?>
136 <?php if($migrate_check) { ?> 136 <?php if($migrate_check) { ?>
137 - <a href="../upgrade/index.php" class="back button_next" style="width:190px;" onclick="javascript:{w.clearSessions();}">Next</a> 137 + <a href="../upgrade/index.php" class="back button_next" style="width:30px;" onclick="javascript:{w.clearSessions();}">Next</a>
138 <?php } else { ?> 138 <?php } else { ?>
139 - <a href="../../login.php?" class="back button_next" style="width:90px;" onclick="javascript:{w.clearSessions();}">Finish</a> 139 + <a href="../../login.php" class="back button_next" style="width:40px;" onclick="javascript:{w.clearSessions();}">Finish</a>
140 <?php } ?> 140 <?php } ?>
141 <?php 141 <?php
142 if ($install_environment == 'Zend') { 142 if ($install_environment == 'Zend') {