diff --git a/lib/dispatcher.inc.php b/lib/dispatcher.inc.php index 788ae24..9b695da 100644 --- a/lib/dispatcher.inc.php +++ b/lib/dispatcher.inc.php @@ -343,8 +343,8 @@ class KTStandardDispatcher extends KTDispatcher { } function loginRequired() { - $oKTConfig =& KTConfig::getSingleton(); - if ($oKTConfig->get('allowAnonymousLogin', false)) { + $oKTConfig =& KTConfig::getSingleton(); + if ($oKTConfig->get('allowAnonymousLogin', false)) { // anonymous logins are now allowed. // the anonymous user is -1. // @@ -352,9 +352,9 @@ class KTStandardDispatcher extends KTDispatcher { $oUser =& User::get(-2); if (PEAR::isError($oUser) || ($oUser->getName() != 'Anonymous')) { - ; // do nothing - the database integrity would break if we log the user in now. + ; // do nothing - the database integrity would break if we log the user in now. } else { - $session = new Session(); + $session = new Session(); $sessionID = $session->create($oUser); $this->sessionStatus = $this->session->verify(); if ($this->sessionStatus === true) { diff --git a/lib/session/Session.inc b/lib/session/Session.inc index 0d4aeb5..f1d4758 100644 --- a/lib/session/Session.inc +++ b/lib/session/Session.inc @@ -228,7 +228,7 @@ class Session { // Compare the system version and the database version to determine if the database needs to be upgraded. $version = KTUtil::getSystemSetting('databaseVersion'); - if ($default->systemVersion != $version) { + if (trim($default->systemVersion) != trim($version)) { if (KTLOG_CACHE) $default->log->info("Session::verify : Database not upgraded"); $_SESSION['errormessage']['login'] = sprintf(_kt('Database incompatibility error:
Please ensure that you have completed the database upgrade procedure.
Please click here to complete.'),'setup/upgrade.php'); return PEAR::raiseError($_SESSION['errormessage']['login']); diff --git a/setup/upgrade/lib/UpgradeItems.inc.php b/setup/upgrade/lib/UpgradeItems.inc.php index 692958b..4ed2cd5 100644 --- a/setup/upgrade/lib/UpgradeItems.inc.php +++ b/setup/upgrade/lib/UpgradeItems.inc.php @@ -269,7 +269,7 @@ class SQLUpgradeItem extends UpgradeItem { * * STATIC */ - function getUpgrades($origVersion, $currVersion) { + public static function getUpgrades($origVersion, $currVersion) { // global $default; // $sqlupgradedir = KT_DIR . '/sql/' . $default->dbType . '/upgrade/'; @@ -343,7 +343,7 @@ class SQLUpgradeItem extends UpgradeItem { return $ret; } - function _getDetailsFromFileName($path) { + public static function _getDetailsFromFileName($path) { // Old format (pre 2.0.6) $matched = preg_match('#^([\d.]*)-to-([\d.]*).sql$#', $path, $matches); if ($matched != 0) { diff --git a/setup/upgrade/lib/upgrade.inc.php b/setup/upgrade/lib/upgrade.inc.php index f083351..c3dcd18 100644 --- a/setup/upgrade/lib/upgrade.inc.php +++ b/setup/upgrade/lib/upgrade.inc.php @@ -92,25 +92,24 @@ function &describeUpgrade ($origVersion, $currVersion) { // How to figure out what upgrades to do: // // 1. Get all SQL upgrades >= origVersion and <= currVersion - // 2. Get all Function upgrades >= origVersion and <= currVersion - // 3. Categorise each into version they upgrade to - // 4. Sort each version subgroup into correct order + // 2. Categorise each into version they upgrade to + // 3. Sort each version subgroup into correct order // 5. Add "recordSubUpgrade" for each version there. - // 6. Add back into one big list again - // 7. Add "recordUpgrade" for whole thing + // 5. Add back into one big list again + // 6. Add "recordUpgrade" for whole thing // $recordUpgrade = array('upgrade*' . $currVersion, 'Upgrade to ' . $currVersion, null); $steps = array(); foreach (array('SQLUpgradeItem') as $itemgen) { $f = array($itemgen, 'getUpgrades'); - $ssteps =& call_user_func($f, $origVersion, $currVersion); + $ssteps = call_user_func($f, $origVersion, $currVersion); $scount = count($ssteps); for ($i = 0; $i < $scount; $i++) { $steps[] =& $ssteps[$i]; } } - $upgradestep =& new RecordUpgradeItem($currVersion, $origVersion); + $upgradestep = new RecordUpgradeItem($currVersion, $origVersion); $steps[] =& $upgradestep; $stepcount = count($steps); for ($i = 0; $i < $stepcount; $i++) { diff --git a/setup/upgrade/steps/upgradeDatabase.php b/setup/upgrade/steps/upgradeDatabase.php index ac34dca..ef5d3fd 100644 --- a/setup/upgrade/steps/upgradeDatabase.php +++ b/setup/upgrade/steps/upgradeDatabase.php @@ -169,15 +169,16 @@ class upgradeDatabase extends Step $this->sysVersion = $this->readVersion(); $this->temp_variables['systemVersion'] = $this->sysVersion; $dconf = $this->util->iniUtilities->getSection('db'); - $query = sprintf('SELECT value FROM %s WHERE name = "databaseVersion"', 'system_settings'); $this->util->dbUtilities->load($dconf['dbHost'], '', $dconf['dbUser'], $dconf['dbPass'], $dconf['dbName']); + + $query = sprintf('SELECT value FROM %s WHERE name = "databaseVersion"', 'system_settings'); $result = $this->util->dbUtilities->query($query); $assArr = $this->util->dbUtilities->fetchAssoc($result); if ($result) { $lastVersion = $assArr[0]['value']; } $currentVersion = $this->sysVersion; - require_once("lib/upgrade.inc.php"); + $upgrades = describeUpgrade($lastVersion, $currentVersion); $ret = "\n"; $ret .= "\n";
CodeDescriptionApplied