diff --git a/bin/system_info.php b/bin/system_info.php
index e31108c..8c3ae59 100644
--- a/bin/system_info.php
+++ b/bin/system_info.php
@@ -49,7 +49,6 @@ require_once('../config/dmsDefaults.php');
global $default;
$default->log->debug('System information collection script starting...');
-$cache_file = $default->cacheDirectory . '/system_info';
// Get installation guid
function getGuid()
@@ -167,44 +166,11 @@ function sendForm($data)
curl_close($ch);
}
-// Check the last time the call home executed
-function checkRunTime($cache_file)
-{
- if(!file_exists($cache_file)){
- return true;
- }
-
- $run_time = trim(file_get_contents($cache_file));
- $now = time();
-
- if($run_time < $now){
- return true;
- }
-
- return false;
-}
-
-// update the time of the last call home execution
-function updateRunTime($cache_file)
-{
- // Generate the time for the next call
- $now = time();
- $period = rand(12, 36);
- $next = $now + (60*60*$period);
-
- file_put_contents($cache_file, $next);
-}
-
-if(!checkRunTime($cache_file)){
- exit(0);
-}
-
$post_str = getGuid() .'|'. getUserCnt() .'|'. getDocCnt() .'|'. getKTVersion() .'|'. getKTEdition() .'|'. getOSInfo();
$data['system_info'] = $post_str;
sendForm($data);
-updateRunTime($cache_file);
$default->log->debug('System information collection script finishing.');
exit(0);
-?>
\ No newline at end of file
+?>
diff --git a/plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php b/plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php
index cade322..b1a232a 100644
--- a/plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php
+++ b/plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php
@@ -265,7 +265,6 @@ class MyDropDocumentsPage extends KTStandardDispatcher {
function getUsersDocument($sUserName, $iDropDocsFolderID)
{
$oUser = $this->oUser;
-
$oDropDocsFolder = Folder::get($iDropDocsFolderID);
$fullPath = $oDropDocsFolder->getFullPath() . '/' . $sUserName;
@@ -338,20 +337,7 @@ class MyDropDocumentsPage extends KTStandardDispatcher {
}
}
- $sUserName = (string)$this->oUser->getUserName();
- $subFolders = Folder::getByParentId($iDropDocsFolderID);
-
- $myDropFolder = false;
- foreach ($subFolders as $sub){
- if($sub->getName() == $sUserName){
- $myDropFolder = $sub;
- break;
- }
- }
-
- $iMyDropDocsFolderID = $myDropFolder->getID();
-
- $location = 'browse.php?fFolderId='.$iMyDropDocsFolderID;
+ $location = 'browse.php?fFolderId='.$iMyDocsFolderID;
$sReturnTable .= ''.
''.
'
'.
diff --git a/plugins/ktcore/KTWidgets.php b/plugins/ktcore/KTWidgets.php
index a88aedb..1ff2053 100755
--- a/plugins/ktcore/KTWidgets.php
+++ b/plugins/ktcore/KTWidgets.php
@@ -967,6 +967,7 @@ class KTCoreTextAreaWidget extends KTWidget {
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate('ktcore/forms/widgets/base');
+ $this->aJavascript[] = 'thirdpartyjs/jquery/jquery-1.3.2.js';
$this->aJavascript[] = 'thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js';
$this->aJavascript[] = 'resources/js/kt_tinymce_init.js';
diff --git a/setup/migrate/migrateUtil.php b/setup/migrate/migrateUtil.php
index 9f8b573..28fd474 100644
--- a/setup/migrate/migrateUtil.php
+++ b/setup/migrate/migrateUtil.php
@@ -62,15 +62,15 @@ class MigrateUtil extends InstallUtil {
public function error($error) {
$template_vars['error'] = $error;
$file = "templates/error.tpl";
- if (file_exists($file)) {
- extract($template_vars); // Extract the vars to local namespace
- ob_start();
- include($file);
- $contents = ob_get_contents();
- ob_end_clean();
- echo $contents;
+ if (!file_exists($file)) {
+ return false;
}
- return false;
+ extract($template_vars); // Extract the vars to local namespace
+ ob_start();
+ include($file);
+ $contents = ob_get_contents();
+ ob_end_clean();
+ echo $contents;
}
/**
diff --git a/setup/migrate/migrateWizard.php b/setup/migrate/migrateWizard.php
index a03c2d1..0b099e7 100644
--- a/setup/migrate/migrateWizard.php
+++ b/setup/migrate/migrateWizard.php
@@ -52,17 +52,17 @@ function __autoload($class) { // Attempt and autoload classes
if ($class == "template") { // Load existing templating classes
require_once("../wizard/template.php");
require_once("../wizard/lib/helpers/htmlHelper.php");
-
+ return ;
+ }
+ if(file_exists(WIZARD_DIR."$class.php")) {
+ require_once(WIZARD_DIR."$class.php");
+ } elseif (file_exists(STEP_DIR."$class.php")) {
+ require_once(STEP_DIR."$class.php");
+ } elseif (file_exists(WIZARD_LIB."$class.php")) {
+ require_once(WIZARD_LIB."$class.php");
} else {
- if(file_exists(WIZARD_DIR."$class.php")) {
- require_once(WIZARD_DIR."$class.php");
- } elseif (file_exists(STEP_DIR."$class.php")) {
- require_once(STEP_DIR."$class.php");
- } elseif (file_exists(WIZARD_LIB."$class.php")) {
- require_once(WIZARD_LIB."$class.php");
- }
+ return null;
}
- return true;
}
class MigrateWizard {
@@ -233,6 +233,8 @@ class MigrateWizard {
return true;
break;
}
+
+ return $res;
}
/**
@@ -259,7 +261,7 @@ class MigrateWizard {
}
} else {
// TODO: Die gracefully
- $this->util->error("System has been migrated Goto Login");
+ $this->util->error("System has been migrated Goto Login");
}
}
}
diff --git a/setup/migrate/migrater.php b/setup/migrate/migrater.php
index 86f78f5..249fa36 100644
--- a/setup/migrate/migrater.php
+++ b/setup/migrate/migrater.php
@@ -157,7 +157,7 @@ class Migrater {
$this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name);
} catch (Exception $e) {
$util = new MigrateUtil();
- $util->error("Error reading configuration file: $e");
+ $util->error("Error reading configuration file: $name");
exit();
}
}
@@ -431,7 +431,8 @@ class Migrater {
if($class->runMigrate()) { // Check if step needs to be migrated
$class->setDataFromSession($className); // Set Session Information
$class->setPostConfig(); // Set any posted variables
- $class->migrateStep(); // Run migrate step
+ $response = $class->migrateStep(); // Run migrate step
+ // TODO : Break on error response
}
} else {
$util = new MigrateUtil();
diff --git a/setup/migrate/step.php b/setup/migrate/step.php
index 9188209..897b710 100644
--- a/setup/migrate/step.php
+++ b/setup/migrate/step.php
@@ -186,6 +186,30 @@ class Step
}
/**
+ * Load default step values
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function loadDefaults() {
+
+ }
+
+ /**
+ * Return default step values
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return array
+ */
+ public function getDefaults() {
+ return array();
+ }
+
+ /**
* Checks if edit button has been clicked
*
* @author KnowledgeTree Team
diff --git a/setup/migrate/stepAction.php b/setup/migrate/stepAction.php
index e6ac993..30724ed 100644
--- a/setup/migrate/stepAction.php
+++ b/setup/migrate/stepAction.php
@@ -229,14 +229,12 @@ class stepAction {
} else {
$this->_clearErrors($this->stepName); // Send Errors to session
}
+ return $response;
} else {
$this->stepName = 'errors';
$this->action = $this->createStep();
$this->action->error = array('Class File Missing in Step Directory');
- $response = '';
}
-
- return $response;
}
/**
@@ -310,7 +308,7 @@ class stepAction {
$menu = '';
$active = false;
if($this->stepClassNames) {
- foreach ($this->stepClassNames as $step) {
+ foreach ($this->stepClassNames as $k=>$step) {
if($this->step_names[$step] != '') {
$item = $this->step_names[$step];
} else {
@@ -454,7 +452,7 @@ class stepAction {
* @access private
* @return void
*/
- private function _loadValueToSession($class, $k, $v) {
+ private function _loadValueToSession($class, $k, $v, $overwrite = false) {
if($this->session != null) {
$this->session->setClass($class, $k, $v);
} else {
@@ -504,7 +502,8 @@ class stepAction {
* @access private
* @return void
*/
- private function _loadErrorToSession($class, $k = "errors", $v) {
+ private function _loadErrorToSession($class, $k, $v, $overwrite = false) {
+ $k = "errors";
if($this->session != null) {
$this->session->setClassError($class, $k, $v);
} else {
diff --git a/setup/migrate/steps/migrateDatabase.php b/setup/migrate/steps/migrateDatabase.php
index d0eaaa3..26fb90b 100644
--- a/setup/migrate/steps/migrateDatabase.php
+++ b/setup/migrate/steps/migrateDatabase.php
@@ -122,11 +122,13 @@ class migrateDatabase extends Step
$manual = false; // If file was exported manually
$dbSettings = $installation['dbSettings'];
$location = $installation['location'];
+ $uname = $this->temp_variables['duname'];
+ $pwrd = $this->temp_variables['dpassword'];
$port = $this->util->getPort($location);
$tmpFolder = $this->resolveTempDir();
if(WINDOWS_OS) {
$termOrBash = "command prompt window";
- $exe = "\"$location".DS."mysql".DS."bin".DS."mysqldump.exe\""; // Location of dump
+ $exe = "\"$location\mysql\bin\mysqldump.exe\""; // Location of dump
} else {
$termOrBash = "terminal window";
$exe = "'$location/mysql/bin/mysqldump'"; // Location of dump
@@ -145,7 +147,7 @@ class migrateDatabase extends Step
if(!$manual) { // Try to export database
$sqlFile = $tmpFolder."/kt-backup-$date.sql";
$cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile;
- $this->util->pexec($cmd);
+ $response = $this->util->pexec($cmd);
}
if(file_exists($sqlFile)) {
$fileContents = file_get_contents($sqlFile);
@@ -155,14 +157,10 @@ class migrateDatabase extends Step
}
}
// Handle failed dump
- if(WINDOWS_OS) {
- $sqlFile = "\"C:\kt-backup-$date.sql\""; // Use tmp instead due to permissions
- } else {
- $sqlFile = "/tmp/kt-backup-$date.sql"; // Use tmp instead due to permissions
- }
+ $sqlFile = "/tmp/kt-backup-$date.sql"; // Use tmp instead due to permissions
$cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile;
- $this->error[]['error'] = "Could not export database";
- $this->error[]['msg'] = "Execute the following command in a $termOrBash:";
+ $this->error[]['error'] = "Could not export database:";
+ $this->error[]['msg'] = "Execute the following command in a $termOrBash.";
$this->error[]['cmd'] = $cmd;
$this->temp_variables['manual_export'] = $sqlFile;
diff --git a/setup/migrate/steps/migrateInstallation.php b/setup/migrate/steps/migrateInstallation.php
index a7cea9b..07230bb 100644
--- a/setup/migrate/steps/migrateInstallation.php
+++ b/setup/migrate/steps/migrateInstallation.php
@@ -162,7 +162,6 @@ class migrateInstallation extends step
if($this->foundVersion < $this->supportedVersion) {
$this->versionError = true;
$this->error[] = "KT installation needs to be 3.6.1 or higher";
- return false;
} else {
return true;
}
@@ -223,8 +222,6 @@ class migrateInstallation extends step
} else {
$this->error[] = "Please Enter a Location";
}
-
- return false;
}
private function loadConfig($path) {
@@ -245,6 +242,7 @@ class migrateInstallation extends step
}
$this->ktSettings = array('fileSystemRoot'=> $froot,
);
+ $urlPaths = $ini->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/steps/migrateServices.php b/setup/migrate/steps/migrateServices.php
index 50f9e5b..b0bc18e 100644
--- a/setup/migrate/steps/migrateServices.php
+++ b/setup/migrate/steps/migrateServices.php
@@ -202,11 +202,11 @@ class migrateServices extends Step
*/
public function unixStop() {
$cmd = $this->conf['location']."/dmsctl.sh stop lucene";
- $this->util->pexec($cmd);
+ $res = $this->util->pexec($cmd);
$cmd = $this->conf['location']."/dmsctl.sh stop scheduler";
- $this->util->pexec($cmd);
+ $res = $this->util->pexec($cmd);
$cmd = $this->conf['location']."/dmsctl.sh stop soffice";
- $this->util->pexec($cmd);
+ $res = $this->util->pexec($cmd);
}
/**
@@ -215,11 +215,11 @@ class migrateServices extends Step
*/
public function windowsStop() {
$cmd = "sc delete KTLucene";
- $this->util->pexec($cmd);
+ $res = $this->util->pexec($cmd);
$cmd = "sc delete KTScheduler";
- $this->util->pexec($cmd);
+ $res = $this->util->pexec($cmd);
$cmd = "sc delete KTOpenoffice";
- $this->util->pexec($cmd);
+ $res = $this->util->pexec($cmd);
}
/**
@@ -233,7 +233,7 @@ class migrateServices extends Step
$serv->load();
$sStatus = $serv->status();
if($sStatus != '') {
- $serv->uninstall();
+ $res = $serv->uninstall();
}
}
}
diff --git a/setup/upgrade/step.php b/setup/upgrade/step.php
index 0b8c103..49890fd 100644
--- a/setup/upgrade/step.php
+++ b/setup/upgrade/step.php
@@ -172,6 +172,30 @@ class Step
public function getWarnings() {
return $this->warnings;
}
+
+ /**
+ * Load default step values
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function loadDefaults() {
+
+ }
+
+ /**
+ * Return default step values
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return array
+ */
+ public function getDefaults() {
+ return array();
+ }
/**
* Checks if edit button has been clicked
diff --git a/setup/upgrade/stepAction.php b/setup/upgrade/stepAction.php
index 48083f0..438df77 100644
--- a/setup/upgrade/stepAction.php
+++ b/setup/upgrade/stepAction.php
@@ -229,14 +229,12 @@ class stepAction {
} else {
$this->_clearErrors($this->stepName); // Send Errors to session
}
+ return $response;
} else {
$this->stepName = 'errors';
$this->action = $this->createStep();
$this->action->error = array('Class File Missing in Step Directory');
- $response = '';
}
-
- return $response;
}
/**
@@ -310,7 +308,7 @@ class stepAction {
$menu = '';
$active = false;
if($this->stepClassNames) {
- foreach ($this->stepClassNames as $step) {
+ foreach ($this->stepClassNames as $k=>$step) {
if($this->step_names[$step] != '') {
$item = $this->step_names[$step];
} else {
@@ -454,7 +452,7 @@ class stepAction {
* @access private
* @return void
*/
- private function _loadValueToSession($class, $k, $v) {
+ private function _loadValueToSession($class, $k, $v, $overwrite = false) {
if($this->session != null) {
$this->session->setClass($class, $k, $v);
} else {
@@ -504,7 +502,8 @@ class stepAction {
* @access private
* @return void
*/
- private function _loadErrorToSession($class, $k = "errors", $v) {
+ private function _loadErrorToSession($class, $k, $v, $overwrite = false) {
+ $k = "errors";
if($this->session != null) {
$this->session->setClassError($class, $k, $v);
} else {
diff --git a/setup/upgrade/steps/upgradeBackup.php b/setup/upgrade/steps/upgradeBackup.php
index ba5219e..6977416 100644
--- a/setup/upgrade/steps/upgradeBackup.php
+++ b/setup/upgrade/steps/upgradeBackup.php
@@ -120,7 +120,7 @@ class upgradeBackup extends Step {
if (is_file($dir . '/mysqladmin') || is_file($dir . '/mysqladmin.exe'))
{
-// $curdir=getcwd();
+ $curdir=getcwd();
chdir($dir);
$handle = popen($stmt['cmd'], 'r');
@@ -198,7 +198,7 @@ class upgradeBackup extends Step {
$adminUser = $oKTConfig->get('db/dbAdminUser');
$adminPwd = $oKTConfig->get('db/dbAdminPass');
-// $dbHost = $oKTConfig->get('db/dbHost');
+ $dbHost = $oKTConfig->get('db/dbHost');
$dbName = $oKTConfig->get('db/dbName');
$dbPort = trim($oKTConfig->get('db/dbPort'));
diff --git a/setup/upgrade/steps/upgradeDatabase.php b/setup/upgrade/steps/upgradeDatabase.php
index 945db30..f58f571 100644
--- a/setup/upgrade/steps/upgradeDatabase.php
+++ b/setup/upgrade/steps/upgradeDatabase.php
@@ -144,10 +144,10 @@ class upgradeDatabase extends Step
$this->readConfig(KTConfig::getConfigFilename());
if($this->dbSettings['dbPort'] == '') {
- $this->dbhandler->load($this->dbSettings['dbHost'], $this->dbSettings['dbUser'],
+ $con = $this->dbhandler->load($this->dbSettings['dbHost'], $this->dbSettings['dbUser'],
$this->dbSettings['dbPass'], $this->dbSettings['dbName']);
} else {
- $this->dbhandler->load($this->dbSettings['dbHost'].":".$this->dbSettings['dbPort'], $this->dbSettings['dbUser'],
+ $con = $this->dbhandler->load($this->dbSettings['dbHost'].":".$this->dbSettings['dbPort'], $this->dbSettings['dbUser'],
$this->dbSettings['dbPass'], $this->dbSettings['dbName']);
}
@@ -285,8 +285,7 @@ class upgradeDatabase extends Step
}
$res = $this->performAllUpgrades();
-// if (PEAR::isError($res) || PEAR::isError($pres)) {
- if (PEAR::isError($res)) {
+ if (PEAR::isError($res) || PEAR::isError($pres)) {
$errors = true;
// TODO instantiate error details hideable section?
$this->temp_variables['upgradeStatus'] = 'Database upgrade failed
@@ -301,8 +300,7 @@ class upgradeDatabase extends Step
}
$post_pres = $this->performPostUpgradeActions();
-// if (PEAR::isError($post_res)) {
- if (PEAR::isError($post_pres)) {
+ if (PEAR::isError($post_res)) {
$errors = true;
$this->temp_variables['postUpgrade'] = 'Post-Upgrade actions failed.';
}
@@ -336,7 +334,7 @@ class upgradeDatabase extends Step
// Ensure all plugins are re-registered.
$sql = "TRUNCATE plugin_helper";
- DBUtil::runQuery($sql);
+ $res = DBUtil::runQuery($sql);
// Clear out all caches and proxies - they need to be regenerated with the new code
$proxyDir = $default->proxyCacheDirectory;
diff --git a/setup/upgrade/steps/upgradeRestore.php b/setup/upgrade/steps/upgradeRestore.php
index 25a6aa8..270978f 100644
--- a/setup/upgrade/steps/upgradeRestore.php
+++ b/setup/upgrade/steps/upgradeRestore.php
@@ -111,14 +111,14 @@ class upgradeRestore extends Step {
private function restoreDatabase()
{
$this->temp_variables['restore'] = true;
-// $status = $_SESSION['backupStatus'];
+ $status = $_SESSION['backupStatus'];
$filename = $_SESSION['backupFile'];
$stmt = $this->util->create_restore_stmt($filename);
$dir = $stmt['dir'];
if (is_file($dir . '/mysql') || is_file($dir . '/mysql.exe'))
{
-// $curdir=getcwd();
+ $curdir=getcwd();
chdir($dir);
$ok=true;
@@ -181,11 +181,9 @@ class upgradeRestore extends Step {
$dir = $this->util->resolveTempDir();
$files = array();
- $dh = opendir($dir);
- if ($dh)
+ if ($dh = opendir($dir))
{
- $file = readdir($dh);
- while ($file !== false)
+ while (($file = readdir($dh)) !== false)
{
if (!preg_match('/kt-backup.+\.sql/',$file)) {
continue;
@@ -219,7 +217,7 @@ class upgradeRestore extends Step {
return;
}
-// $status = $_SESSION['backupStatus'];
+ $status = $_SESSION['backupStatus'];
$filename = $_SESSION['backupFile'];
$stmt = $this->util->create_restore_stmt($filename);
diff --git a/setup/upgrade/steps/upgradeWelcome.php b/setup/upgrade/steps/upgradeWelcome.php
index c07b07f..0082985 100644
--- a/setup/upgrade/steps/upgradeWelcome.php
+++ b/setup/upgrade/steps/upgradeWelcome.php
@@ -81,7 +81,7 @@ class upgradeWelcome extends step {
}
private function checkPassword($username, $password) {
-// global $default;
+ global $default;
$sTable = KTUtil::getTableName('users');
$sQuery = "SELECT count(*) AS match_count FROM $sTable WHERE username = ? AND password = ?";
diff --git a/setup/upgrade/templates/complete.tpl b/setup/upgrade/templates/complete.tpl
index a10016a..52eb513 100644
--- a/setup/upgrade/templates/complete.tpl
+++ b/setup/upgrade/templates/complete.tpl
@@ -9,5 +9,5 @@
Your database has been upgraded to systemVersion; ?>
- Goto Login
+ Goto Login
\ No newline at end of file
diff --git a/setup/upgrade/upgradeUtil.php b/setup/upgrade/upgradeUtil.php
index a2b571b..3bc2ea5 100644
--- a/setup/upgrade/upgradeUtil.php
+++ b/setup/upgrade/upgradeUtil.php
@@ -64,16 +64,15 @@ class UpgradeUtil extends InstallUtil {
public function error($error) {
$template_vars['error'] = $error;
$file = "templates/error.tpl";
- if (file_exists($file)) {
- extract($template_vars); // Extract the vars to local namespace
- ob_start();
- include($file);
- $contents = ob_get_contents();
- ob_end_clean();
- echo $contents;
+ if (!file_exists($file)) {
+ return false;
}
-
- return false;
+ extract($template_vars); // Extract the vars to local namespace
+ ob_start();
+ include($file);
+ $contents = ob_get_contents();
+ ob_end_clean();
+ echo $contents;
}
public function loadInstallIni($path) {
@@ -100,16 +99,15 @@ class UpgradeUtil extends InstallUtil {
}
}
$file = "templates/" . $template;
- if (file_exists($file)) {
- extract($template_vars); // Extract the vars to local namespace
- ob_start();
- include($file);
- $contents = ob_get_contents();
- ob_end_clean();
- echo $contents;
+ if (!file_exists($file)) {
+ return false;
}
-
- return false;
+ extract($template_vars); // Extract the vars to local namespace
+ ob_start();
+ include($file);
+ $contents = ob_get_contents();
+ ob_end_clean();
+ echo $contents;
}
/**
@@ -135,7 +133,7 @@ class UpgradeUtil extends InstallUtil {
$adminUser = $oKTConfig->get('db/dbAdminUser');
$adminPwd = $oKTConfig->get('db/dbAdminPass');
-// $dbHost = $oKTConfig->get('db/dbHost');
+ $dbHost = $oKTConfig->get('db/dbHost');
$dbName = $oKTConfig->get('db/dbName');
$dbPort = trim($oKTConfig->get('db/dbPort'));
if ($dbPort=='' || $dbPort=='default')$dbPort = get_cfg_var('mysql.default_port');
@@ -160,7 +158,7 @@ class UpgradeUtil extends InstallUtil {
$mechanism="--port=\"$dbPort\"";
}
-// $tmpdir = $this->resolveTempDir();
+ $tmpdir = $this->resolveTempDir();
$stmt = $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism drop \"$dbName\"
";
$stmt .= $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism create \"$dbName\"
";
@@ -195,13 +193,11 @@ class UpgradeUtil extends InstallUtil {
}
$oKTConfig =& KTConfig::getSingleton();
-// $mysqldir = $oKTConfig->get('backup/mysqlDirectory',$mysqldir);
- $mysqldir = $oKTConfig->get('backup/mysqlDirectory');
+ $mysqldir = $oKTConfig->get('backup/mysqlDirectory',$mysqldir);
$dirs[] = $mysqldir;
if (strpos(__FILE__,'knowledgeTree') !== false && strpos(__FILE__,'ktdms') != false) {
-// $dirs [] = realpath(dirname($FILE) . '/../../mysql/bin');
- $dirs [] = realpath('/../../mysql/bin');
+ $dirs [] = realpath(dirname($FILE) . '/../../mysql/bin');
}
foreach($dirs as $dir)
diff --git a/setup/upgrade/upgradeWizard.php b/setup/upgrade/upgradeWizard.php
index b05ca5c..fa2b6b3 100644
--- a/setup/upgrade/upgradeWizard.php
+++ b/setup/upgrade/upgradeWizard.php
@@ -52,17 +52,17 @@ function __autoload($class) { // Attempt and autoload classes
if ($class == "template") { // Load existing templating classes
require_once("../wizard/template.php");
require_once("../wizard/lib/helpers/htmlHelper.php");
+ return ;
+ }
+ if(file_exists(WIZARD_DIR."$class.php")) {
+ require_once(WIZARD_DIR."$class.php");
+ } elseif (file_exists(STEP_DIR."$class.php")) {
+ require_once(STEP_DIR."$class.php");
+ } elseif (file_exists(WIZARD_LIB."$class.php")) {
+ require_once(WIZARD_LIB."$class.php");
} else {
- if(file_exists(WIZARD_DIR."$class.php")) {
- require_once(WIZARD_DIR."$class.php");
- } elseif (file_exists(STEP_DIR."$class.php")) {
- require_once(STEP_DIR."$class.php");
- } elseif (file_exists(WIZARD_LIB."$class.php")) {
- require_once(WIZARD_LIB."$class.php");
- }
+ return null;
}
-
- return true;
}
class UpgradeWizard {
@@ -191,7 +191,26 @@ class UpgradeWizard {
* @return mixed
*/
public function systemChecks() {
- return true; // for now we don't write to any locations
+ // for now we don't write to any of these locations
+ return true;
+
+ $res = $this->util->checkStructurePermissions();
+ if($res === true) return $res;
+ switch ($res) {
+ case "wizard":
+ $this->util->error("Upgrader directory is not writable (KT_Installation_Directory/setup/upgrade/)");
+ return 'Upgrader directory is not writable (KT_Installation_Directory/setup/upgrade/)';
+ break;
+ case "/":
+ $this->util->error("System root is not writable (KT_Installation_Directory/)");
+ return "System root is not writable (KT_Installation_Directory/)";
+ break;
+ default:
+ return true;
+ break;
+ }
+
+ return $res;
}
/**
diff --git a/setup/upgrade/upgrader.php b/setup/upgrade/upgrader.php
index 55bdffb..30dedf9 100644
--- a/setup/upgrade/upgrader.php
+++ b/setup/upgrade/upgrader.php
@@ -157,7 +157,7 @@ class Upgrader {
$this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name);
} catch (Exception $e) {
$util = new UpgradeUtil();
- $util->error("Error reading configuration file: $e");
+ $util->error("Error reading configuration file: $name");
exit();
}
}
@@ -431,7 +431,8 @@ class Upgrader {
if($class->runUpgrade()) { // Check if step needs to be upgraded
$class->setDataFromSession($className); // Set Session Information
$class->setPostConfig(); // Set any posted variables
- $class->upgradeStep(); // Run upgrade step
+ $response = $class->upgradeStep(); // Run upgrade step
+ // TODO : Break on error response
}
} else {
$util = new UpgradeUtil();
diff --git a/setup/wizard/iniUtilities.php b/setup/wizard/iniUtilities.php
index c9dc4fa..b036724 100644
--- a/setup/wizard/iniUtilities.php
+++ b/setup/wizard/iniUtilities.php
@@ -63,12 +63,11 @@ class iniUtilities {
return false;
}
$date = date('YmdHis');
+
$backupFile = $iniFile . '.' .$date;
if (is_writeable($backupFile)) {
file_put_contents($backupFile, $content);
}
-
- return true;
}
function read($iniFile) {
@@ -154,20 +153,13 @@ class iniUtilities {
}
function itemExists($checkSection, $checkItem) {
-/*
- foreach ($items as $key => $value) {
- if($key == $checkItem) {
- return true;
- }
- }
-*/
+
$this->exists = '';
foreach($this->cleanArray as $section => $items) {
if($section == $checkSection) {
$this->exists = 'section';
- $items = array_flip($items);
- foreach ($items as $value) {
- if($value == $checkItem) {
+ foreach ($items as $key => $value) {
+ if($key == $checkItem) {
return true;
}
}
diff --git a/setup/wizard/installUtil.php b/setup/wizard/installUtil.php
index 2e59356..25452f5 100644
--- a/setup/wizard/installUtil.php
+++ b/setup/wizard/installUtil.php
@@ -70,16 +70,15 @@ class InstallUtil {
public function error($error) {
$template_vars['error'] = $error;
$file = "templates/error.tpl";
- if (file_exists($file)) {
- extract($template_vars); // Extract the vars to local namespace
- ob_start();
- include($file);
- $contents = ob_get_contents();
- ob_end_clean();
- echo $contents;
+ if (!file_exists($file)) {
+ return false;
}
-
- return false;
+ extract($template_vars); // Extract the vars to local namespace
+ ob_start();
+ include($file);
+ $contents = ob_get_contents();
+ ob_end_clean();
+ echo $contents;
}
/**
* Check if system needs to be installed
@@ -166,8 +165,7 @@ class InstallUtil {
return $url;
}
if (!empty($protocol)) {
- $array = explode(':', $url, 2);
- $url = $protocol .':'. end($array);
+ $url = $protocol .':'. end($array = explode(':', $url, 2));
}
if (!empty($port)) {
$url = preg_replace('!^(([a-z0-9]+)://[^/:]+)(:[\d]+)?!i',
@@ -323,15 +321,13 @@ class InstallUtil {
while (($file = readdir($dh)) !== false) {
if($file != '.' && $file != '..') {
$fullpath = $path.'/'.$file;
- if(is_link($fullpath)) {
+ if(is_link($fullpath))
return false;
- } elseif(!is_dir($fullpath)) {
+ elseif(!is_dir($fullpath)) {
$perms = substr(sprintf('%o', fileperms($fullpath)), -4);
- if($perms != $filemode) {
- if (!chmod($fullpath, $filemode)) {
+ if($perms != $filemode)
+ if (!chmod($fullpath, $filemode))
return false;
- }
- }
} elseif(!$this->chmodRecursive($fullpath, $filemode))
return false;
}
@@ -358,8 +354,7 @@ class InstallUtil {
*/
public function canWriteFile($filename) {
$fh = fopen($filename, "w+");
- $fr = fwrite($fh, 'test');
- if($fr === false) {
+ if($fr = fwrite($fh, 'test') === false) {
return false;
}
@@ -377,9 +372,9 @@ class InstallUtil {
*/
public function javaBridge() {
try {
- new Java('java.lang.System');
+ $javaSystem = new Java('java.lang.System');
} catch (JavaException $e) {
- return $e;
+ return false;
}
return true;
}
@@ -768,7 +763,6 @@ class InstallUtil {
* @return string
*/
public function installEnvironment() {
- $matches = false;
preg_match('/Zend/', SYSTEM_DIR, $matches); // Install Type
if($matches) {
return 'Zend';
@@ -798,7 +792,7 @@ class InstallUtil {
array_pop($sysdir);
array_pop($sysdir);
$zendsys = '';
- foreach ($sysdir as $v) {
+ foreach ($sysdir as $k=>$v) {
$zendsys .= $v.DS;
}
return $zendsys."ZendServer".DS."bin".DS;
@@ -821,16 +815,15 @@ class InstallUtil {
if(WINDOWS_OS) { // Mysql bin [Windows]
$serverPaths = explode(';',$_SERVER['PATH']);
foreach ($serverPaths as $apath) {
- $matches = false;
preg_match('/mysql/i', $apath, $matches);
if($matches) {
return $apath.DS;
break;
}
}
+ } else {
+ return "mysql"; // Assume its linux and can be executed from command line
}
-
- return "mysql"; // Assume its linux and can be executed from command line
}
public function sqlInstallDir() {
diff --git a/setup/wizard/installWizard.php b/setup/wizard/installWizard.php
index 986d706..72adbf1 100644
--- a/setup/wizard/installWizard.php
+++ b/setup/wizard/installWizard.php
@@ -62,13 +62,9 @@ function __autoload($class) { // Attempt and autoload classes
} else {
if(preg_match('/Helper/', $class)) {
require_once(HELPER_DIR."$class.php");
- } else if(preg_match('/Test/i', $class)) {
- if($_GET['step'] != '') {
- require_once(TEST_DIR."$class.php");
- }
}
+ return null;
}
- return true;
}
class InstallWizard {
@@ -100,15 +96,6 @@ class InstallWizard {
protected $util = null;
/**
- * Step name
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var mixed
- */
- protected $stepName = '';
-
- /**
* Constructs installation wizard object
*
* @author KnowledgeTree Team
@@ -196,27 +183,15 @@ class InstallWizard {
}
/**
- * Is the step being accessed directly
+ * Bypass and force an install
*
* @author KnowledgeTree Team
- * @access public
- * @param none
- * @return boolean
- */
- public function isActionOnStep() {
- return $this->stepName;
- }
-
- /**
- * Set step being accessed directly
- *
- * @author KnowledgeTree Team
- * @access public
+ * @access private
* @param none
* @return boolean
*/
- private function setStep($stepName) {
- $this->stepName = $stepName;
+ private function bypass() {
+
}
/**
@@ -256,9 +231,6 @@ class InstallWizard {
if(isset($_GET['bypass'])) {
$this->setBypass($_GET['bypass']);
}
- if(isset($_GET['step'])) {
- $this->setStep($_GET['step']);
- }
if(isset($_GET['debug'])) {
$this->setDebugLevel($_GET['debug']);
} else {
@@ -291,6 +263,8 @@ class InstallWizard {
return true;
break;
}
+
+ return $res;
}
/**
@@ -304,14 +278,10 @@ class InstallWizard {
public function dispatch() {
$this->load();
if($this->getBypass() === "1") { // Helper to force install
- $this->removeInstallFile();
+ $this->removeInstallFile(); // TODO: Remove
} elseif ($this->getBypass() === "0") {
$this->createInstallFile();
}
- if($this->isActionOnStep()) { // Testing purposes
- $testStepClass = $this->stepName."Test";
- new $testStepClass();
- }
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');
@@ -326,7 +296,7 @@ class InstallWizard {
}
} else {
// TODO: Die gracefully
- $this->util->error("System has been installed Goto Login");
+ $this->util->error("System has been installed Goto Login");
}
}
}
diff --git a/setup/wizard/installer.php b/setup/wizard/installer.php
index aa4e06e..e3ae105 100644
--- a/setup/wizard/installer.php
+++ b/setup/wizard/installer.php
@@ -157,7 +157,7 @@ class Installer {
$this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name);
} catch (Exception $e) {
$util = new InstallUtil();
- $util->error("Error reading configuration file: $e");
+ $util->error("Error reading configuration file: $name");
exit();
}
}
@@ -431,7 +431,8 @@ class Installer {
if($class->runInstall()) { // Check if step needs to be installed
$class->setDataFromSession($className); // Set Session Information
$class->setPostConfig(); // Set any posted variables
- $class->installStep(); // Run install step
+ $response = $class->installStep(); // Run install step
+ // TODO : Break on error response
}
} else {
$util = new InstallUtil();
diff --git a/setup/wizard/lib/helpers/htmlHelper.php b/setup/wizard/lib/helpers/htmlHelper.php
index d2a6565..50150b5 100644
--- a/setup/wizard/lib/helpers/htmlHelper.php
+++ b/setup/wizard/lib/helpers/htmlHelper.php
@@ -41,7 +41,7 @@
*/
class htmlHelper {
- private $tags = array(
+ var $tags = array(
'meta' => '',
'metalink' => '',
'link' => '%s',
@@ -96,76 +96,76 @@ class htmlHelper {
'error' => '
';
print_r(array('service' => $this->name, 'display' => $this->name, 'path' => $this->getSchedulerScriptPath()));
echo '';
- return true;
+ return ;
}
$response = win32_create_service(array(
'service' => $this->name,
@@ -224,7 +224,7 @@ class windowsScheduler extends windowsService {
$cmd = "\"{$this->winservice}\" install $this->name $this->options";
if(DEBUG) {
echo "Command : $cmdThis wizard will lead you through all the steps required to install and configure KnowledgeTree on your server.
Press Next to continue.
+@@ -63,12 +63,12 @@
[If you feel you should be here too, please let us know at contributions@knowledgetree.com]
-This software utilizes third-party software from Pear, PHPMailer, Smarty Template Engine, Apache Tika, Mochikit, Moxiecode Systems, ExtJS, Yahoo Developer Network.
- +This software utilizes third-party software from Pear, PHPMailer, Smarty Template Engine, JSCalendar, Mochikit, Moxiecode Systems, Yahoo Developer Network.
+