diff --git a/setup/migrate/step.php b/setup/migrate/step.php index 315fd53..06d4ef1 100644 --- a/setup/migrate/step.php +++ b/setup/migrate/step.php @@ -117,15 +117,6 @@ class Step */ public $util; - /** - * Reference to utility object - * - * @author KnowledgeTree Team - * @access protected - * @var object - */ - public $dbhandler; - public function __construct() { $this->util = new MigrateUtil(); } diff --git a/setup/migrate/steps/migrateInstallation.php b/setup/migrate/steps/migrateInstallation.php index cc4f25b..0c98bcc 100644 --- a/setup/migrate/steps/migrateInstallation.php +++ b/setup/migrate/steps/migrateInstallation.php @@ -147,7 +147,8 @@ class migrateInstallation extends step $this->storeSilent(); return false; } else { - if($this->readVersion()) { + $this->foundVersion = $this->readVersion(); + if($version) { $this->checkVersion(); } $this->storeSilent(); @@ -169,8 +170,8 @@ class migrateInstallation extends step public function readVersion() { $verFile = $this->location."/knowledgeTree/docs/VERSION.txt"; if(file_exists($verFile)) { - $this->foundVersion = file_get_contents($verFile); - return true; + $foundVersion = file_get_contents($verFile); + return $foundVersion; } else { $this->error[] = "KT installation version not found"; } @@ -226,9 +227,7 @@ class migrateInstallation extends step } private function loadConfig($path) { -// $ini = $this->util->loadInstallIni($path); $this->util->iniUtilities->load($path); -// $dbSettings = $ini->getSection('db'); $dbSettings = $this->util->iniUtilities->getSection('db'); $this->dbSettings = array('dbHost'=> $dbSettings['dbHost'], 'dbName'=> $dbSettings['dbName'], @@ -239,15 +238,12 @@ class migrateInstallation extends step 'dbAdminPass'=> $dbSettings['dbAdminPass'], ); $ktSettings = $this->util->iniUtilities->getSection('KnowledgeTree'); -// $ktSettings = $ini->getSection('KnowledgeTree'); $froot = $ktSettings['fileSystemRoot']; if ($froot == 'default') { $froot = $this->location; } $this->ktSettings = array('fileSystemRoot'=> $froot, ); -// $urlPaths = $ini->getSection('urls'); -// $urlPaths = $this->util->iniUtilities->getSection('urls'); $varDir = $froot.DS.'var'; $this->urlPaths = array(array('name'=> 'Var Directory', 'path'=> $varDir), array('name'=> 'Log Directory', 'path'=> $varDir.DS.'log'), diff --git a/setup/migrate/templates/error.tpl b/setup/migrate/templates/error.tpl index 5a93982..958cee8 100644 --- a/setup/migrate/templates/error.tpl +++ b/setup/migrate/templates/error.tpl @@ -1,11 +1,11 @@ + KnowledgeTree Installer - @@ -14,7 +14,7 @@
3.7 - Commercial Edition + Community Edition
diff --git a/setup/migrate/templates/wizard.tpl b/setup/migrate/templates/wizard.tpl index b39cde5..4309d2e 100644 --- a/setup/migrate/templates/wizard.tpl +++ b/setup/migrate/templates/wizard.tpl @@ -1,6 +1,7 @@ + KnowledgeTree Installer js('jquery.js'); ?> js('jquery.form.js'); ?> diff --git a/setup/upgrade/step.php b/setup/upgrade/step.php index 6a66986..2cf5254 100644 --- a/setup/upgrade/step.php +++ b/setup/upgrade/step.php @@ -110,7 +110,6 @@ class Step public function __construct() { $this->util = new UpgradeUtil(); - //$this->dbhandler = $this->util->dbUtilities; } /** diff --git a/setup/upgrade/steps/upgradeDatabase.php b/setup/upgrade/steps/upgradeDatabase.php index 88e8cda..2b7c385 100644 --- a/setup/upgrade/steps/upgradeDatabase.php +++ b/setup/upgrade/steps/upgradeDatabase.php @@ -43,7 +43,8 @@ //require_once('../../config/dmsDefaults.php'); //require_once(KT_LIB_DIR . '/config/config.inc.php'); //require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php'); -//require_once(KT_LIB_DIR . '/upgrades/upgrade.inc.php'); +//define('KT_LIB_DIR', SYSTEM_DIR.'lib'.DS); +//require_once(SYSTEM_DIR . 'lib/upgrades/upgrade.inc.php'); class upgradeDatabase extends Step { @@ -141,13 +142,16 @@ class upgradeDatabase extends Step } private function doRun($action = null) { - $this->readConfig(KTConfig::getConfigFilename()); - +// $this->readConfig(KTConfig::getConfigFilename()); + require_once("../wizard/steps/configuration.php"); // configuration to read the ini path + $wizConfigHandler = new configuration(); + $configPath = $wizConfigHandler->readConfigPathIni(); + $this->readConfig($configPath); if($this->dbSettings['dbPort'] == '') { - $con = $this->dbhandler->load($this->dbSettings['dbHost'], $this->dbSettings['dbUser'], + $con = $this->util->dbUtilities->load($this->dbSettings['dbHost'], $this->dbSettings['dbUser'], $this->dbSettings['dbPass'], $this->dbSettings['dbName']); } else { - $con = $this->dbhandler->load($this->dbSettings['dbHost'].":".$this->dbSettings['dbPort'], $this->dbSettings['dbUser'], + $con = $this->util->dbUtilities->load($this->dbSettings['dbHost'].":".$this->dbSettings['dbPort'], $this->dbSettings['dbUser'], $this->dbSettings['dbPass'], $this->dbSettings['dbName']); } @@ -173,17 +177,20 @@ class upgradeDatabase extends Step } private function generateUpgradeTable() { - global $default; - - $this->temp_variables['systemVersion'] = $default->systemVersion; - $query = sprintf('SELECT value FROM %s WHERE name = "databaseVersion"', $default->system_settings_table); - - $result = $this->dbhandler->query($query); +// global $default; + $v = $this->readVersion(); +// $this->temp_variables['systemVersion'] = $default->systemVersion; + $this->temp_variables['systemVersion'] = $v; + +// $query = sprintf('SELECT value FROM %s WHERE name = "databaseVersion"', $default->system_settings_table); + $query = sprintf('SELECT value FROM %s WHERE name = "databaseVersion"', 'config_settings'); + + $result = $this->util->dbUtilities->query($query); if ($result) { - $lastVersionObj = $this->dbhandler->fetchNextObject($result); + $lastVersionObj = $this->util->dbUtilities->fetchNextObject($result); $lastVersion = $lastVersionObj->value; } - $currentVersion = $default->systemVersion; + $currentVersion = $v; $upgrades = describeUpgrade($lastVersion, $currentVersion); @@ -202,6 +209,17 @@ class upgradeDatabase extends Step return $ret; } + public function readVersion() { + $verFile = SYSTEM_DIR."docs".DS."VERSION.txt"; + if(file_exists($verFile)) { + $foundVersion = file_get_contents($verFile); + return $foundVersion; + } else { + $this->error[] = "KT installation version not found"; + } + + return false; + } /** * Stores varibles used by template * @@ -243,9 +261,8 @@ class upgradeDatabase extends Step private function readConfig($path) { //$ini = $this->util->loadInstallIni($path); - $ini = $this->util->iniUtilities; - $ini->load($path); - $dbSettings = $ini->getSection('db'); + $this->util->iniUtilities->load($path); + $dbSettings = $this->util->iniUtilities->getSection('db'); $this->dbSettings = array('dbHost'=> $dbSettings['dbHost'], 'dbName'=> $dbSettings['dbName'], 'dbUser'=> $dbSettings['dbUser'], @@ -269,7 +286,7 @@ class upgradeDatabase extends Step private function doDatabaseUpgrade() { - global $default; +// global $default; $errors = false; @@ -318,7 +335,7 @@ class upgradeDatabase extends Step // This is just to test and needs to be updated to a more sane and error resistent architrcture if it works. // It should idealy work the same as the upgrades. - global $default; +// global $default; // Lock the scheduler $lockFile = $default->cacheDirectory . DIRECTORY_SEPARATOR . 'scheduler.lock'; @@ -332,7 +349,7 @@ class upgradeDatabase extends Step // This is just to test and needs to be updated to a more sane and error resistent architrcture if it works. // It should idealy work the same as the upgrades. - global $default; +// global $default; // Ensure all plugins are re-registered. $sql = "TRUNCATE plugin_helper"; @@ -360,7 +377,7 @@ class upgradeDatabase extends Step } private function performAllUpgrades () { - global $default; +// global $default; $row = 1; diff --git a/setup/upgrade/steps/upgradeWelcome.php b/setup/upgrade/steps/upgradeWelcome.php index ae86767..5d158c8 100644 --- a/setup/upgrade/steps/upgradeWelcome.php +++ b/setup/upgrade/steps/upgradeWelcome.php @@ -84,21 +84,28 @@ class upgradeWelcome extends step { private function checkPassword($username, $password) { $dconf = $this->getDataFromPackage('installers', 'database'); // Use info from install if($dconf) { - $this->dbhandler->load($dconf['dhost'], $dconf['duname'], $dconf['dpassword'], $dconf['dname']); + $this->util->dbUtilities->load($dconf['dhost'], $dconf['duname'], $dconf['dpassword'], $dconf['dname']); } else { - require_once("../wizard/iniUtilities.php"); // ini to read the ini content require_once("../wizard/steps/configuration.php"); // configuration to read the ini path $wizConfigHandler = new configuration(); $configPath = $wizConfigHandler->readConfigPathIni(); - $ini = new iniUtilities($configPath); - $dconf = $ini->getSection('db'); - $this->dbhandler->load($dconf['dbHost'], $dconf['dbUser'], $dconf['dbPass'], $dconf['dbName']); + $this->util->iniUtilities->load($configPath); + $dconf = $this->util->iniUtilities->getSection('db'); + if($dconf['dbPort'] == 'default') + $dconf['dbPort'] = 3306; + $this->util->dbUtilities->load($dconf['dbHost'].":".$dconf['dbPort'], $dconf['dbUser'], $dconf['dbPass'], $dconf['dbName']); + $sQuery = "SELECT count(*) AS match_count FROM users WHERE username = '$username' AND password = '".md5($password)."'"; + $res = $this->util->dbUtilities->query($sQuery); + $ass = $this->util->dbUtilities->fetchAssoc($res); + if($ass[0]['match_count'] == 1) + return true; } + $this->error[] = 'Could Not Authenticate User'; return false; } - + public function getErrors() { return $this->error; } diff --git a/setup/upgrade/templates/complete.tpl b/setup/upgrade/templates/complete.tpl index 6d7f1fa..d32a3ce 100644 --- a/setup/upgrade/templates/complete.tpl +++ b/setup/upgrade/templates/complete.tpl @@ -1,4 +1,4 @@ - +

Database Upgrade Completed

@@ -6,7 +6,7 @@

- Your database has been upgraded to systemVersion; ?> + Your database has been upgraded to systemVersion; ?>
Goto Login diff --git a/setup/upgrade/templates/error.tpl b/setup/upgrade/templates/error.tpl index 5102838..9c6a997 100644 --- a/setup/upgrade/templates/error.tpl +++ b/setup/upgrade/templates/error.tpl @@ -1,6 +1,7 @@ + KnowledgeTree Installer @@ -14,7 +15,7 @@
3.7 - Commercial Edition + Community Edition
diff --git a/setup/upgrade/templates/progress.tpl b/setup/upgrade/templates/progress.tpl index adc2bf5..7d53178 100644 --- a/setup/upgrade/templates/progress.tpl +++ b/setup/upgrade/templates/progress.tpl @@ -1,6 +1,7 @@ + KnowledgeTree Upgrade Wizard @@ -14,7 +15,7 @@
3.7 - Commercial Edition + Community Edition
diff --git a/setup/upgrade/templates/wizard.tpl b/setup/upgrade/templates/wizard.tpl index 823d3e7..723d255 100644 --- a/setup/upgrade/templates/wizard.tpl +++ b/setup/upgrade/templates/wizard.tpl @@ -1,6 +1,7 @@ + KnowledgeTree Upgrader js('jquery.js'); ?> js('jquery.form.js'); ?> diff --git a/setup/wizard/dbUtilities.php b/setup/wizard/dbUtilities.php index e019e60..b015d41 100644 --- a/setup/wizard/dbUtilities.php +++ b/setup/wizard/dbUtilities.php @@ -119,10 +119,10 @@ class dbUtilities { $new = array($dhost, $duname, $dpassword, $dbname); $diff = array_diff($new, $current); if(count($diff) == 0) { - echo 'same'; - return true; + if($this->getDatabaseLink()) // Make sure theres a link + return true; // Already connected } - return false; + return false; // Reconnect } public function getDatabaseLink() { diff --git a/setup/wizard/installUtil.php b/setup/wizard/installUtil.php index 35a241c..ec0865a 100644 --- a/setup/wizard/installUtil.php +++ b/setup/wizard/installUtil.php @@ -39,9 +39,8 @@ * @package Installer * @version Version 0.1 */ -require_once("path.php"); // Include if util is loaded directly -require_once(WIZARD_DIR."iniUtilities.php"); -require_once(WIZARD_DIR."dbUtilities.php"); +require_once("iniUtilities.php"); +require_once("dbUtilities.php"); class InstallUtil { private $salt = 'installers'; diff --git a/setup/wizard/installWizard.php b/setup/wizard/installWizard.php index f4b2340..12017e6 100644 --- a/setup/wizard/installWizard.php +++ b/setup/wizard/installWizard.php @@ -282,7 +282,7 @@ class InstallWizard { } if(!$this->isSystemInstalled()) { // Check if the systems not installed if($this->util->migrationSpecified()) { // Check if the migrator needs to be accessed - $this->util->redirect('../migrate'); + $this->util->redirect('../migrate/index.php'); } elseif ($this->util->upgradeSpecified()) { $this->util->redirect('../upgrade/index.php?action=installer'); } diff --git a/setup/wizard/lib/helpers/htmlHelper.php b/setup/wizard/lib/helpers/htmlHelper.php index 2dbcb7e..f106573 100644 --- a/setup/wizard/lib/helpers/htmlHelper.php +++ b/setup/wizard/lib/helpers/htmlHelper.php @@ -114,6 +114,10 @@ class htmlHelper { return $image; } + function url() { + + } + function _parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) { if (is_array($options)) { $options = array_merge(array('escape' => true), $options); diff --git a/setup/wizard/lib/services/unixLucene.php b/setup/wizard/lib/services/unixLucene.php index a0409da..a87ca88 100644 --- a/setup/wizard/lib/services/unixLucene.php +++ b/setup/wizard/lib/services/unixLucene.php @@ -201,7 +201,7 @@ class unixLucene extends unixService { public function start() { $state = $this->status(); if($state != 'STARTED') { - $logFile = $this->outputDir."lucene.log"; + $logFile = $this->outputDir."log".DS."lucene.log"; @unlink($logFile); $cmd = "cd ".$this->getLuceneDir()."; "; $cmd .= "nohup java {$this->getJavaXmx()} {$this->getJavaXmx()} -jar ".$this->getLuceneSource()." > ".$logFile." 2>&1 & echo $!"; diff --git a/setup/wizard/lib/services/unixScheduler.php b/setup/wizard/lib/services/unixScheduler.php index aae16f3..6f8fada 100644 --- a/setup/wizard/lib/services/unixScheduler.php +++ b/setup/wizard/lib/services/unixScheduler.php @@ -180,7 +180,7 @@ class unixScheduler extends unixService { // TODO : Write sh on the fly? Not sure the reasoning here $source = $this->getSchedulerSourceLoc(); $this->writeSchedulerTask(); - $logFile = $this->outputDir."scheduler.log"; + $logFile = $this->outputDir."log".DS."scheduler.log"; @unlink($logFile); if($source) { // Source $cmd = "nohup ".$source." > ".$logFile." 2>&1 & echo $!"; diff --git a/setup/wizard/resources/graphics/favicon.ico b/setup/wizard/resources/graphics/favicon.ico new file mode 100644 index 0000000..72a0594 --- /dev/null +++ b/setup/wizard/resources/graphics/favicon.ico diff --git a/setup/wizard/step.php b/setup/wizard/step.php index 35edf1a..0c75811 100644 --- a/setup/wizard/step.php +++ b/setup/wizard/step.php @@ -117,15 +117,6 @@ class Step */ public $util; - /** - * Reference to utility object - * - * @author KnowledgeTree Team - * @access protected - * @var object - */ -// public $dbhandler; - public function __construct() { $this->util = new InstallUtil(); } diff --git a/setup/wizard/templates/complete.tpl b/setup/wizard/templates/complete.tpl index e422980..e78f57c 100644 --- a/setup/wizard/templates/complete.tpl +++ b/setup/wizard/templates/complete.tpl @@ -142,7 +142,7 @@ if ($install_environment == 'Zend') { ?> - " class="back" target="_blank" onclick="javascript:{w.clearSessions();}">Zend Server Configuration + diff --git a/setup/wizard/templates/error.tpl b/setup/wizard/templates/error.tpl index 67b08f0..cd3bbb3 100644 --- a/setup/wizard/templates/error.tpl +++ b/setup/wizard/templates/error.tpl @@ -1,6 +1,7 @@ + KnowledgeTree Installer @@ -15,7 +16,7 @@
3.7 - Commercial Edition + Community Edition
diff --git a/setup/wizard/templates/wizard.tpl b/setup/wizard/templates/wizard.tpl index fc68ba0..612b2b4 100644 --- a/setup/wizard/templates/wizard.tpl +++ b/setup/wizard/templates/wizard.tpl @@ -1,6 +1,7 @@ + KnowledgeTree Installer js('jquery.js'); ?> js('jquery.form.js'); ?>