Merge branch 'cc-5709-airtime-analyzer' into cc-5709-airtime-analyzer-saas
Conflicts: airtime_mvc/application/controllers/UpgradeController.php
This commit is contained in:
commit
aeec9172f9
|
@ -17,11 +17,14 @@ class UpgradeController extends Zend_Controller_Action
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$con = Propel::getConnection();
|
||||||
|
$con->beginTransaction();
|
||||||
|
try {
|
||||||
//Disable Airtime UI
|
//Disable Airtime UI
|
||||||
//create a temporary maintenance notification file
|
//create a temporary maintenance notification file
|
||||||
//when this file is on the server, zend framework redirects all
|
//when this file is on the server, zend framework redirects all
|
||||||
//requests to the maintenance page and sets a 503 response code
|
//requests to the maintenance page and sets a 503 response code
|
||||||
$maintenanceFile = '/tmp/maintenance.txt';
|
$maintenanceFile = $_SERVER['AIRTIME_BASE']."maintenance.txt";
|
||||||
$file = fopen($maintenanceFile, 'w');
|
$file = fopen($maintenanceFile, 'w');
|
||||||
fclose($file);
|
fclose($file);
|
||||||
|
|
||||||
|
@ -61,18 +64,12 @@ class UpgradeController extends Zend_Controller_Action
|
||||||
|
|
||||||
//check that first line is '[production]'
|
//check that first line is '[production]'
|
||||||
if ($beginning != '[production]') {
|
if ($beginning != '[production]') {
|
||||||
$this->getResponse()
|
throw new Exception('Upgrade to Airtime 2.5.3 FAILED. Could not upgrade application.ini - Invalid format');
|
||||||
->setHttpResponseCode(400)
|
|
||||||
->appendBody('Upgrade to Airtime 2.5.3 FAILED. Could not upgrade application.ini');
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
$end = implode("\n", array_slice($lines, 1));
|
$end = implode("\n", array_slice($lines, 1));
|
||||||
|
|
||||||
if (!is_writeable($iniFile)) {
|
if (!is_writeable($iniFile)) {
|
||||||
$this->getResponse()
|
throw new Exception('Upgrade to Airtime 2.5.3 FAILED. Could not upgrade application.ini - Permission denied.');
|
||||||
->setHttpResponseCode(400)
|
|
||||||
->appendBody('Upgrade to Airtime 2.5.3 FAILED. Could not upgrade application.ini');
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
$file = new SplFileObject($iniFile, "w");
|
$file = new SplFileObject($iniFile, "w");
|
||||||
$file->fwrite($beginning."\n".$newLines.$end);
|
$file->fwrite($beginning."\n".$newLines.$end);
|
||||||
|
@ -82,9 +79,19 @@ class UpgradeController extends Zend_Controller_Action
|
||||||
|
|
||||||
//TODO: clear out the cache
|
//TODO: clear out the cache
|
||||||
|
|
||||||
|
$con->commit();
|
||||||
|
|
||||||
$this->getResponse()
|
$this->getResponse()
|
||||||
->setHttpResponseCode(200)
|
->setHttpResponseCode(200)
|
||||||
->appendBody("Upgrade to Airtime 2.5.3 OK");
|
->appendBody("Upgrade to Airtime 2.5.3 OK");
|
||||||
|
|
||||||
|
} catch(Exception $e) {
|
||||||
|
$con->rollback();
|
||||||
|
unlink($maintenanceFile);
|
||||||
|
$this->getResponse()
|
||||||
|
->setHttpResponseCode(400)
|
||||||
|
->appendBody($e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function verifyAuth()
|
private function verifyAuth()
|
||||||
|
|
Loading…
Reference in New Issue