CC-5781: Upgrade script for new storage quota implementation

Returns error if API key is incorrect
Set the upgrade controller to skip login authentication
This commit is contained in:
drigato 2014-04-10 09:28:23 -04:00
parent bae0c564d0
commit b9b3e95caa
2 changed files with 5 additions and 5 deletions

View File

@ -17,10 +17,11 @@ class UpgradeController extends Zend_Controller_Action
//Decode the API key that was passed to us in the HTTP request.
$authHeader = $this->getRequest()->getHeader("Authorization");
$encodedRequestApiKey = substr($authHeader, strlen("Basic "));
$encodedStoredApiKey = base64_encode($CC_CONFIG["apiKey"][0] . ":");
if (!$encodedRequestApiKey === $encodedStoredApiKey)
if ($encodedRequestApiKey !== $encodedStoredApiKey)
{
$this->getResponse()
->setHttpResponseCode(401)
@ -46,8 +47,7 @@ class UpgradeController extends Zend_Controller_Action
$database = $values['database']['dbname'];
$dir = __DIR__;
passthru("export PGPASSWORD=$password && psql -h $host -U $username -q -f $dir/upgrade_sql/airtime_$airtime_version/upgrade.sql $database 2>&1 | grep -v \"will create implicit index\"");
passthru("export PGPASSWORD=$password && psql -h $host -U $username -q -f $dir/upgrade_sql/airtime_$airtime_upgrade_version/upgrade.sql $database 2>&1 | grep -v \"will create implicit index\"");
$musicDir = CcMusicDirsQuery::create()
->filterByType('stor')

View File

@ -117,7 +117,7 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
return;
}
if (in_array($controller, array("api", "auth", "locale"))) {
if (in_array($controller, array("api", "auth", "locale", "upgrade"))) {
$this->setRoleName("G");
} elseif (!Zend_Auth::getInstance()->hasIdentity()) {