Delete code that was copied in twice
This commit is contained in:
parent
22b9cc3be1
commit
25e484cc2f
|
@ -77,41 +77,6 @@ class UpgradeController extends Zend_Controller_Action
|
||||||
$file = new SplFileObject($iniFile, "w");
|
$file = new SplFileObject($iniFile, "w");
|
||||||
$file->fwrite($beginning."\n".$newLines.$end);
|
$file->fwrite($beginning."\n".$newLines.$end);
|
||||||
|
|
||||||
$iniFile = isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE']."application.ini" : "/usr/share/airtime/application/configs/application.ini";
|
|
||||||
|
|
||||||
//update application.ini
|
|
||||||
$newLines = "resources.frontController.moduleDirectory = APPLICATION_PATH '/modules'\n".
|
|
||||||
"resources.frontController.plugins.putHandler = 'Zend_Controller_Plugin_PutHandler'\n".
|
|
||||||
";load everything in the modules directory including models\n".
|
|
||||||
"resources.modules[] = ''\n";
|
|
||||||
|
|
||||||
$currentIniFile = file_get_contents($iniFile);
|
|
||||||
|
|
||||||
/* We want to add the new lines immediately after the first line, '[production]'
|
|
||||||
* We read the first line into $beginning, and the rest of the file into $end.
|
|
||||||
* Then overwrite the current application.ini file with $beginning, $newLines, and $end
|
|
||||||
*/
|
|
||||||
$lines = explode("\n", $currentIniFile);
|
|
||||||
$beginning = implode("\n", array_slice($lines, 0,1));
|
|
||||||
|
|
||||||
//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;
|
|
||||||
}
|
|
||||||
$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;
|
|
||||||
}
|
|
||||||
$file = new SplFileObject($iniFile, "w");
|
|
||||||
$file->fwrite($beginning."\n".$newLines.$end);
|
|
||||||
|
|
||||||
//delete maintenance.txt to give users access back to Airtime
|
//delete maintenance.txt to give users access back to Airtime
|
||||||
unlink($maintenanceFile);
|
unlink($maintenanceFile);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue