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:
parent
bae0c564d0
commit
b9b3e95caa
|
@ -17,10 +17,11 @@ class UpgradeController extends Zend_Controller_Action
|
||||||
|
|
||||||
//Decode the API key that was passed to us in the HTTP request.
|
//Decode the API key that was passed to us in the HTTP request.
|
||||||
$authHeader = $this->getRequest()->getHeader("Authorization");
|
$authHeader = $this->getRequest()->getHeader("Authorization");
|
||||||
|
|
||||||
$encodedRequestApiKey = substr($authHeader, strlen("Basic "));
|
$encodedRequestApiKey = substr($authHeader, strlen("Basic "));
|
||||||
$encodedStoredApiKey = base64_encode($CC_CONFIG["apiKey"][0] . ":");
|
$encodedStoredApiKey = base64_encode($CC_CONFIG["apiKey"][0] . ":");
|
||||||
|
|
||||||
if (!$encodedRequestApiKey === $encodedStoredApiKey)
|
if ($encodedRequestApiKey !== $encodedStoredApiKey)
|
||||||
{
|
{
|
||||||
$this->getResponse()
|
$this->getResponse()
|
||||||
->setHttpResponseCode(401)
|
->setHttpResponseCode(401)
|
||||||
|
@ -46,8 +47,7 @@ class UpgradeController extends Zend_Controller_Action
|
||||||
$database = $values['database']['dbname'];
|
$database = $values['database']['dbname'];
|
||||||
$dir = __DIR__;
|
$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()
|
$musicDir = CcMusicDirsQuery::create()
|
||||||
->filterByType('stor')
|
->filterByType('stor')
|
||||||
|
|
|
@ -117,7 +117,7 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($controller, array("api", "auth", "locale"))) {
|
if (in_array($controller, array("api", "auth", "locale", "upgrade"))) {
|
||||||
|
|
||||||
$this->setRoleName("G");
|
$this->setRoleName("G");
|
||||||
} elseif (!Zend_Auth::getInstance()->hasIdentity()) {
|
} elseif (!Zend_Auth::getInstance()->hasIdentity()) {
|
||||||
|
|
Loading…
Reference in New Issue