diff --git a/config/config.ini b/config/config.ini index c62dee5..8f194ad 100644 --- a/config/config.ini +++ b/config/config.ini @@ -278,3 +278,6 @@ safemode = on ; Identify location of kt-backup for database backups. ;backupDirectory=c:/kt-backups ;backupDirectory=/tmp/kt-backups + +; Identify the location of the mysql.exe and mysqldump.exe +;mysqlDirectory=c:/program files/ktdms/mysql/bin diff --git a/ktapi/ktapi.inc.php b/ktapi/ktapi.inc.php index 842a4e5..0ff308b 100644 --- a/ktapi/ktapi.inc.php +++ b/ktapi/ktapi.inc.php @@ -31,14 +31,16 @@ */ session_start(); -require_once('../config/dmsDefaults.php'); +require_once(KT_DIR . '/config/dmsDefaults.php'); require_once(KT_LIB_DIR . '/filelike/fsfilelike.inc.php'); require_once(KT_LIB_DIR . '/foldermanagement/folderutil.inc.php'); -require_once('KTAPIConstants.inc.php'); -require_once('KTAPISession.inc.php'); -require_once('KTAPIFolder.inc.php'); -require_once('KTAPIDocument.inc.php'); +define('KTAPI_DIR',KT_DIR . '/ktapi'); + +require_once(KTAPI_DIR .'/KTAPIConstants.inc.php'); +require_once(KTAPI_DIR .'/KTAPISession.inc.php'); +require_once(KTAPI_DIR .'/KTAPIFolder.inc.php'); +require_once(KTAPI_DIR .'/KTAPIDocument.inc.php'); class KTAPI_FolderItem { diff --git a/setup/upgrade.php b/setup/upgrade.php index 191148b..0eb67c2 100644 --- a/setup/upgrade.php +++ b/setup/upgrade.php @@ -295,10 +295,7 @@ function loginFailed($message) } function resolveMysqlDir() -{ - - - +{ // possibly detect existing installations: if (OS_UNIX) @@ -310,15 +307,18 @@ function resolveMysqlDir() { $dirs = explode(';', $_SERVER['PATH']); $dirs[] ='c:/Program Files/MySQL/MySQL Server 5.0/bin'; + $dirs[] = 'c:/program files/ktdms/mysql/bin'; $mysqlname ='mysql.exe'; } + $oKTConfig =& KTConfig::getSingleton(); + $mysqldir = $oKTConfig->get('backup/mysqlDirectory',$mysqldir); + $dirs[] = $mysqldir; - - if (strpos(__FILE__,'knowledgeTree') !== false && strpos(__FILE__,'ktdms')) + if (strpos(__FILE__,'knowledgeTree') !== false && strpos(__FILE__,'ktdms') != false) { $dirs [] = realpath(dirname($FILE) . '/../../mysql/bin'); - } + } foreach($dirs as $dir) { @@ -435,7 +435,7 @@ function resolveTempDir() $dir='c:/kt-db-backup'; } $oKTConfig =& KTConfig::getSingleton(); - $dir = $oKTConfig->get('backups/backupDirectory',$dir); + $dir = $oKTConfig->get('backup/backupDirectory',$dir); if (!is_dir($dir)) { @@ -496,7 +496,7 @@ Your mysql installation has been resolved. Manually, you would do the following: else { ?> -It appears as though you are not using the stack installer, or are using a custom install. +The mysql backup utility could not be found automatically. Either do a manual backup, or edit the config.ini and update the backup/mysqlDirectory entry.
You can continue to do the backup manually using the following process:
@@ -638,7 +638,7 @@ Manually, you would do the following to restore the backup: else { ?> -It appears as though you are not using the stack installer, or are using a custom install. +The mysql backup utility could not be found automatically. Either do a manual restore, or edit the config.ini and update the backup/mysqlDirectory entry.
You can continue to do the restore manually using the following command(s):
@@ -718,7 +718,7 @@ function backupDone() else { ?> - It appears as though you are not using the stack installer, or are using a custom install. + The mysql backup utility could not be found automatically. Please edit the config.ini and update the backup/mysqlDirectory entry.
If you need to restore from this backup, you should be able to use the following statements:
@@ -861,6 +861,11 @@ function backup() $dir=resolveTempDir(); $_SESSION['backupFile'] = $stmt['target']; + if (OS_UNIX) + { + chmod($stmt['target'],0600); + } + if (is_file($stmt['target']) && filesize($stmt['target']) > 0) { $_SESSION['backupStatus'] = true; diff --git a/tests/api/authentication.php b/tests/api/authentication.php index 810b374..e560e84 100644 --- a/tests/api/authentication.php +++ b/tests/api/authentication.php @@ -16,6 +16,11 @@ class APIAuthenticationTestCase extends KTUnitTestCase $this->assertTrue(is_a($session,'KTAPI_UserSession')); $this->assertTrue($session->is_active()); + $ktapi = new KTAPI(); + $session = $ktapi->get_active_session($session->session); + $this->assertTrue(is_a($session,'KTAPI_UserSession')); + + $session->logout(); $this->assertFalse($session->is_active()); } @@ -27,7 +32,7 @@ class APIAuthenticationTestCase extends KTUnitTestCase $session = $ktapi->start_system_session(); $this->assertTrue(is_a($session,'KTAPI_SystemSession')); $this->assertTrue($session->is_active()); - + $session->logout(); $this->assertFalse($session->is_active()); } @@ -40,6 +45,11 @@ class APIAuthenticationTestCase extends KTUnitTestCase $this->assertTrue(is_a($session,'KTAPI_AnonymousSession')); $this->assertTrue($session->is_active()); + $ktapi = new KTAPI(); + $session = $ktapi->get_active_session($session->session); + $this->assertTrue(is_a($session,'KTAPI_AnonymousSession')); + + $session->logout(); $this->assertFalse($session->is_active()); }