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;
|
||||
}
|
||||
|
||||
$con = Propel::getConnection();
|
||||
$con->beginTransaction();
|
||||
try {
|
||||
//Disable Airtime UI
|
||||
//create a temporary maintenance notification file
|
||||
//when this file is on the server, zend framework redirects all
|
||||
//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');
|
||||
fclose($file);
|
||||
|
||||
|
@ -61,18 +64,12 @@ class UpgradeController extends Zend_Controller_Action
|
|||
|
||||
//check that first line is '[production]'
|
||||
if ($beginning != '[production]') {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(400)
|
||||
->appendBody('Upgrade to Airtime 2.5.3 FAILED. Could not upgrade application.ini');
|
||||
return;
|
||||
throw new Exception('Upgrade to Airtime 2.5.3 FAILED. Could not upgrade application.ini - Invalid format');
|
||||
}
|
||||
$end = implode("\n", array_slice($lines, 1));
|
||||
|
||||
if (!is_writeable($iniFile)) {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(400)
|
||||
->appendBody('Upgrade to Airtime 2.5.3 FAILED. Could not upgrade application.ini');
|
||||
return;
|
||||
throw new Exception('Upgrade to Airtime 2.5.3 FAILED. Could not upgrade application.ini - Permission denied.');
|
||||
}
|
||||
$file = new SplFileObject($iniFile, "w");
|
||||
$file->fwrite($beginning."\n".$newLines.$end);
|
||||
|
@ -82,9 +79,19 @@ class UpgradeController extends Zend_Controller_Action
|
|||
|
||||
//TODO: clear out the cache
|
||||
|
||||
$con->commit();
|
||||
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200)
|
||||
->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()
|
||||
|
|
Loading…
Reference in New Issue