diff --git a/classes/install/Installer.inc.php b/classes/install/Installer.inc.php index e7f7082..2489ddc 100644 --- a/classes/install/Installer.inc.php +++ b/classes/install/Installer.inc.php @@ -290,6 +290,9 @@ class Installer { function updateVersion() { if ($this->newVersion->compare($this->currentVersion) > 0) { if ($this->getParam('manualInstall')) { + // Mark old version as no longer current + $this->executeSQL(sprintf('UPDATE versions SET current = 0 WHERE product = %s', $this->dbconn->qstr($this->currentVersion->getProduct()))); + // FIXME Would be better to have a mode where $dbconn->execute() saves the query return $this->executeSQL(sprintf('INSERT INTO versions (major, minor, revision, build, date_installed, current, product_type, product, product_class_name, lazy_load, sitewide) VALUES (%d, %d, %d, %d, NOW(), 1, %s, %s, %s, %d, %d)', $this->newVersion->getMajor(), $this->newVersion->getMinor(), $this->newVersion->getRevision(), $this->newVersion->getBuild(), $this->dbconn->qstr($this->newVersion->getProductType()), $this->dbconn->qstr($this->newVersion->getProduct()), $this->dbconn->qstr($this->newVersion->getProductClassName()), ($this->newVersion->getLazyLoad()?1:0), ($this->newVersion->getSitewide()?1:0))); } else { diff --git a/classes/site/VersionDAO.inc.php b/classes/site/VersionDAO.inc.php index d438d52..1e8c1d0 100644 --- a/classes/site/VersionDAO.inc.php +++ b/classes/site/VersionDAO.inc.php @@ -139,7 +139,8 @@ class VersionDAO extends DAO { $isNewVersion = false; } elseif ($version->compare($oldVersion) == 1) { // Version to insert is newer than the existing version entry. - // We'll update the existing entry below. + // We reset existing entry. + $this->update('UPDATE versions SET current = 0 WHERE current = 1 AND product = ?', $version->getProduct()); } else { // We do not support downgrades. fatalError('You are trying to downgrade the product "'.$version->getProduct().'" from version ['.$oldVersion->getVersionString().'] to version ['.$version->getVersionString().']. Downgrades are not supported.');