CC-5814: 'Down for maintenance' page during upgrades
This commit is contained in:
parent
069ebd3991
commit
f536a7b1b4
5 changed files with 36 additions and 0 deletions
|
@ -18,4 +18,9 @@ class IndexController extends Zend_Controller_Action
|
|||
$this->_helper->layout->setLayout('layout');
|
||||
}
|
||||
|
||||
public function maintenanceAction()
|
||||
{
|
||||
$this->getResponse()->setHttpResponseCode(503);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,12 @@ class UpgradeController extends Zend_Controller_Action
|
|||
return;
|
||||
}
|
||||
|
||||
//Disable Airtime UI
|
||||
//create a temporary maintenance notification file
|
||||
$maintenanceFile = '/tmp/maintenance.txt';
|
||||
$file = fopen($maintenanceFile, 'w');
|
||||
fclose($file);
|
||||
|
||||
//Begin upgrade
|
||||
$filename = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
||||
$values = parse_ini_file($filename, true);
|
||||
|
@ -75,6 +81,8 @@ class UpgradeController extends Zend_Controller_Action
|
|||
$file = new SplFileObject($iniFile, "w");
|
||||
$file->fwrite($beginning."\n".$newLines.$end);
|
||||
|
||||
unlink($maintenanceFile);
|
||||
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200)
|
||||
->appendBody("Upgrade to Airtime 2.5.3 OK");
|
||||
|
|
15
airtime_mvc/application/controllers/plugins/Maintenance.php
Normal file
15
airtime_mvc/application/controllers/plugins/Maintenance.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
class Zend_Controller_Plugin_Maintenance extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
protected $maintenanceFile = '/tmp/maintenance.txt';
|
||||
|
||||
public function preDispatch(Zend_Controller_Request_Abstract $request) {
|
||||
if (file_exists($this->maintenanceFile)) {
|
||||
$request->setModuleName('default')
|
||||
->setControllerName('index')
|
||||
->setActionName('maintenance')
|
||||
->setDispatched(true);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue