CC-5802: Upgrade application.ini file
Changed where we insert new application.ini file lines
This commit is contained in:
parent
61df7c1a44
commit
66000a2847
|
@ -52,18 +52,20 @@ class UpgradeController extends Zend_Controller_Action
|
||||||
|
|
||||||
$currentIniFile = file_get_contents($iniFile);
|
$currentIniFile = file_get_contents($iniFile);
|
||||||
|
|
||||||
/* We want to add the new lines immediately after the first line, '[production]'
|
/* We want to add the new lines after a specific line. So we must find read the file
|
||||||
* We read the first line into $beginning, and the rest of the file into $end.
|
* into an array, find the key to which our desired line belongs, and use the key
|
||||||
* Then overwrite the current application.ini file with $beginning, $newLines, and $end
|
* to split the file in two halves, $beginning and $end.
|
||||||
|
* The $newLines will go inbetween $beginning and $end
|
||||||
*/
|
*/
|
||||||
$lines = explode("\n", $currentIniFile);
|
$lines = explode("\n", $currentIniFile);
|
||||||
$beginning = implode("\n", array_slice($lines, 0,1));
|
|
||||||
|
$key = array_search("resources.layout.layoutPath = APPLICATION_PATH \"/layouts/scripts/\"", $lines);
|
||||||
//check that first line is '[production]'
|
if (!$key) {
|
||||||
if ($beginning != '[production]') {
|
throw new Exception('Upgrade to Airtime 2.5.3 FAILED. Could not upgrade application.ini');
|
||||||
throw new Exception('Upgrade to Airtime 2.5.3 FAILED. Could not upgrade application.ini - Invalid format');
|
|
||||||
}
|
}
|
||||||
$end = implode("\n", array_slice($lines, 1));
|
|
||||||
|
$beginning = implode("\n", array_slice($lines, 0, $key));
|
||||||
|
$end = implode("\n", array_slice($lines, $key));
|
||||||
|
|
||||||
if (!is_writeable($iniFile)) {
|
if (!is_writeable($iniFile)) {
|
||||||
throw new Exception('Upgrade to Airtime 2.5.3 FAILED. Could not upgrade application.ini - Permission denied.');
|
throw new Exception('Upgrade to Airtime 2.5.3 FAILED. Could not upgrade application.ini - Permission denied.');
|
||||||
|
|
Loading…
Reference in New Issue