Commit 3a97c8ad5d9b24ddc2e6180a7aed569db32b1b96
Merge branch 'edge' of github.com:ktgit/knowledgetree into edge
Showing
17 changed files
with
133 additions
and
70 deletions
plugins/ktstandard/PDFGeneratorAction.php
| @@ -255,9 +255,10 @@ class PDFGeneratorAction extends KTDocumentAction { | @@ -255,9 +255,10 @@ class PDFGeneratorAction extends KTDocumentAction { | ||
| 255 | $converter->setDocument($this->oDocument); | 255 | $converter->setDocument($this->oDocument); |
| 256 | $res = $converter->processDocument(); | 256 | $res = $converter->processDocument(); |
| 257 | 257 | ||
| 258 | - if(!$res){ | 258 | + if($res !== true){ |
| 259 | + // please contact your System Administrator | ||
| 259 | $default->log->error('PDF Generator: PDF file could not be generated'); | 260 | $default->log->error('PDF Generator: PDF file could not be generated'); |
| 260 | - $this->errorRedirectToMain(_kt('PDF file could not be generated, the file may be of an unsupported mime type or the PDF Generator could not connect.')); | 261 | + $this->errorRedirectToMain($res . ' ' . _kt('Please contact your System Administrator for assistance.')); |
| 261 | exit(); | 262 | exit(); |
| 262 | } | 263 | } |
| 263 | 264 | ||
| @@ -268,7 +269,22 @@ class PDFGeneratorAction extends KTDocumentAction { | @@ -268,7 +269,22 @@ class PDFGeneratorAction extends KTDocumentAction { | ||
| 268 | } | 269 | } |
| 269 | exit(); | 270 | exit(); |
| 270 | } | 271 | } |
| 271 | - $this->errorRedirectToMain(_kt('PDF file could not be generated')); | 272 | + |
| 273 | + // Check if this is a office 2007 doc | ||
| 274 | + $mime = $this->getMimeExtension(); | ||
| 275 | + | ||
| 276 | + $o2007_types[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; | ||
| 277 | + $o2007_types[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; | ||
| 278 | + $o2007_types[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; | ||
| 279 | + | ||
| 280 | + if(in_array($mime, $o2007_types)){ | ||
| 281 | + $error = _kt('The document is an MS Office 2007 format. This may not be supported by your version of OpenOffice. Please contact your System Administrator for assistance'); | ||
| 282 | + $default->log->error('PDF Generator: Document is an MS Office 2007 format. OpenOffice must be version 3.0 or higher to support this format. Please upgrade to the latest version.'); | ||
| 283 | + }else{ | ||
| 284 | + $error = _kt('PDF file could not be generated. The format may not be supported by your version of OpenOffice. Please contact your System Administrator for assistance'); | ||
| 285 | + $default->log->error('PDF Generator: PDF file could not be generated. The format may not be supported by your version of OpenOffice. Please check that you have the latest version installed.'); | ||
| 286 | + } | ||
| 287 | + $this->errorRedirectToMain($error); | ||
| 272 | exit(); | 288 | exit(); |
| 273 | } | 289 | } |
| 274 | 290 |
plugins/pdfConverter/pdfConverter.php
| @@ -48,6 +48,25 @@ class pdfConverter extends BaseProcessor | @@ -48,6 +48,25 @@ class pdfConverter extends BaseProcessor | ||
| 48 | $this->ooPort = $config->get('openoffice/port','8100'); | 48 | $this->ooPort = $config->get('openoffice/port','8100'); |
| 49 | 49 | ||
| 50 | $this->xmlrpc = XmlRpcLucene::get($javaServerUrl); | 50 | $this->xmlrpc = XmlRpcLucene::get($javaServerUrl); |
| 51 | + | ||
| 52 | + | ||
| 53 | + | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * Check that open office is running | ||
| 58 | + * | ||
| 59 | + * @return boolean | ||
| 60 | + */ | ||
| 61 | + private function checkOO() | ||
| 62 | + { | ||
| 63 | + $available = SearchHelper::checkOpenOfficeAvailablity(); | ||
| 64 | + | ||
| 65 | + if(is_null($available)){ | ||
| 66 | + return true; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + return false; | ||
| 51 | } | 70 | } |
| 52 | 71 | ||
| 53 | /** | 72 | /** |
| @@ -63,17 +82,26 @@ class pdfConverter extends BaseProcessor | @@ -63,17 +82,26 @@ class pdfConverter extends BaseProcessor | ||
| 63 | 82 | ||
| 64 | if(!file_exists($path)){ | 83 | if(!file_exists($path)){ |
| 65 | global $default; | 84 | global $default; |
| 66 | - $default->log->debug('Document, id: '.$this->document->iId.', does not exist at given storage path: '.$path); | ||
| 67 | - return false; | 85 | + $default->log->debug('PDF Converter: Document, id: '.$this->document->iId.', does not exist at given storage path: '.$path); |
| 86 | + return _kt("The document, id: {$this->document->iId}, does not exist at the given storage path: {$path}"); | ||
| 68 | } | 87 | } |
| 69 | 88 | ||
| 89 | + // check for OO | ||
| 90 | + $available = $this->checkOO(); | ||
| 91 | + | ||
| 70 | // do pdf conversion | 92 | // do pdf conversion |
| 93 | + if(!$available){ | ||
| 94 | + global $default; | ||
| 95 | + $default->log->error("PDF Converter: Cannot connect to Open Office Server on host {$this->ooHost} : {$this->ooPort}"); | ||
| 96 | + return _kt('Cannot connect to Open Office Server.'); | ||
| 97 | + } | ||
| 98 | + | ||
| 71 | $res = $this->convertFile($path, $ext); | 99 | $res = $this->convertFile($path, $ext); |
| 72 | 100 | ||
| 73 | - if($res === false){ | 101 | + if($res !== true){ |
| 74 | global $default; | 102 | global $default; |
| 75 | - $default->log->debug('Document, id: '.$this->document->iId.', could not be converted to pdf.'); | ||
| 76 | - return false; | 103 | + $default->log->debug('PDF Converter: Document, id: '.$this->document->iId.', could not be converted to pdf.'); |
| 104 | + return _kt("The document, id: {$this->document->iId}, could not be converted to pdf format. The following error occurred: \"{$res}\"."); | ||
| 77 | } | 105 | } |
| 78 | 106 | ||
| 79 | return true; | 107 | return true; |
| @@ -169,11 +197,11 @@ class pdfConverter extends BaseProcessor | @@ -169,11 +197,11 @@ class pdfConverter extends BaseProcessor | ||
| 169 | // Get contents and send to converter | 197 | // Get contents and send to converter |
| 170 | $result = $this->xmlrpc->convertDocument($sourceFile, $targetFile, $this->ooHost, $this->ooPort); | 198 | $result = $this->xmlrpc->convertDocument($sourceFile, $targetFile, $this->ooHost, $this->ooPort); |
| 171 | 199 | ||
| 172 | - if($result === false){ | 200 | + if(is_string($result)){ |
| 173 | $default->log->error('PDF Converter Plugin: Conversion to PDF Failed'); | 201 | $default->log->error('PDF Converter Plugin: Conversion to PDF Failed'); |
| 174 | @unlink($sourceFile); | 202 | @unlink($sourceFile); |
| 175 | @unlink($targetFile); | 203 | @unlink($targetFile); |
| 176 | - return false; | 204 | + return $result; |
| 177 | } | 205 | } |
| 178 | 206 | ||
| 179 | $pdfDir = $default->pdfDirectory; | 207 | $pdfDir = $default->pdfDirectory; |
| @@ -196,7 +224,7 @@ class pdfConverter extends BaseProcessor | @@ -196,7 +224,7 @@ class pdfConverter extends BaseProcessor | ||
| 196 | $res = @copy($targetFile, $pdfFile); | 224 | $res = @copy($targetFile, $pdfFile); |
| 197 | @unlink($sourceFile); | 225 | @unlink($sourceFile); |
| 198 | @unlink($targetFile); | 226 | @unlink($targetFile); |
| 199 | - return $pdfFile; | 227 | + return true; |
| 200 | 228 | ||
| 201 | } | 229 | } |
| 202 | } | 230 | } |
search2/indexing/lib/XmlRpcLucene.inc.php
| @@ -416,7 +416,7 @@ class XmlRpcLucene | @@ -416,7 +416,7 @@ class XmlRpcLucene | ||
| 416 | 416 | ||
| 417 | if($result->faultCode()) { | 417 | if($result->faultCode()) { |
| 418 | $this->error($result, 'convertDocument'); | 418 | $this->error($result, 'convertDocument'); |
| 419 | - return false; | 419 | + return $result->faultString(); |
| 420 | } | 420 | } |
| 421 | return php_xmlrpc_decode($result->value()) == 0; | 421 | return php_xmlrpc_decode($result->value()) == 0; |
| 422 | } | 422 | } |
setup/migrate/config/config.xml
| @@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
| 7 | Description: Migrateer steps | 7 | Description: Migrateer steps |
| 8 | --> | 8 | --> |
| 9 | 9 | ||
| 10 | -<migrate version="3.7" type="Commercial Edition"> | 10 | +<migrate version="3.7" type="Community Edition"> |
| 11 | <steps> | 11 | <steps> |
| 12 | <step name="Current Installation">installation</step> | 12 | <step name="Current Installation">installation</step> |
| 13 | <step name="Deactivate Services">services</step> | 13 | <step name="Deactivate Services">services</step> |
setup/migrate/migrateWizard.php
| @@ -261,7 +261,7 @@ class MigrateWizard { | @@ -261,7 +261,7 @@ class MigrateWizard { | ||
| 261 | } | 261 | } |
| 262 | } else { | 262 | } else { |
| 263 | // TODO: Die gracefully | 263 | // TODO: Die gracefully |
| 264 | - $this->util->error("System has been migrated <a href='../../login.php' class='back' style='width:80px;float:none'>Goto Login</a>"); | 264 | + $this->util->error("System has been migrated <a href='../../login.php' class='back' style='width:80px;float:none' back button_next>Goto Login</a>"); |
| 265 | } | 265 | } |
| 266 | } | 266 | } |
| 267 | } | 267 | } |
setup/migrate/steps/migrateDatabase.php
| @@ -134,7 +134,7 @@ class migrateDatabase extends Step | @@ -134,7 +134,7 @@ class migrateDatabase extends Step | ||
| 134 | $exe = "'$location/mysql/bin/mysqldump'"; // Location of dump | 134 | $exe = "'$location/mysql/bin/mysqldump'"; // Location of dump |
| 135 | } | 135 | } |
| 136 | $date = date('Y-m-d-H-i-s'); | 136 | $date = date('Y-m-d-H-i-s'); |
| 137 | - if(isset($database)) { | 137 | + if(isset($database['manual_export'])) { |
| 138 | $sqlFile = $database['manual_export']; | 138 | $sqlFile = $database['manual_export']; |
| 139 | if(file_exists($sqlFile)) { | 139 | if(file_exists($sqlFile)) { |
| 140 | $manual = true; | 140 | $manual = true; |
| @@ -147,7 +147,7 @@ class migrateDatabase extends Step | @@ -147,7 +147,7 @@ class migrateDatabase extends Step | ||
| 147 | if(!$manual) { // Try to export database | 147 | if(!$manual) { // Try to export database |
| 148 | $sqlFile = $tmpFolder."/kt-backup-$date.sql"; | 148 | $sqlFile = $tmpFolder."/kt-backup-$date.sql"; |
| 149 | $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile; | 149 | $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile; |
| 150 | -// $response = $this->util->pexec($cmd); | 150 | + $response = $this->util->pexec($cmd); |
| 151 | } | 151 | } |
| 152 | if(file_exists($sqlFile)) { | 152 | if(file_exists($sqlFile)) { |
| 153 | $fileContents = file_get_contents($sqlFile); | 153 | $fileContents = file_get_contents($sqlFile); |
setup/upgrade/config/config.xml
| @@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
| 7 | Description: Upgrader steps | 7 | Description: Upgrader steps |
| 8 | --> | 8 | --> |
| 9 | 9 | ||
| 10 | -<upgrade version="3.7" type="Commercial Edition"> | 10 | +<upgrade version="3.7" type="Community Edition"> |
| 11 | <steps> | 11 | <steps> |
| 12 | <step name="Welcome">welcome</step> | 12 | <step name="Welcome">welcome</step> |
| 13 | <step name="Current Installation">installation</step> | 13 | <step name="Current Installation">installation</step> |
setup/upgrade/templates/complete.tpl
| @@ -9,5 +9,5 @@ | @@ -9,5 +9,5 @@ | ||
| 9 | Your database has been upgraded to <?php echo $default->systemVersion; ?> | 9 | Your database has been upgraded to <?php echo $default->systemVersion; ?> |
| 10 | </div> | 10 | </div> |
| 11 | </div> | 11 | </div> |
| 12 | - <a href="../../" class="buttons back" style="width:100px;">Goto Login</a> | 12 | + <a href="../../" class="back button_next" style="width:80px;" onclick="javascript:{w.clearSessions();}">Goto Login</a> |
| 13 | </form> | 13 | </form> |
| 14 | \ No newline at end of file | 14 | \ No newline at end of file |
setup/wizard/installWizard.php
| @@ -296,7 +296,7 @@ class InstallWizard { | @@ -296,7 +296,7 @@ class InstallWizard { | ||
| 296 | } | 296 | } |
| 297 | } else { | 297 | } else { |
| 298 | // TODO: Die gracefully | 298 | // TODO: Die gracefully |
| 299 | - $this->util->error("System has been installed <a href='../../login.php' class='back' style='width:80px;float:none'>Goto Login</a>"); | 299 | + $this->util->error("System has been installed <a href='../../login.php' class='back' style='width:80px;float:none' class='back button_next'>Goto Login</a>"); |
| 300 | } | 300 | } |
| 301 | } | 301 | } |
| 302 | } | 302 | } |
setup/wizard/lib/services/unixOpenOffice.php
| @@ -137,7 +137,7 @@ class unixOpenOffice extends unixService { | @@ -137,7 +137,7 @@ class unixOpenOffice extends unixService { | ||
| 137 | public function start() { | 137 | public function start() { |
| 138 | $state = $this->status(); | 138 | $state = $this->status(); |
| 139 | if($state != 'STARTED') { | 139 | if($state != 'STARTED') { |
| 140 | - $cmd = "nohup ".$this->getBin().' -nofirststartwizard -nologo -headless -accept="socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" '." > /dev/null 2>&1 & echo $!"; | 140 | + $cmd = "nohup ".$this->getBin().' -nofirststartwizard -nologo -headless -"accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" '." > /dev/null 2>&1 & echo $!"; |
| 141 | if(DEBUG) { | 141 | if(DEBUG) { |
| 142 | echo "Command : $cmd<br/>"; | 142 | echo "Command : $cmd<br/>"; |
| 143 | return ; | 143 | return ; |
setup/wizard/lib/services/windowsOpenOffice.php
| @@ -203,7 +203,7 @@ class windowsOpenOffice extends windowsService { | @@ -203,7 +203,7 @@ class windowsOpenOffice extends windowsService { | ||
| 203 | //$binary = $this->util->openOfficeSpecified(); | 203 | //$binary = $this->util->openOfficeSpecified(); |
| 204 | $binary = $this->getBin(); | 204 | $binary = $this->getBin(); |
| 205 | if($binary != '') { | 205 | if($binary != '') { |
| 206 | - $cmd = "\"{$this->winservice}\" install $this->name "."-displayname {$this->name} -start auto \"".$binary."\" -headless -invisible -accept=socket,host={$this->host},port={$this->port};urp;";; | 206 | + $cmd = "\"{$this->winservice}\" install $this->name "."-displayname {$this->name} -start auto \"".$binary."\" -headless -invisible -\"accept=socket,host={$this->host},port={$this->port};urp;\"";; |
| 207 | if(DEBUG) { | 207 | if(DEBUG) { |
| 208 | echo "Command : $cmd<br/>"; | 208 | echo "Command : $cmd<br/>"; |
| 209 | return ; | 209 | return ; |
setup/wizard/lib/system/config-path-mock
| 1 | -/var/lib/knowledgetree | ||
| 2 | -/var/lib/knowledgetree/Documents | ||
| 3 | -/var/lib/knowledgetree/indexes | ||
| 4 | -/etc/knowledgetree/config.ini | ||
| 5 | -/var/log/knowledgetree | ||
| 6 | -/var/tmp/knowledgetree | ||
| 7 | -/var/tmp/knowledgetree/proxies | ||
| 8 | -/var/tmp/knowledgetree/uploads | ||
| 9 | -/var/tmp/knowledgetree/cache | ||
| 10 | \ No newline at end of file | 1 | \ No newline at end of file |
| 2 | +/var/lib/knowledgetree-ce | ||
| 3 | +/var/lib/knowledgetree-ce/Documents | ||
| 4 | +/var/lib/knowledgetree-ce/indexes | ||
| 5 | +/etc/knowledgetree-ce/config.ini | ||
| 6 | +/var/log/knowledgetree-ce | ||
| 7 | +/var/tmp/knowledgetree-ce | ||
| 8 | +/var/tmp/knowledgetree-ce/proxies | ||
| 9 | +/var/tmp/knowledgetree-ce/uploads | ||
| 10 | +/var/tmp/knowledgetree-ce/cache | ||
| 11 | \ No newline at end of file | 11 | \ No newline at end of file |
setup/wizard/lib/validation/luceneValidation.php
| @@ -274,7 +274,7 @@ class luceneValidation extends serviceValidation { | @@ -274,7 +274,7 @@ class luceneValidation extends serviceValidation { | ||
| 274 | if($auto) { | 274 | if($auto) { |
| 275 | return $auto; | 275 | return $auto; |
| 276 | } else { | 276 | } else { |
| 277 | - $auto = $this->useDetected(); // Check if auto detected java works | 277 | + $auto = $this->detSettings(); // Check if auto detected java works |
| 278 | if($auto) { | 278 | if($auto) { |
| 279 | $this->disableExtension = true; // Disable the use of the php bridge extension | 279 | $this->disableExtension = true; // Disable the use of the php bridge extension |
| 280 | return $auto; | 280 | return $auto; |
| @@ -372,7 +372,7 @@ class luceneValidation extends serviceValidation { | @@ -372,7 +372,7 @@ class luceneValidation extends serviceValidation { | ||
| 372 | $javaExecutable = $this->java; | 372 | $javaExecutable = $this->java; |
| 373 | } | 373 | } |
| 374 | if(WINDOWS_OS) { | 374 | if(WINDOWS_OS) { |
| 375 | - $cmd .= "\"$javaExecutable\" -cp \"".SYS_DIR.";\" javaVersion \"".$this->outputDir."outJV\""." \"".$this->outputDir."outJVHome\""; | 375 | + $cmd = "\"$javaExecutable\" -cp \"".SYS_DIR.";\" javaVersion \"".$this->outputDir."outJV\""." \"".$this->outputDir."outJVHome\""; |
| 376 | $func = OS."ReadJVFromFile"; | 376 | $func = OS."ReadJVFromFile"; |
| 377 | if($this->$func($cmd)) return true; | 377 | if($this->$func($cmd)) return true; |
| 378 | } else { | 378 | } else { |
| @@ -454,18 +454,6 @@ class luceneValidation extends serviceValidation { | @@ -454,18 +454,6 @@ class luceneValidation extends serviceValidation { | ||
| 454 | } | 454 | } |
| 455 | } | 455 | } |
| 456 | 456 | ||
| 457 | - /** | ||
| 458 | - * Attempt detection without logging errors | ||
| 459 | - * | ||
| 460 | - * @author KnowledgeTree Team | ||
| 461 | - * @param none | ||
| 462 | - * @access private | ||
| 463 | - * @return boolean | ||
| 464 | - */ | ||
| 465 | - private function useDetected() { | ||
| 466 | - return $this->detSettings(); | ||
| 467 | - } | ||
| 468 | - | ||
| 469 | /** | 457 | /** |
| 470 | * Set all silent mode varibles | 458 | * Set all silent mode varibles |
| 471 | * | 459 | * |
setup/wizard/steps/configuration.php
| @@ -53,6 +53,7 @@ if(isset($_GET['action'])) { | @@ -53,6 +53,7 @@ if(isset($_GET['action'])) { | ||
| 53 | 53 | ||
| 54 | class configuration extends Step | 54 | class configuration extends Step |
| 55 | { | 55 | { |
| 56 | + private $allConfs; | ||
| 56 | /** | 57 | /** |
| 57 | * Database host | 58 | * Database host |
| 58 | * | 59 | * |
| @@ -282,16 +283,19 @@ class configuration extends Step | @@ -282,16 +283,19 @@ class configuration extends Step | ||
| 282 | } | 283 | } |
| 283 | 284 | ||
| 284 | private function registerDirs() { // Adjust directories variables | 285 | private function registerDirs() { // Adjust directories variables |
| 285 | - $this->readConfigPath(); | ||
| 286 | - $dirs = $this->getFromConfigPath(); | ||
| 287 | - $directories['varDirectory'] = array('section'=>'urls', 'value'=>addslashes($dirs['varDirectory']['path']), 'setting'=>'varDirectory'); | ||
| 288 | - $directories['logDirectory'] = array('section'=>'urls', 'value'=>addslashes($dirs['logDirectory']['path']), 'setting'=>'logDirectory'); | ||
| 289 | - $directories['documentRoot'] = array('section'=>'urls', 'value'=>addslashes($dirs['documentRoot']['path']), 'setting'=>'documentRoot'); | 286 | +// $this->readConfigPath(); |
| 287 | +// $dirs = $this->getFromConfigPath(); | ||
| 288 | +// print_r($dirs); | ||
| 289 | + $directories['varDirectory'] = array('section'=>'urls', 'value'=>addslashes($this->allConfs['varDirectory']['path']), 'setting'=>'varDirectory'); | ||
| 290 | + $directories['logDirectory'] = array('section'=>'urls', 'value'=>addslashes($this->allConfs['logDirectory']['path']), 'setting'=>'logDirectory'); | ||
| 291 | + $directories['documentRoot'] = array('section'=>'urls', 'value'=>addslashes($this->allConfs['documentRoot']['path']), 'setting'=>'documentRoot'); | ||
| 290 | $directories['uiDirectory'] = array('section'=>'urls', 'value'=>'${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree', 'setting'=>'uiDirectory'); | 292 | $directories['uiDirectory'] = array('section'=>'urls', 'value'=>'${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree', 'setting'=>'uiDirectory'); |
| 291 | - $directories['tmpDirectory'] = array('section'=>'urls', 'value'=>addslashes($dirs['tmpDirectory']['path']), 'setting'=>'tmpDirectory'); | 293 | + $directories['tmpDirectory'] = array('section'=>'urls', 'value'=>addslashes($this->allConfs['tmpDirectory']['path']), 'setting'=>'tmpDirectory'); |
| 294 | + $directories['cacheDirectory'] = array('section'=>'cache', 'value'=>addslashes($this->allConfs['cacheDirectory']['path']), 'setting'=>'cacheDirectory'); | ||
| 292 | 295 | ||
| 293 | return $directories; | 296 | return $directories; |
| 294 | } | 297 | } |
| 298 | + | ||
| 295 | /** | 299 | /** |
| 296 | * Perform the installation associated with the step. | 300 | * Perform the installation associated with the step. |
| 297 | * Variables required by the installation are stored within the session. | 301 | * Variables required by the installation are stored within the session. |
| @@ -306,22 +310,24 @@ class configuration extends Step | @@ -306,22 +310,24 @@ class configuration extends Step | ||
| 306 | $this->dbhandler->load($dbconf['dhost'], $dbconf['dmsname'], $dbconf['dmspassword'], $dbconf['dname']); | 310 | $this->dbhandler->load($dbconf['dhost'], $dbconf['dmsname'], $dbconf['dmspassword'], $dbconf['dname']); |
| 307 | $server = $conf['server']; | 311 | $server = $conf['server']; |
| 308 | $paths = $conf['paths']; | 312 | $paths = $conf['paths']; |
| 309 | - // TODO | ||
| 310 | if ($this->util->isMigration()) { // Check if its an upgrade | 313 | if ($this->util->isMigration()) { // Check if its an upgrade |
| 314 | + $this->confpaths['configIni'] = $this->readConfigPathIni(); | ||
| 311 | $this->readInstallation(); | 315 | $this->readInstallation(); |
| 316 | + $configPath = $this->confpaths['configIni']; | ||
| 312 | } else { | 317 | } else { |
| 313 | $this->readConfigPath(); // initialise writing to config.ini | 318 | $this->readConfigPath(); // initialise writing to config.ini |
| 319 | + if(isset($this->confpaths['configIni'])) { // Check if theres a config path | ||
| 320 | + $configPath = realpath("../../{$this->confpaths['configIni']}"); // Relative to Config Path File | ||
| 321 | + if($configPath == '') { // Absolute path probably entered | ||
| 322 | + $configPath = realpath("{$this->confpaths['configIni']}"); // Get relative path | ||
| 323 | + } | ||
| 324 | + } else { | ||
| 325 | + $configPath = realpath('../../config/config.ini'); // Normal | ||
| 326 | + } | ||
| 314 | } | 327 | } |
| 315 | - $dirs = $this->getFromConfigPath(); | ||
| 316 | - if(isset($this->confpaths['configIni'])) { // Check if theres a config path | ||
| 317 | - $configPath = realpath("../../{$this->confpaths['configIni']}"); // Relative to Config Path File | ||
| 318 | - if($configPath == '') { // Absolute path probably entered | ||
| 319 | - $configPath = realpath("{$this->confpaths['configIni']}"); // Get relative path | ||
| 320 | - } | ||
| 321 | - } else { | ||
| 322 | - $configPath = realpath('../../config/config.ini'); | ||
| 323 | - } | 328 | + $this->getFromConfigPath(); |
| 324 | $ini = false; | 329 | $ini = false; |
| 330 | +// print_r($configPath); | ||
| 325 | if(file_exists($configPath)) { | 331 | if(file_exists($configPath)) { |
| 326 | $ini = new iniUtilities($configPath); | 332 | $ini = new iniUtilities($configPath); |
| 327 | } | 333 | } |
| @@ -333,7 +339,7 @@ class configuration extends Step | @@ -333,7 +339,7 @@ class configuration extends Step | ||
| 333 | } | 339 | } |
| 334 | $this->dbhandler->close(); // close the database connection | 340 | $this->dbhandler->close(); // close the database connection |
| 335 | $this->writeCachePath(); // Write cache path file | 341 | $this->writeCachePath(); // Write cache path file |
| 336 | - $this->writeConfigPath(); // Write config file | 342 | + $this->writeConfigPath($configPath); // Write config file |
| 337 | } | 343 | } |
| 338 | 344 | ||
| 339 | private function writeUrlSection($ini) { | 345 | private function writeUrlSection($ini) { |
| @@ -446,6 +452,7 @@ class configuration extends Step | @@ -446,6 +452,7 @@ class configuration extends Step | ||
| 446 | { | 452 | { |
| 447 | if(isset($this->temp_variables['paths'])) { | 453 | if(isset($this->temp_variables['paths'])) { |
| 448 | if ($this->util->isMigration()) { // Check if its an upgrade | 454 | if ($this->util->isMigration()) { // Check if its an upgrade |
| 455 | + $this->confpaths['configIni'] = $this->readConfigPathIni(); | ||
| 449 | $this->readInstallation(); // Read values from config.ini of other installation | 456 | $this->readInstallation(); // Read values from config.ini of other installation |
| 450 | $dirs = $this->getFromConfigPath(); // Store contents | 457 | $dirs = $this->getFromConfigPath(); // Store contents |
| 451 | } else { | 458 | } else { |
| @@ -453,6 +460,7 @@ class configuration extends Step | @@ -453,6 +460,7 @@ class configuration extends Step | ||
| 453 | } | 460 | } |
| 454 | } else { | 461 | } else { |
| 455 | if ($this->util->isMigration()) { // Check if its an upgrade | 462 | if ($this->util->isMigration()) { // Check if its an upgrade |
| 463 | + $this->confpaths['configIni'] = $this->readConfigPathIni(); | ||
| 456 | $this->readInstallation(); // Read values from config.ini of other installation | 464 | $this->readInstallation(); // Read values from config.ini of other installation |
| 457 | } else { | 465 | } else { |
| 458 | $this->readConfigPath(); // Read contents of config-path file | 466 | $this->readConfigPath(); // Read contents of config-path file |
| @@ -583,6 +591,7 @@ class configuration extends Step | @@ -583,6 +591,7 @@ class configuration extends Step | ||
| 583 | } | 591 | } |
| 584 | $configs['varDirectory'] = array('name' => 'Var Directory', 'setting' => 'varDirectory', 'path' => $varPath, 'create' => false); | 592 | $configs['varDirectory'] = array('name' => 'Var Directory', 'setting' => 'varDirectory', 'path' => $varPath, 'create' => false); |
| 585 | 593 | ||
| 594 | + $this->allConfs = $configs; | ||
| 586 | return $configs; | 595 | return $configs; |
| 587 | } | 596 | } |
| 588 | 597 | ||
| @@ -632,6 +641,21 @@ class configuration extends Step | @@ -632,6 +641,21 @@ class configuration extends Step | ||
| 632 | return true; | 641 | return true; |
| 633 | } | 642 | } |
| 634 | 643 | ||
| 644 | + private function readConfigPathIni() { | ||
| 645 | + $configPath = $this->getContentPath(); | ||
| 646 | + if(!$configPath) return false; | ||
| 647 | + $ini = new iniUtilities($configPath); | ||
| 648 | + $data = $ini->getFileByLine(); | ||
| 649 | + $firstline = true; | ||
| 650 | + foreach ($data as $k=>$v) { | ||
| 651 | + if(preg_match('/config.ini/', $k)) { // Find config.ini | ||
| 652 | + return $k; | ||
| 653 | + } | ||
| 654 | + } | ||
| 655 | + | ||
| 656 | + return false; | ||
| 657 | + } | ||
| 658 | + | ||
| 635 | /** | 659 | /** |
| 636 | * Read contents of config path file | 660 | * Read contents of config path file |
| 637 | * | 661 | * |
| @@ -676,14 +700,14 @@ class configuration extends Step | @@ -676,14 +700,14 @@ class configuration extends Step | ||
| 676 | } | 700 | } |
| 677 | 701 | ||
| 678 | /** | 702 | /** |
| 679 | - * Read contents of config path file | 703 | + * Write location of config path file |
| 680 | * | 704 | * |
| 681 | * @author KnowledgeTree Team | 705 | * @author KnowledgeTree Team |
| 682 | * @access private | 706 | * @access private |
| 683 | * @param none | 707 | * @param none |
| 684 | * @return boolean | 708 | * @return boolean |
| 685 | */ | 709 | */ |
| 686 | - private function writeConfigPath() { | 710 | + private function writeConfigPath($configPath = '') { |
| 687 | $configPath = $this->getContentPath(); | 711 | $configPath = $this->getContentPath(); |
| 688 | if(!$configPath) return false; | 712 | if(!$configPath) return false; |
| 689 | $ini = new iniUtilities($configPath); | 713 | $ini = new iniUtilities($configPath); |
| @@ -746,10 +770,6 @@ class configuration extends Step | @@ -746,10 +770,6 @@ class configuration extends Step | ||
| 746 | if(!$cachePath) return false; | 770 | if(!$cachePath) return false; |
| 747 | return $cachePath; | 771 | return $cachePath; |
| 748 | } | 772 | } |
| 749 | - | ||
| 750 | - public function doReadConfig() { | ||
| 751 | - | ||
| 752 | - } | ||
| 753 | } | 773 | } |
| 754 | 774 | ||
| 755 | if(isset($_GET['action'])) { | 775 | if(isset($_GET['action'])) { |
setup/wizard/steps/database.php
| @@ -719,7 +719,14 @@ class database extends Step | @@ -719,7 +719,14 @@ class database extends Step | ||
| 719 | * @return boolean | 719 | * @return boolean |
| 720 | */ | 720 | */ |
| 721 | private function createDmsUser() { | 721 | private function createDmsUser() { |
| 722 | - return $this->parse_mysql_dump($this->util->sqlInstallDir()."user.sql"); | 722 | + $user1 = "GRANT SELECT, INSERT, UPDATE, DELETE ON {$this->dname}.* TO {$this->dmsusername}@{$this->dhost} IDENTIFIED BY \"{$this->dmsuserpassword}\";"; |
| 723 | + $user2 = "GRANT ALL PRIVILEGES ON {$this->dname}.* TO {$this->dmsname}@{$this->dhost} IDENTIFIED BY \"{$this->dmspassword}\";"; | ||
| 724 | + if ($this->dbhandler->query($user1) && $this->dbhandler->query($user2)) { | ||
| 725 | + return true; | ||
| 726 | + } else { | ||
| 727 | + $this->error['con'] = "Could not create users for database: {$this->dname}"; | ||
| 728 | + return false; | ||
| 729 | + } | ||
| 723 | } | 730 | } |
| 724 | 731 | ||
| 725 | /** | 732 | /** |
setup/wizard/templates/complete.tpl
| @@ -128,10 +128,13 @@ | @@ -128,10 +128,13 @@ | ||
| 128 | 128 | ||
| 129 | $pos = strpos($script, '/setup/wizard/'); | 129 | $pos = strpos($script, '/setup/wizard/'); |
| 130 | $root_url = substr($script, 0, $pos); | 130 | $root_url = substr($script, 0, $pos); |
| 131 | - $redirect = "http://".$_SERVER['SERVER_NAME'].$root_url."/admin.php"; | 131 | + if($port == '') |
| 132 | + $redirect = "http://".$_SERVER['SERVER_NAME'].$root_url."/admin.php"; | ||
| 133 | + else | ||
| 134 | + $redirect = "http://".$_SERVER['SERVER_NAME'].":$port".$root_url."/admin.php"; | ||
| 132 | ?> | 135 | ?> |
| 133 | <?php if($migrate_check) { ?> | 136 | <?php if($migrate_check) { ?> |
| 134 | - <a href="../../login.php?redirect=<?php echo $redirect; ?>" class="back button_next" style="width:80px;" onclick="javascript:{w.clearSessions();}">Goto Login</a> | 137 | + <a href="../upgrade" class="back button_next" style="width:190px;" onclick="javascript:{w.clearSessions();}">Goto Database Upgrade</a> |
| 135 | <?php } else { ?> | 138 | <?php } else { ?> |
| 136 | <a href="../../login.php?redirect=<?php echo $redirect; ?>" class="back button_next" style="width:80px;" onclick="javascript:{w.clearSessions();}">Goto Login</a> | 139 | <a href="../../login.php?redirect=<?php echo $redirect; ?>" class="back button_next" style="width:80px;" onclick="javascript:{w.clearSessions();}">Goto Login</a> |
| 137 | <?php } ?> | 140 | <?php } ?> |
setup/wizard/templates/welcome.tpl
| @@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
| 4 | <p class="empty_space"> This wizard will lead you through all the steps required to install and configure KnowledgeTree on your server.</p> | 4 | <p class="empty_space"> This wizard will lead you through all the steps required to install and configure KnowledgeTree on your server.</p> |
| 5 | <p class="empty_space"> | 5 | <p class="empty_space"> |
| 6 | Press <b>Next</b> to continue.</p> | 6 | Press <b>Next</b> to continue.</p> |
| 7 | + <div class="demo"><?php echo $html->image('kt_browse.png'); ?> </div> | ||
| 7 | </div> | 8 | </div> |
| 8 | <input type="submit" name="Next" value="Next" class="button_next"/> | 9 | <input type="submit" name="Next" value="Next" class="button_next"/> |
| 9 | <!-- <input type="submit" name="Migrate" value="Migrate" class="button_next"/>--> | 10 | <!-- <input type="submit" name="Migrate" value="Migrate" class="button_next"/>--> |