. * * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, * California 94120-7775, or email info@knowledgetree.com. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices * must display the words "Powered by KnowledgeTree" and retain the original * copyright notice. * Contributor( s): ______________________________________ * */ $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'); function generateUpgradeTable () { global $default; $query = sprintf('SELECT value FROM %s WHERE name = "databaseVersion"', $default->system_settings_table); $lastVersion = DBUtil::getOneResultKey($query, 'value'); $currentVersion = $default->systemVersion; $upgrades = describeUpgrade($lastVersion, $currentVersion); $ret = "
| Code | Description | Applied |
|---|---|---|
| %s | %s | %s |
Logging support is not currently working. Check post-installation checkup.
'; exit(1); } if (PEAR::isError($dbSupport)) { print 'Database support is not currently working. Check post-installation checkup or refresh this page (F5) to try again.
'; exit(1); } ?>
|
The database upgrade wizard completes the upgrade process on an existing installation. It applies any upgrades to the database that may be required. Only administrator users may access the upgrade wizard. $message"; login(); } function resolveMysqlDir() { // possibly detect existing installations: if (OS_UNIX) { $dirs = array('/opt/mysql/bin','/usr/local/mysql/bin'); $mysqlname ='mysql'; } else { $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') != false) { $dirs [] = realpath(dirname($FILE) . '/../../mysql/bin'); } foreach($dirs as $dir) { if (is_file($dir . '/' . $mysqlname)) { return $dir; } } return ''; } function create_backup_stmt($targetfile=null) { $oKTConfig =& KTConfig::getSingleton(); $adminUser = $oKTConfig->get('db/dbAdminUser'); $adminPwd = $oKTConfig->get('db/dbAdminPass'); $dbHost = $oKTConfig->get('db/dbHost'); $dbName = $oKTConfig->get('db/dbName'); $dbPort = trim($oKTConfig->get('db/dbPort')); if (empty($dbPort) || $dbPort=='default') $dbPort = get_cfg_var('mysql.default_port'); if (empty($dbPort)) $dbPort='3306'; $dbSocket = trim($oKTConfig->get('db/dbSocket')); if (empty($dbSocket) || $dbSocket=='default') $dbSocket = get_cfg_var('mysql.default_socket'); if (empty($dbSocket)) $dbSocket='../tmp/mysql.sock'; $date=date('Y-m-d-H-i-s'); $dir=resolveMysqlDir(); $info['dir']=$dir; $prefix=''; if (OS_UNIX) { $prefix .= "./"; } if (@stat($dbSocket) !== false) { $mechanism="--socket=\"$dbSocket\""; } else { $mechanism="--port=\"$dbPort\""; } $tmpdir=resolveTempDir(); if (is_null($targetfile)) { $targetfile="$tmpdir/kt-backup-$date.sql"; } $stmt = $prefix . "mysqldump --user=\"$adminUser\" -p $mechanism \"$dbName\" > \"$targetfile\""; $info['display']=$stmt; $info['target']=$targetfile; $stmt = $prefix. "mysqldump --user=\"$adminUser\" --password=\"$adminPwd\" $mechanism \"$dbName\" > \"$targetfile\""; $info['cmd']=$stmt; return $info; } function create_restore_stmt($targetfile) { $oKTConfig =& KTConfig::getSingleton(); $adminUser = $oKTConfig->get('db/dbAdminUser'); $adminPwd = $oKTConfig->get('db/dbAdminPass'); $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'); if (empty($dbPort)) $dbPort='3306'; $dbSocket = trim($oKTConfig->get('db/dbSocket')); if (empty($dbSocket) || $dbSocket=='default') $dbSocket = get_cfg_var('mysql.default_socket'); if (empty($dbSocket)) $dbSocket='../tmp/mysql.sock'; $dir=resolveMysqlDir(); $info['dir']=$dir; $prefix=''; if (OS_UNIX) { $prefix .= "./"; } if (@stat($dbSocket) !== false) { $mechanism="--socket=\"$dbSocket\""; } else { $mechanism="--port=\"$dbPort\""; } $tmpdir=resolveTempDir(); $stmt = $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism drop \"$dbName\" "; $stmt .= $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism create \"$dbName\" "; $stmt .= $prefix ."mysql --user=\"$adminUser\" -p $mechanism \"$dbName\" < \"$targetfile\"\n"; $info['display']=$stmt; $stmt = $prefix ."mysqladmin --user=\"$adminUser\" --force --password=\"$adminPwd\" $mechanism drop \"$dbName\"\n"; $stmt .= $prefix ."mysqladmin --user=\"$adminUser\" --password=\"$adminPwd\" $mechanism create \"$dbName\"\n"; $stmt .= $prefix ."mysql --user=\"$adminUser\" --password=\"$adminPwd\" $mechanism \"$dbName\" < \"$targetfile\""; $info['cmd']=$stmt; return $info; } function title($title) { if (!isset($_SESSION['setup_user'])) { print ""; } print " $title"; } function resolveTempDir() { if (OS_UNIX) { $dir='/tmp/kt-db-backup'; } else { $dir='c:/kt-db-backup'; } $oKTConfig =& KTConfig::getSingleton(); $dir = $oKTConfig->get('backup/backupDirectory',$dir); if (!is_dir($dir)) { mkdir($dir); } return $dir; } function upgradeConfirm() { title('Confirm Upgrade'); if (!isset($_SESSION['backupStatus']) || $_SESSION['backupStatus'] === false) { ?>Please ensure that you have made a backup before continuing with the upgrade process.
We are about to start the upgrade process. Are you sure you want to perform the backup? Your mysql installation has been resolved. Manually, you would do the following:
|