diff --git a/setup/migrate/session.php b/setup/migrate/session.php index cea3d4b..35e7a7a 100644 --- a/setup/migrate/session.php +++ b/setup/migrate/session.php @@ -175,7 +175,7 @@ class Session * @access public * @return void */ - public function destroy() { + public function destroyMigrate() { $this->startSession(); unset($_SESSION[$this->salt]); session_destroy(); diff --git a/setup/migrate/steps/migrateComplete.php b/setup/migrate/steps/migrateComplete.php index 6419327..b341586 100644 --- a/setup/migrate/steps/migrateComplete.php +++ b/setup/migrate/steps/migrateComplete.php @@ -84,10 +84,7 @@ class migrateComplete extends Step { private function checkSqlDump() { $database = $this->getDataFromSession("database"); // Get installation directory // TODO - $sqlFile = $_SESSION['database']['dumpLocation']; -// $tmpFolder = $database['dumpLocation']; -// $sqlFile = $tmpFolder."dms.sql"; - //echo $sqlFile; + $sqlFile = $_SESSION['migrate']['database']['dumpLocation']; if(file_exists($sqlFile)) { $this->temp_variables['sql']['class'] = "tick"; $this->temp_variables['sql']['name'] = "dms.sql"; diff --git a/setup/migrate/steps/migrateDatabase.php b/setup/migrate/steps/migrateDatabase.php index 494bab1..267f363 100644 --- a/setup/migrate/steps/migrateDatabase.php +++ b/setup/migrate/steps/migrateDatabase.php @@ -301,7 +301,7 @@ function resolveTempDir() private function storeSilent() { // TODO - $_SESSION['database']['dumpLocation'] = $this->sqlDumpFile; + $_SESSION['migrate']['database']['dumpLocation'] = $this->sqlDumpFile; $this->temp_variables['dumpLocation'] = $this->sqlDumpFile; } diff --git a/setup/upgrade.php b/setup/upgrade.php index 1d74f05..d69b03f 100644 --- a/setup/upgrade.php +++ b/setup/upgrade.php @@ -35,1125 +35,5 @@ * 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: - -
|