From da698969afc954a496045821e5c17414f6913fa5 Mon Sep 17 00:00:00 2001 From: kevin_fourie Date: Wed, 6 Jun 2007 15:06:28 +0000 Subject: [PATCH] Merged in from DEV trunk... --- config/config.ini | 5 +++++ ktapi/ktapi.inc.php | 12 ++++++------ ktwebservice/webservice.php | 31 +++++++++++++++++++++++++++++-- setup/upgrade-title.jpg | Bin 4882 -> 0 bytes setup/upgrade.php | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------- 5 files changed, 156 insertions(+), 35 deletions(-) diff --git a/config/config.ini b/config/config.ini index 5381ec7..c62dee5 100644 --- a/config/config.ini +++ b/config/config.ini @@ -273,3 +273,8 @@ cacheDirectory = ${varDirectory}/cache debug = off ; To allow write access to WebDAV clients set safe mode to "off" below safemode = on + +[backup] +; Identify location of kt-backup for database backups. +;backupDirectory=c:/kt-backups +;backupDirectory=/tmp/kt-backups diff --git a/ktapi/ktapi.inc.php b/ktapi/ktapi.inc.php index 4098bee..b69f92f 100644 --- a/ktapi/ktapi.inc.php +++ b/ktapi/ktapi.inc.php @@ -419,9 +419,9 @@ class KTAPI_Folder extends KTAPI_FolderItem function get_detail() { $detail = array( - 'id'=>$this->folderid, + 'id'=>(int) $this->folderid, 'folder_name'=>$this->get_folder_name(), - 'parent_id'=>$this->get_parent_folder_id(), + 'parent_id'=>(int) $this->get_parent_folder_id(), 'full_path'=>$this->get_full_path(), ); @@ -430,7 +430,7 @@ class KTAPI_Folder extends KTAPI_FolderItem function get_parent_folder_id() { - return $this->folder->getParentID(); + return (int) $this->folder->getParentID(); } function get_folder_name() @@ -446,7 +446,7 @@ class KTAPI_Folder extends KTAPI_FolderItem */ function get_folderid() { - return $this->folderid; + return (int) $this->folderid; } /** @@ -1864,8 +1864,8 @@ class KTAPI_Document extends KTAPI_FolderItem $username='n/a'; } $detail['updated_by'] = $username; - $detail['document_id'] = $document->getId(); - $detail['folder_id'] = $document->getFolderID(); + $detail['document_id'] = (int) $document->getId(); + $detail['folder_id'] = (int) $document->getFolderID(); $workflowid = $document->getWorkflowId(); if (is_numeric($workflowid)) diff --git a/ktwebservice/webservice.php b/ktwebservice/webservice.php index 1453bd1..1a0b437 100644 --- a/ktwebservice/webservice.php +++ b/ktwebservice/webservice.php @@ -378,6 +378,12 @@ class KTWebService 'out' => array( 'return' => "{urn:$this->namespace}kt_response" ), ); + // checkin_base64_document + $this->__dispatch_map['checkin_base64_document'] = + array('in' => array('session_id'=>'string','document_id'=>'int','filename'=>'string','reason' =>'string','base64' =>'string', 'major_update'=>'boolean' ), + 'out' => array( 'return' => "{urn:$this->namespace}kt_response" ), + 'alias' => 'checkin_small_document' + ); // add_document $this->__dispatch_map['add_document'] = @@ -390,7 +396,16 @@ class KTWebService array('in' => array('session_id'=>'string','folder_id'=>'int','title'=>'string','filename'=>'string','documentype' =>'string','base64' =>'string' ), 'out' => array( 'return' => "{urn:$this->namespace}kt_document_detail" ), ); - + + // add_base64_document + $this->__dispatch_map['add_base64_document'] = + array('in' => array('session_id'=>'string','folder_id'=>'int','title'=>'string','filename'=>'string','documentype' =>'string','base64' =>'string' ), + 'out' => array( 'return' => "{urn:$this->namespace}kt_document_detail" ), + 'alias' => 'add_small_document' + + ); + + // get_document_detail_by_name $this->__dispatch_map['get_document_detail_by_name'] = array('in' => array('session_id' => 'string', 'document_name' => 'string', 'what'=>'string' ), @@ -409,6 +424,12 @@ class KTWebService 'out' => array('return' => "{urn:$this->namespace}kt_response" ), ); + // checkout_base64_document + $this->__dispatch_map['checkout_base64_document'] = + array('in' => array('session_id'=>'string','document_id'=>'int','reason' =>'string','download' => 'boolean'), + 'out' => array('return' => "{urn:$this->namespace}kt_response" ), + 'alias' => 'checkout_small_document' + ); // undo_document_checkout $this->__dispatch_map['undo_document_checkout'] = @@ -428,7 +449,13 @@ class KTWebService 'out' => array('return' => "{urn:$this->namespace}kt_response" ), ); - + // download_base64_document + $this->__dispatch_map['download_base64_document'] = + array('in' => array('session_id'=>'string','document_id'=>'int' ), + 'out' => array('return' => "{urn:$this->namespace}kt_response" ), + 'alias' => 'download_small_document' + ); + // delete_document $this->__dispatch_map['delete_document'] = array('in' => array('session_id'=>'string','document_id'=>'int','reason'=>'string'), diff --git a/setup/upgrade-title.jpg b/setup/upgrade-title.jpg index 0787e5c..4f73a57 100644 Binary files a/setup/upgrade-title.jpg and b/setup/upgrade-title.jpg differ diff --git a/setup/upgrade.php b/setup/upgrade.php index 5aee1c4..2fde263 100644 --- a/setup/upgrade.php +++ b/setup/upgrade.php @@ -32,6 +32,7 @@ $GLOBALS["checkup"] = true; session_start(); require_once('../config/dmsDefaults.php'); +require_once(KT_LIB_DIR . '/authentication/authenticationutil.inc.php'); require_once(KT_LIB_DIR . '/upgrades/upgrade.inc.php'); require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php'); @@ -177,8 +178,6 @@ $action = trim($_REQUEST["go"]); switch ($action) { case 'UpgradeConfirm': - upgradeConfirm(); - break; case 'UpgradePreview': UpgradePreview(); break; @@ -209,11 +208,92 @@ switch ($action) case 'RestoreDone': restoreDone(); break; + case 'Login': + login(); + break; + case 'LoginProcess': + loginProcess(); + break; default: - welcome(); + if (!isset($_SESSION['setup_user'])) + login(); + else + welcome(); break; } +function login() +{ +?> +

+The database upgrade wizard completes the upgrade process on an existing KnowledgeTree installation. It applies +any upgrades to the database that may be required. +

+Only administrator users may access the upgrade wizard. +

+ +

+ +
Username +
Password +
+
+
+getSysAdmin()) + { + $is_admin=true; + break; + } + } + + if (!$is_admin) + { + session_unset(); + loginFailed(_kt('Could not identify administrator')); + return; + } + + $authenticated = KTAuthenticationUtil::checkPassword($oUser, $password); + + if (!$authenticated) + { + session_unset(); + loginFailed(_kt('Could not authenticate user')); + return; + } + + $_SESSION['setup_user'] = $oUser; + + welcome(); +} + +function loginFailed($message) +{ + print "$message"; + login(); +} + function resolveMysqlDir() { @@ -336,11 +416,16 @@ function create_restore_stmt($targetfile) function title($title) { + if (!isset($_SESSION['setup_user'])) + { + print ""; + } print "

$title

"; } function resolveTempDir() { + if (OS_UNIX) { $dir='/tmp/kt-db-backup'; @@ -349,6 +434,9 @@ function resolveTempDir() { $dir='c:/kt-db-backup'; } + + $dir = $oKTConfig->get('backups/backupDirectory',$dir); + if (!is_dir($dir)) { mkdir($dir); @@ -374,8 +462,8 @@ function upgradeConfirm() We are about to start the upgrade process.

-       -       +       +       continue to backup to attempt the command(s) above.

-              +              - +

-       +       continue to restore to attempt the command(s) above. } ?> -       -       +       +       -       +      
-       +       -       +       -       +       - The back is now underway. Please wait till it completes. + The backup is now underway. Please wait till it completes. The mysqldump utility was not found in the subdirectory. -       +       The mysql utility was not found in the subdirectory. -       +      
-Welcome to the Database Upgrade Utility.

If you have just applied an upgrade stack installer or have updated +Welcome to the Database Upgrade Wizard.

If you have just updated your code base, you will need to complete the upgrade process in order to ensure your system is fully operational with the new version.

+You will not be able to log into until your the database upgrade process is completed. +

!!NB!! You are advised to backup the database before attempting the upgrade. !!NB!! -

If you have already done this, you may skip this step can continue directly to the upgade.

-       -       -       -       +       +       +       +      
-       -       +       +      

-       -       +       +