Add downgrade action to UpgradeController, fix SoundCloud schema and bugs

This commit is contained in:
Duncan Sommerville 2015-06-24 18:38:04 -04:00
parent 8fcaf7fc74
commit 67155b136a
14 changed files with 361 additions and 93 deletions

View file

@ -33,4 +33,35 @@ class UpgradeController extends Zend_Controller_Action
->appendBody($e->getMessage());
}
}
public function downgradeAction() {
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
if (!RestAuth::verifyAuth(true, false, $this)) {
return;
}
$request = $this->getRequest();
$toVersion = $request->getParam("version");
try {
$downgradePerformed = UpgradeManager::doDowngrade($toVersion);
if (!$downgradePerformed) {
$this->getResponse()
->setHttpResponseCode(200)
->appendBody("No downgrade was performed. The current schema version is " . Application_Model_Preference::GetSchemaVersion() . ".<br>");
} else {
$this->getResponse()
->setHttpResponseCode(200)
->appendBody("Downgrade to Airtime schema version " . Application_Model_Preference::GetSchemaVersion() . " OK<br>");
}
} catch (Exception $e) {
$this->getResponse()
->setHttpResponseCode(400)
->appendBody($e->getMessage());
}
}
}