Commit 30e09326f0b815782395ac5e9fec8e8437acec10
Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge
Showing
10 changed files
with
523 additions
and
72 deletions
bin/schedulerTask.sh
0 → 100755
setup/wizard/dbUtil.php
| ... | ... | @@ -111,7 +111,7 @@ class dbUtil { |
| 111 | 111 | $this->dbconnection = mysql_connect($dhost, $duname, $dpassword); |
| 112 | 112 | if($dbname != '') { |
| 113 | 113 | $this->setDb($dbname); |
| 114 | - $this->useBD($dbname); | |
| 114 | + $this->useDb($dbname); | |
| 115 | 115 | } |
| 116 | 116 | if($this->dbconnection) |
| 117 | 117 | return $this->dbconnection; |
| ... | ... | @@ -128,7 +128,7 @@ class dbUtil { |
| 128 | 128 | * @access public |
| 129 | 129 | * @return boolean |
| 130 | 130 | */ |
| 131 | - public function useBD($dbname) { | |
| 131 | + public function useDb($dbname) { | |
| 132 | 132 | if($dbname != '') { |
| 133 | 133 | $this->setDb($dbname); |
| 134 | 134 | } |
| ... | ... | @@ -152,8 +152,7 @@ class dbUtil { |
| 152 | 152 | * @access public |
| 153 | 153 | * @return object The result of the query. |
| 154 | 154 | */ |
| 155 | - public function query($query) | |
| 156 | - { | |
| 155 | + public function query($query) { | |
| 157 | 156 | $result = mysql_query($query, $this->dbconnection); |
| 158 | 157 | if($result) { |
| 159 | 158 | return $result; |
| ... | ... | @@ -230,10 +229,33 @@ class dbUtil { |
| 230 | 229 | * |
| 231 | 230 | * @param none. |
| 232 | 231 | * @access public |
| 233 | - * @return string. | |
| 232 | + * @return array. | |
| 234 | 233 | */ |
| 235 | 234 | public function getErrors() { |
| 236 | 235 | return $this->error; |
| 237 | 236 | } |
| 237 | + | |
| 238 | + /** | |
| 239 | + * Fetches the last generated error | |
| 240 | + | |
| 241 | + * @return string | |
| 242 | + */ | |
| 243 | + function getLastError() { | |
| 244 | + return end($this->error); | |
| 245 | + } | |
| 246 | + | |
| 247 | + /** | |
| 248 | + * Start a database transaction | |
| 249 | + */ | |
| 250 | + public function startTransaction() { | |
| 251 | + $this->query("START TRANSACTION"); | |
| 252 | + } | |
| 253 | + | |
| 254 | + /** | |
| 255 | + * Roll back a database transaction | |
| 256 | + */ | |
| 257 | + public function rollback() { | |
| 258 | + $this->query("ROLLBACK"); | |
| 259 | + } | |
| 238 | 260 | } |
| 239 | 261 | ?> |
| 240 | 262 | \ No newline at end of file | ... | ... |
setup/wizard/installUtil.php
| ... | ... | @@ -385,18 +385,13 @@ class InstallUtil { |
| 385 | 385 | * @return mixed |
| 386 | 386 | */ |
| 387 | 387 | function getJava() { |
| 388 | -// $javaSpecified = $this->javaSpecified(); | |
| 389 | -// if($javaSpecified) { | |
| 390 | -// return $javaSpecified; | |
| 391 | -// } else { | |
| 392 | - $response = $this->tryJava1(); | |
| 393 | - if(!is_array($response)) { | |
| 394 | - $response = $this->tryJava2(); | |
| 395 | - if(!is_array($response)) { | |
| 396 | - $response = $this->tryJava3(); | |
| 397 | - } | |
| 398 | - } | |
| 399 | -// } | |
| 388 | + $response = $this->tryJava1(); | |
| 389 | + if(!is_array($response)) { | |
| 390 | + $response = $this->tryJava2(); | |
| 391 | + if(!is_array($response)) { | |
| 392 | + $response = $this->tryJava3(); | |
| 393 | + } | |
| 394 | + } | |
| 400 | 395 | |
| 401 | 396 | return $response; |
| 402 | 397 | } | ... | ... |
setup/wizard/output/outJV
0 → 100644
setup/wizard/resources/graphics/indicator.pxm deleted
No preview for this file type
setup/wizard/shells/javaVersion.sh
0 → 100644
setup/wizard/steps/complete.php
| ... | ... | @@ -40,15 +40,361 @@ |
| 40 | 40 | * @version Version 0.1 |
| 41 | 41 | */ |
| 42 | 42 | |
| 43 | -class complete extends Step | |
| 44 | -{ | |
| 43 | +class complete extends Step { | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * Reference to Database object | |
| 47 | + * | |
| 48 | + * @author KnowledgeTree Team | |
| 49 | + * @access private | |
| 50 | + * @var object | |
| 51 | + */ | |
| 52 | + private $_dbhandler = null; | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * List of services to check | |
| 56 | + * | |
| 57 | + * @access private | |
| 58 | + * @var array | |
| 59 | + */ | |
| 60 | + private $_services = array('Lucene', 'Scheduler'); | |
| 61 | + | |
| 62 | + public function __construct() { | |
| 63 | + $this->_dbhandler = new dbUtil(); | |
| 64 | + } | |
| 45 | 65 | |
| 46 | 66 | function configure() { |
| 47 | 67 | $this->temp_variables = array("step_name"=>"complete"); |
| 48 | 68 | } |
| 49 | 69 | |
| 50 | 70 | function doStep() { |
| 71 | + $this->doRun(); | |
| 51 | 72 | return 'landing'; |
| 52 | 73 | } |
| 74 | + | |
| 75 | + function doRun() { | |
| 76 | + // check filesystem (including location of document directory and logging) | |
| 77 | + $this->checkFileSystem(); | |
| 78 | + // check database | |
| 79 | + $this->checkDb(); | |
| 80 | + // check services | |
| 81 | + $this->checkServices(); | |
| 82 | + } | |
| 83 | + | |
| 84 | + private function checkFileSystem() | |
| 85 | + { | |
| 86 | + // defaults | |
| 87 | + $this->temp_variables['varDirectory'] = ''; | |
| 88 | + $this->temp_variables['documentRoot'] = ''; | |
| 89 | + $this->temp_variables['logDirectory'] = ''; | |
| 90 | + $this->temp_variables['tmpDirectory'] = ''; | |
| 91 | + $this->temp_variables['uploadDirectory'] = ''; | |
| 92 | + $this->temp_variables['config'] = ''; | |
| 93 | + $this->temp_variables['docLocation'] = ''; | |
| 94 | + | |
| 95 | + $docRoot = ''; | |
| 96 | + | |
| 97 | + // retrieve path information from session | |
| 98 | + $config = $this->getDataFromSession("configuration"); | |
| 99 | + $paths = $config['paths']; | |
| 100 | + | |
| 101 | + $html = '<td><div class="%s"></div></td>' | |
| 102 | + . '<td>%s</td>' | |
| 103 | + . '<td class="%s">%s</td>'; | |
| 104 | + | |
| 105 | + // check paths are writeable | |
| 106 | + foreach ($paths as $path) | |
| 107 | + { | |
| 108 | + $output = ''; | |
| 109 | + | |
| 110 | + $result = $this->checkPermission($path['path']); | |
| 111 | + $output = sprintf($html, $result['class'], | |
| 112 | + $path['path'], | |
| 113 | + (($result['class'] == 'tick') ? '' : 'error' ), | |
| 114 | + (($result['class'] == 'tick') ? 'Writeable' : 'Not Writeable' )); | |
| 115 | + | |
| 116 | + $this->temp_variables[($path['setting'] != '') ? $path['setting'] : 'config'] = $output; | |
| 117 | + | |
| 118 | + // for document location check | |
| 119 | + if ($path['setting'] == 'documentRoot') { | |
| 120 | + $docRoot = $path['path']; | |
| 121 | + } | |
| 122 | + } | |
| 123 | + | |
| 124 | + // check document path internal/external to web root | |
| 125 | + // compare SYSTEM_DIR to root path of documentRoot | |
| 126 | + $sysDir = preg_replace('/\\\\+|\/+/', '\/', SYSTEM_DIR); | |
| 127 | + $docRoot = preg_replace('/\\\\+|\/+/', '\/', $docRoot); | |
| 128 | + if (($pos = strpos($docRoot, $sysDir)) !== false) { | |
| 129 | + $this->temp_variables['docLocation'] = '<td><div class="cross_orange"></div></td>' | |
| 130 | + . '<td class="warning" colspan="2">Your document directory is set to the default, which is inside the web root. ' | |
| 131 | + . 'This may present a security problem if your documents can be accessed from the web, ' | |
| 132 | + . 'working around the permission system in KnowledgeTree.</td>'; | |
| 133 | + } | |
| 134 | + else { | |
| 135 | + $this->temp_variables['docLocation'] = '<td><div class="tick"></div></td>' | |
| 136 | + . '<td>Your document directory is outside the web root.</td>'; | |
| 137 | + } | |
| 138 | + } | |
| 139 | + | |
| 140 | + private function checkDb() | |
| 141 | + { | |
| 142 | + // defaults | |
| 143 | + $this->temp_variables['dbConnectAdmin'] = ''; | |
| 144 | + $this->temp_variables['dbConnectUser'] = ''; | |
| 145 | + $this->temp_variables['dbPrivileges'] = ''; | |
| 146 | + $this->temp_variables['dbTransaction'] = ''; | |
| 147 | + | |
| 148 | +// $html = '<td><div class="%s"></div></td>' | |
| 149 | +// . '<td>%s</td>' | |
| 150 | +// . '<td class="%s">%s</td>'; | |
| 151 | + | |
| 152 | + // retrieve database information from session | |
| 153 | + $dbconf = $this->getDataFromSession("database"); | |
| 154 | + //print_r($dbconf); | |
| 155 | + // make db connection - admin | |
| 156 | + $loaded = $this->_dbhandler->load($dbconf['dhost'], $dbconf['dmsname'], $dbconf['dmspassword'], $dbconf['dname']); | |
| 157 | + if (!$loaded) { | |
| 158 | + $this->temp_variables['dbConnectAdmin'] .= /*sprintf($html, 'cross', | |
| 159 | + $path['path'], | |
| 160 | + (($result['class'] == 'tick') ? '' : 'error' ), | |
| 161 | + (($result['class'] == 'tick') ? 'Writeable' : 'Not Writeable' ));*/ | |
| 162 | + '<td><div class="cross"></div></td>' | |
| 163 | + . '<td class="error">Unable to connect to database (user: ' . $dbconf['dmsname'] . ')</td>'; | |
| 164 | + } | |
| 165 | + else | |
| 166 | + { | |
| 167 | + $this->temp_variables['dbConnectAdmin'] .= '<td><div class="tick" style="float:left;"></div></td>' | |
| 168 | + . '<td>Database connectivity successful (user: ' . $dbconf['dmsname'] . ')</td>'; | |
| 169 | + } | |
| 170 | + | |
| 171 | + // make db connection - user | |
| 172 | + $loaded = $this->_dbhandler->load($dbconf['dhost'], $dbconf['dmsusername'], $dbconf['dmsuserpassword'], $dbconf['dname']); | |
| 173 | + // if we can log in to the database, check access | |
| 174 | + // TODO check write access? | |
| 175 | + if ($loaded) | |
| 176 | + { | |
| 177 | + $this->temp_variables['dbConnectUser'] .= '<td><div class="tick" style="float:left;"></div></td>' | |
| 178 | + . '<td>Database connectivity successful (user: ' . $dbconf['dmsusername'] . ')</td>'; | |
| 179 | + | |
| 180 | + $qresult = $this->_dbhandler->query('SELECT COUNT(id) FROM documents'); | |
| 181 | + if (!$qresult) | |
| 182 | + { | |
| 183 | + $this->temp_variables['dbPrivileges'] .= '<td><div class="cross" style="float:left;"></div></td>' | |
| 184 | + . '<td class="error">' | |
| 185 | + . 'Unable to do a basic database query<br/>Error: ' . $this->_dbhandler->getLastError() | |
| 186 | + . '</td>'; | |
| 187 | + } | |
| 188 | + else | |
| 189 | + { | |
| 190 | + $this->temp_variables['dbPrivileges'] .= '<td><div class="tick" style="float:left;"></div></td><td>Basic database query successful</td>'; | |
| 191 | + } | |
| 192 | + | |
| 193 | + // check transaction support | |
| 194 | + $sTable = 'system_settings'; | |
| 195 | + $this->_dbhandler->startTransaction(); | |
| 196 | + $this->_dbhandler->query('INSERT INTO ' . $sTable . ' (name, value) VALUES ("transactionTest", "1")'); | |
| 197 | + $this->_dbhandler->rollback(); | |
| 198 | + $res = $this->_dbhandler->query("SELECT id FROM $sTable WHERE name = 'transactionTest' LIMIT 1"); | |
| 199 | + if (!$res) { | |
| 200 | + $this->temp_variables['dbTransaction'] = '<td><div class="cross_orange" style="float:left;"></div></td>' | |
| 201 | + . '<span class="error">Transaction support not available in database</span></td>'; | |
| 202 | + } else { | |
| 203 | + $this->temp_variables['dbTransaction'] = '<td><div class="tick" style="float:left;"></div></td><td>Database has transaction support</td>'; | |
| 204 | + } | |
| 205 | + $this->_dbhandler->query('DELETE FROM ' . $sTable . ' WHERE name = "transactionTest"'); | |
| 206 | + } | |
| 207 | + else | |
| 208 | + { | |
| 209 | + $this->temp_variables['dbConnectUser'] .= '<td><div class="cross" style="float:left;"></div></td>' | |
| 210 | + . '<span class="error">Unable to connect to database (user: ' . $dbconf['dmsusername'] . ')</span></td>'; | |
| 211 | + } | |
| 212 | + } | |
| 213 | + | |
| 214 | + private function checkServices() | |
| 215 | + { | |
| 216 | + // defaults | |
| 217 | + $this->temp_variables['luceneServiceStatus'] = ''; | |
| 218 | + $this->temp_variables['schedulerServiceStatus'] = ''; | |
| 219 | + | |
| 220 | + return null; | |
| 221 | + | |
| 222 | + $processOrder = array(); | |
| 223 | + if (strtolower(OS) == 'windows') | |
| 224 | + { | |
| 225 | + $processOrder[] = 'Start'; | |
| 226 | + $processOrder[] = 'Stop'; | |
| 227 | + } | |
| 228 | + else if (strtolower(OS) == 'unix') | |
| 229 | + { | |
| 230 | + $processOrder[] = 'Stop'; | |
| 231 | + $processOrder[] = 'Start'; | |
| 232 | + } | |
| 233 | + | |
| 234 | + // loop through services and attempt to stop and then start them (in the case of Linux,) or start and stop them (in the case of Windows) | |
| 235 | + // (Linux service is started after install, Windows is not) | |
| 236 | + foreach ($this->_services as $serviceName) | |
| 237 | + { | |
| 238 | + // check installed | |
| 239 | + $statusCheck = OS."ServiceInstalled"; | |
| 240 | + $className = OS.$serviceName; | |
| 241 | + $service = new $className(); | |
| 242 | + $installed = $this->$statusCheck($service); | |
| 243 | + if ($installed) { | |
| 244 | + | |
| 245 | + } | |
| 246 | + else { | |
| 247 | + | |
| 248 | + } | |
| 249 | + | |
| 250 | + // check start/stop - different orders dependant on system | |
| 251 | + foreach($processOrder as $operation) | |
| 252 | + { | |
| 253 | +// $opExec = 'service' . $operation; | |
| 254 | +// $opSuccess = $this->$opExec(); | |
| 255 | +// if ($opSuccess) { | |
| 256 | +// | |
| 257 | +// } | |
| 258 | +// else { | |
| 259 | +// | |
| 260 | +// } | |
| 261 | + } | |
| 262 | + } | |
| 263 | + } | |
| 264 | + | |
| 265 | + // these next function are dupes of ones in steps/service.php and steps/configuration.php - abstract these to another class (parent or helper) | |
| 266 | + // and remove from here and original classes | |
| 267 | + | |
| 268 | + /** | |
| 269 | + * Check whether a given directory / file path exists and is writable | |
| 270 | + * | |
| 271 | + * @author KnowledgeTree Team | |
| 272 | + * @access private | |
| 273 | + * @param string $dir The directory / file to check | |
| 274 | + * @param boolean $create Whether to create the directory if it doesn't exist | |
| 275 | + * @return array The message and css class to use | |
| 276 | + */ | |
| 277 | + private function checkPermission($dir, $create=false) | |
| 278 | + { | |
| 279 | + $exist = 'Directory does not exist'; | |
| 280 | + $write = 'Directory is not writable'; | |
| 281 | + $ret = array('class' => 'cross'); | |
| 282 | + | |
| 283 | + if(!file_exists($dir)){ | |
| 284 | + if($create === false){ | |
| 285 | + $this->done = false; | |
| 286 | + $ret['msg'] = $exist; | |
| 287 | + return $ret; | |
| 288 | + } | |
| 289 | + $par_dir = dirname($dir); | |
| 290 | + if(!file_exists($par_dir)){ | |
| 291 | + $this->done = false; | |
| 292 | + $ret['msg'] = $exist; | |
| 293 | + return $ret; | |
| 294 | + } | |
| 295 | + if(!is_writable($par_dir)){ | |
| 296 | + $this->done = false; | |
| 297 | + $ret['msg'] = $exist; | |
| 298 | + return $ret; | |
| 299 | + } | |
| 300 | + mkdir($dir, '0755'); | |
| 301 | + } | |
| 302 | + | |
| 303 | + if(is_writable($dir)){ | |
| 304 | + $ret['class'] = 'tick'; | |
| 305 | + return $ret; | |
| 306 | + } | |
| 307 | + | |
| 308 | + $this->done = false; | |
| 309 | + $ret['msg'] = $write; | |
| 310 | + return $ret; | |
| 311 | + } | |
| 312 | + | |
| 313 | + /** | |
| 314 | + * Check if windows service installed | |
| 315 | + * | |
| 316 | + * @author KnowledgeTree Team | |
| 317 | + * @param object | |
| 318 | + * @access public | |
| 319 | + * @return boolean | |
| 320 | + */ | |
| 321 | + public function windowsServiceInstalled($service) { | |
| 322 | +// print_r($service, true)."<BR>"; | |
| 323 | + $status = $service->status(); // Check if service has been installed | |
| 324 | + echo "STAT: ".$status."<BR>"; | |
| 325 | + if($status != 'STOPPED') { // Check service status | |
| 326 | + $this->error[] = $service->getName()." Could not be added as a WINDOWS Service"; | |
| 327 | + return false; | |
| 328 | + } | |
| 329 | + return true; | |
| 330 | + } | |
| 331 | + | |
| 332 | + /** | |
| 333 | + * Check if unix service installed | |
| 334 | + * | |
| 335 | + * @author KnowledgeTree Team | |
| 336 | + * @param object | |
| 337 | + * @access public | |
| 338 | + * @return boolean | |
| 339 | + */ | |
| 340 | + public function unixServiceInstalled($service) { | |
| 341 | + $status = $service->status(); // Check if service has been installed | |
| 342 | + if($status != 'STARTED') { // Check service status | |
| 343 | + $this->error[] = $service->getName()." Could not be added as a UNIX Service"; | |
| 344 | + return false; | |
| 345 | + } | |
| 346 | + return true; | |
| 347 | + } | |
| 348 | + | |
| 349 | + /** | |
| 350 | + * Starts all services | |
| 351 | + * | |
| 352 | + * @author KnowledgeTree Team | |
| 353 | + * @param object | |
| 354 | + * @access public | |
| 355 | + * @return mixed | |
| 356 | + */ | |
| 357 | + public function installStep() { | |
| 358 | + foreach ($this->services as $serviceName) { | |
| 359 | + $className = OS.$serviceName; | |
| 360 | + $service = new $className(); | |
| 361 | + $status = $this->serviceStart($service); | |
| 362 | + | |
| 363 | + } | |
| 364 | + | |
| 365 | + return true; | |
| 366 | + } | |
| 367 | + | |
| 368 | + /** | |
| 369 | + * Starts service | |
| 370 | + * | |
| 371 | + * @author KnowledgeTree Team | |
| 372 | + * @param object | |
| 373 | + * @access private | |
| 374 | + * @return string | |
| 375 | + */ | |
| 376 | + private function serviceStart($service) { | |
| 377 | + if(OS == 'windows') { | |
| 378 | + $service->load(); // Load Defaults | |
| 379 | + $service->start(); // Start Service | |
| 380 | + return $service->status(); // Get service status | |
| 381 | + } | |
| 382 | + } | |
| 383 | + /** | |
| 384 | + * Stops service | |
| 385 | + * | |
| 386 | + * @author KnowledgeTree Team | |
| 387 | + * @param object | |
| 388 | + * @access private | |
| 389 | + * @return string | |
| 390 | + */ | |
| 391 | + private function serviceStop($service) { | |
| 392 | + if(OS == 'windows') { | |
| 393 | + $service->load(); // Load Defaults | |
| 394 | + $service->stop(); // Stop Service | |
| 395 | + return $service->status(); // Get service status | |
| 396 | + } | |
| 397 | + } | |
| 398 | + | |
| 53 | 399 | } |
| 54 | 400 | ?> |
| 55 | 401 | \ No newline at end of file | ... | ... |
setup/wizard/steps/database.php
| ... | ... | @@ -635,7 +635,7 @@ class database extends Step |
| 635 | 635 | * @return boolean |
| 636 | 636 | */ |
| 637 | 637 | private function usedb($con) { |
| 638 | - if($this->_dbhandler->useBD($this->dname)) { | |
| 638 | + if($this->_dbhandler->useDb($this->dname)) { | |
| 639 | 639 | return true; |
| 640 | 640 | } else { |
| 641 | 641 | $this->error[] = "Error using database: "; | ... | ... |
setup/wizard/steps/services.php
| ... | ... | @@ -86,7 +86,7 @@ class services extends Step |
| 86 | 86 | * @access private |
| 87 | 87 | * @var mixed |
| 88 | 88 | */ |
| 89 | - private $java_ext_check = 'cross'; | |
| 89 | + private $java_ext_check = 'cross_orange'; | |
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * Service Installed |
| ... | ... | @@ -129,12 +129,6 @@ class services extends Step |
| 129 | 129 | $this->util = new InstallUtil(); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - | |
| 133 | - | |
| 134 | -// function getJavaResponse() { | |
| 135 | -// return $this->response; | |
| 136 | -// } | |
| 137 | - | |
| 138 | 132 | /** |
| 139 | 133 | * Main control of services setup |
| 140 | 134 | * |
| ... | ... | @@ -179,81 +173,70 @@ class services extends Step |
| 179 | 173 | $this->temp_variables['services'][] = array('class'=>'cross', 'msg'=>$serviceName." Could not be added as a Service"); |
| 180 | 174 | } |
| 181 | 175 | } |
| 182 | - $this->temp_variables['java_check'] = $this->java_check; | |
| 183 | - $this->temp_variables['java_ext_check'] = $this->java_ext_check; | |
| 184 | - $this->temp_variables['service_check'] = $this->service_check; | |
| 176 | + $this->storeSilent(); | |
| 177 | + | |
| 185 | 178 | $errors = $this->getErrors(); |
| 186 | 179 | if(!empty($errors)) |
| 187 | 180 | return false; |
| 188 | 181 | return true; |
| 189 | 182 | } |
| 190 | - | |
| 191 | - private function detSettings() { | |
| 192 | -// $cmd = $this->java." -version > output/outJV 2>&1 echo $!"; | |
| 193 | -// echo $cmd; | |
| 194 | -// die('bb'); | |
| 195 | -// $response = $this->util->pexec(SHELL_DIR."javaVersion.sh"); | |
| 196 | -// if(file_exists(OUTPUT_DIR.'outJV')) { | |
| 197 | -// $tmp = file_get_contents(OUTPUT_DIR.'outJV'); | |
| 198 | -// echo $tmp; | |
| 199 | -// preg_match('/"(.*)"/',$tmp, $matches); | |
| 200 | -// var_dump($matches); | |
| 201 | -// $fp-> | |
| 202 | -// echo 'a'; | |
| 203 | -// } | |
| 204 | -// var_dump($response); | |
| 205 | -// die('aa'); | |
| 206 | -// var_dump($this->util->pexec($this->java."")); | |
| 207 | -// var_dump($this->util->pexec($this->java." -version")); | |
| 208 | - } | |
| 209 | 183 | |
| 210 | 184 | public function javaChecks() { |
| 211 | - $this->temp_variables['extensions']['class'] = 'cross'; | |
| 212 | - $this->temp_variables['extensions']['found'] = "Zend Java Bridge Required"; | |
| 213 | - $this->temp_variables['version']['class'] = 'cross'; | |
| 214 | - $this->temp_variables['version']['found'] = "Java Runtime Version Incorrect"; | |
| 215 | - $this->temp_variables['java']['class'] = 'cross'; | |
| 216 | - $this->temp_variables['java']['found'] = "Java runtime environment required"; | |
| 185 | + $this->zendBridgeNotInstalled(); | |
| 186 | + $this->javaVersionInCorrect(); // Set version to incorrect | |
| 187 | + $this->javaNotInstalled(); // Set java to not installed | |
| 217 | 188 | if($this->util->javaSpecified()) { |
| 218 | - $this->detSettings(); | |
| 189 | + $this->detSettings(); // AutoDetect java settings | |
| 219 | 190 | } else { |
| 220 | - $this->useBridge(); | |
| 191 | + $this->useBridge(); // Use Bridge to get java settings | |
| 221 | 192 | } |
| 222 | 193 | |
| 223 | 194 | } |
| 224 | 195 | |
| 225 | - function useBridge() { | |
| 196 | + private function detSettings() { | |
| 197 | + $javaExecutable = $this->util->javaSpecified();// Retrieve java bin | |
| 198 | + $cmd = "$javaExecutable -version > output/outJV 2>&1 echo $!"; | |
| 199 | + $response = $this->util->pexec($cmd); | |
| 200 | + if(file_exists(OUTPUT_DIR.'outJV')) { | |
| 201 | + $tmp = file_get_contents(OUTPUT_DIR.'outJV'); | |
| 202 | + preg_match('/"(.*)"/',$tmp, $matches); | |
| 203 | + if($matches[1] < $this->javaVersion) { // Check Version of java | |
| 204 | + $this->javaVersionInCorrect(); | |
| 205 | + $this->error[] = "Requires Java 1.5+ to be installed"; | |
| 206 | + } else { | |
| 207 | + $this->javaVersionCorrect(); | |
| 208 | + $this->javaInstalled(); | |
| 209 | + $this->java_check = 'tick'; | |
| 210 | + } | |
| 211 | + } | |
| 212 | + } | |
| 213 | + | |
| 214 | + private function useBridge() { | |
| 226 | 215 | $zendBridge = $this->zendBridge(); // Find Zend Bridge |
| 227 | 216 | if($zendBridge) { |
| 228 | - $this->temp_variables['extensions']['class'] = 'tick'; | |
| 229 | - $this->temp_variables['extensions']['found'] = "Java Bridge Installed"; | |
| 217 | + $this->zendBridgeInstalled(); | |
| 230 | 218 | if($this->checkZendBridge()) { // Make sure the Zend Bridge is functional |
| 231 | 219 | $javaSystem = new Java('java.lang.System'); |
| 232 | 220 | $version = $javaSystem->getProperty('java.version'); |
| 233 | 221 | $ver = substr($version, 0, 3); |
| 234 | 222 | if($ver < $this->javaVersion) { |
| 235 | - $this->temp_variables['version']['class'] = 'cross'; | |
| 236 | - $this->temp_variables['version']['found'] = "Requires Java 1.5+ to be installed"; | |
| 223 | + $this->javaVersionInCorrect(); | |
| 237 | 224 | $this->error[] = "Requires Java 1.5+ to be installed"; |
| 238 | 225 | } else { |
| 239 | - $this->temp_variables['version']['class'] = 'tick'; | |
| 240 | - $this->temp_variables['version']['found'] = "Java Version 1.5+ Installed"; | |
| 226 | + $this->javaVersionCorrect(); | |
| 241 | 227 | } |
| 242 | 228 | } else { |
| 243 | - $this->warnings[] = "Zend Java Bridge Error"; | |
| 244 | - $this->temp_variables['version']['class'] = 'cross_orange'; | |
| 245 | - $this->temp_variables['version']['found'] = "Java Runtime Version Cannot be detected"; | |
| 246 | - $this->temp_variables['extensions']['class'] = 'cross_orange'; | |
| 247 | - $this->temp_variables['extensions']['found'] = "Zend Java Bridge Error"; | |
| 229 | + $this->javaVersionWarning(); | |
| 230 | + $this->zendBridgeWarning(); | |
| 231 | + $this->warnings[] = "Zend Java Bridge Error"; | |
| 248 | 232 | $this->java_ext_check = 'cross_orange'; |
| 249 | 233 | } |
| 250 | 234 | } else { |
| 251 | 235 | $this->warnings[] = "Zend Java Bridge Required"; |
| 252 | 236 | } |
| 253 | 237 | if($this->java != '') { // Find Java JRE |
| 254 | - $this->temp_variables['java']['class'] = 'tick'; | |
| 255 | - $this->temp_variables['java']['found'] = "Java Runtime Installed"; | |
| 256 | - $this->java_check = 'tick'; | |
| 238 | + $this->javaInstalled(); | |
| 239 | + $this->java_check = 'tick'; | |
| 257 | 240 | } else { |
| 258 | 241 | $this->error[] = "Java runtime environment required"; |
| 259 | 242 | } |
| ... | ... | @@ -436,5 +419,53 @@ class services extends Step |
| 436 | 419 | { |
| 437 | 420 | return $this->temp_variables; |
| 438 | 421 | } |
| 422 | + | |
| 423 | + /* Helpers */ | |
| 424 | + | |
| 425 | + private function javaInstalled() { | |
| 426 | + $this->temp_variables['java']['class'] = 'tick'; | |
| 427 | + $this->temp_variables['java']['found'] = "Java Runtime Installed"; | |
| 428 | + } | |
| 429 | + | |
| 430 | + private function javaNotInstalled() { | |
| 431 | + $this->temp_variables['java']['class'] = 'cross'; | |
| 432 | + $this->temp_variables['java']['found'] = "Java runtime environment required"; | |
| 433 | + } | |
| 434 | + | |
| 435 | + private function javaVersionCorrect() { | |
| 436 | + $this->temp_variables['version']['class'] = 'tick'; | |
| 437 | + $this->temp_variables['version']['found'] = "Java Version 1.5+ Installed"; | |
| 438 | + } | |
| 439 | + | |
| 440 | + private function javaVersionWarning() { | |
| 441 | + $this->temp_variables['version']['class'] = 'cross_orange'; | |
| 442 | + $this->temp_variables['version']['found'] = "Java Runtime Version Cannot be detected"; | |
| 443 | + } | |
| 444 | + | |
| 445 | + private function javaVersionInCorrect() { | |
| 446 | + $this->temp_variables['version']['class'] = 'cross'; | |
| 447 | + $this->temp_variables['version']['found'] = "Requires Java 1.5+ to be installed"; | |
| 448 | + } | |
| 449 | + | |
| 450 | + private function zendBridgeInstalled() { | |
| 451 | + $this->temp_variables['extensions']['class'] = 'tick'; | |
| 452 | + $this->temp_variables['extensions']['found'] = "Java Bridge Installed"; | |
| 453 | + } | |
| 454 | + | |
| 455 | + private function zendBridgeNotInstalled() { | |
| 456 | + $this->temp_variables['extensions']['class'] = 'cross_orange'; | |
| 457 | + $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Installed"; | |
| 458 | + } | |
| 459 | + | |
| 460 | + private function zendBridgeWarning() { | |
| 461 | + $this->temp_variables['extensions']['class'] = 'cross_orange'; | |
| 462 | + $this->temp_variables['extensions']['found'] = "Zend Java Bridge Error"; | |
| 463 | + } | |
| 464 | + | |
| 465 | + private function storeSilent() { | |
| 466 | + $this->temp_variables['java_check'] = $this->java_check; | |
| 467 | + $this->temp_variables['java_ext_check'] = $this->java_ext_check; | |
| 468 | + $this->temp_variables['service_check'] = $this->service_check; | |
| 469 | + } | |
| 439 | 470 | } |
| 440 | 471 | ?> |
| 441 | 472 | \ No newline at end of file | ... | ... |
setup/wizard/templates/complete.tpl
| 1 | 1 | <h1>Installation Completed</h1> |
| 2 | 2 | |
| 3 | +<h2>KnowledgeTree post-configuration checkup</h2> | |
| 4 | + | |
| 5 | +<p>This allows you to check that your KnowledgeTree configuration is set | |
| 6 | +up correctly. You can run this at any time after configuration to check | |
| 7 | +that things are still set up correctly.</p> | |
| 8 | + | |
| 3 | 9 | <div class="errors"> |
| 4 | 10 | <?php if(isset($errors)) { |
| 5 | 11 | foreach($errors as $k=>$e) { |
| ... | ... | @@ -8,9 +14,49 @@ |
| 8 | 14 | }?> |
| 9 | 15 | </div> |
| 10 | 16 | |
| 17 | +<div> | |
| 18 | + <h2>Paths and Permissions</h2> | |
| 19 | + <table> | |
| 20 | + <tr><?php echo $varDirectory; ?></tr> | |
| 21 | + <tr><?php echo $documentRoot; ?></tr> | |
| 22 | + <tr><?php echo $logDirectory; ?></tr> | |
| 23 | + <tr><?php echo $tmpDirectory; ?></tr> | |
| 24 | + <tr><?php echo $uploadDirectory; ?></tr> | |
| 25 | + <tr><?php echo $config; ?></tr> | |
| 26 | + <tr><?php echo $docLocation; ?></tr> | |
| 27 | + </table> | |
| 28 | +</div> | |
| 29 | +<br/> | |
| 30 | +<div> | |
| 31 | + <h2>Database connectivity</h2> | |
| 32 | + <table> | |
| 33 | + <tr><?php echo $dbConnectAdmin; ?></tr> | |
| 34 | + <tr><?php echo $dbConnectUser; ?></tr> | |
| 35 | + </table> | |
| 36 | + <h3>Privileges</h3> | |
| 37 | + <table> | |
| 38 | + <tr><?php echo $dbPrivileges; ?></tr> | |
| 39 | + <tr><?php echo $dbTransaction; ?></tr> | |
| 40 | + </table> | |
| 41 | +</div> | |
| 42 | +<br/> | |
| 43 | +<div> | |
| 44 | + <h2>Services</h2> | |
| 45 | + <table> | |
| 46 | + <tr><?php echo $luceneServiceStatus; ?></tr> | |
| 47 | + <tr><?php echo $schedulerServiceStatus; ?></tr> | |
| 48 | + </table> | |
| 49 | +</div> | |
| 50 | + | |
| 11 | 51 | <form> |
| 12 | 52 | <div class="buttons"> |
| 13 | 53 | <a href="index.php?step_name=complete&step=previous" class="previous">Previous</a> |
| 54 | + <a href="">Refresh</a> | |
| 14 | 55 | <a href="../../">Goto Login</a> |
| 56 | + <?php | |
| 57 | + if (INSTALL_TYPE == 'Zend') { | |
| 58 | + echo '<a href="http://' . $_SERVER['HTTP_HOST'] . '/ZendServer/Index">Zend Server Configuration</a>'; | |
| 59 | + } | |
| 60 | + ?> | |
| 15 | 61 | </div> |
| 16 | 62 | </form> |
| 17 | 63 | \ No newline at end of file | ... | ... |