SAAS-547: Refactor upgrade procedure in 2.5.x-installer branch

* Start using "schema_version" key instead of "system_version"
* Refactored the upgrade code a bit and make it be automatically invoked
  from the Zend bootstrap if a schema update is needed.
* Fixed error logging in certain cases
* Fixed an exception in Show related to image_path
This commit is contained in:
Albert Santoni 2015-01-19 13:41:23 -05:00
parent 5abe364a69
commit 2cb26db84b
7 changed files with 81 additions and 34 deletions

View file

@ -24,9 +24,12 @@ class ErrorController extends Zend_Controller_Action
}
// Log exception, if logger available
/* No idea why this doesn't work or why it was implemented like this. Disabling it -- Albert
if (($log = $this->getLog())) {
$log->crit($this->view->message, $errors->exception);
}
}*/
//Logging that actually works: -- Albert
Logging::error($this->view->message . ": " . $errors->exception);
// conditionally display exceptions
if ($this->getInvokeArg('displayExceptions') == true) {

View file

@ -13,25 +13,19 @@ class UpgradeController extends Zend_Controller_Action
return;
}
$upgraders = array();
array_push($upgraders, new AirtimeUpgrader252());
/* These upgrades do not apply to open source Airtime yet.
array_push($upgraders, new AirtimeUpgrader253());
array_push($upgraders, new AirtimeUpgrader254());
*/
$didWePerformAnUpgrade = false;
try {
$upgradeManager = new UpgradeManager();
$didWePerformAnUpgrade = $upgradeManager->runUpgrades($upgraders, __DIR__);
$didWePerformAnUpgrade = $upgradeManager->doUpgrade();
if (!$didWePerformAnUpgrade) {
$this->getResponse()
->setHttpResponseCode(200)
->appendBody("No upgrade was performed. The current Airtime version is " . AirtimeUpgrader::getCurrentVersion() . ".<br>");
->appendBody("No upgrade was performed. The current schema version is " . Application_Model_Preference::GetSchemaVersion() . ".<br>");
} else {
$this->getResponse()
->setHttpResponseCode(200)
->appendBody("Upgrade to Airtime " . $upgrader->getNewVersion() . " OK<br>");
->appendBody("Upgrade to Airtime schema version " . Application_Model_Preference::GetSchemaVersion() . " OK<br>");
}
}
catch (Exception $e)

View file

@ -1,5 +1,6 @@
-- Replacing system_version with schema_version
DELETE FROM cc_pref WHERE keystr = 'system_version';
INSERT INTO cc_pref (keystr, valstr) VALUES ('system_version', '2.5.2');
INSERT INTO cc_pref (keystr, valstr) VALUES ('schema_version', '2.5.2');
ALTER TABLE cc_show ADD COLUMN image_path varchar(255) DEFAULT '';
ALTER TABLE cc_show_instances ADD COLUMN description varchar(255) DEFAULT '';