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
57ad1beaa9
|
@ -27,31 +27,22 @@ class UpgradeController extends Zend_Controller_Action
|
||||||
$maintenanceFile = $_SERVER['AIRTIME_BASE']."maintenance.txt";
|
$maintenanceFile = $_SERVER['AIRTIME_BASE']."maintenance.txt";
|
||||||
$file = fopen($maintenanceFile, 'w');
|
$file = fopen($maintenanceFile, 'w');
|
||||||
fclose($file);
|
fclose($file);
|
||||||
|
|
||||||
//Begin upgrade
|
//Begin upgrade
|
||||||
$filename = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
|
||||||
$values = parse_ini_file($filename, true);
|
|
||||||
|
|
||||||
$username = $values['database']['dbuser'];
|
|
||||||
$password = $values['database']['dbpass'];
|
|
||||||
$host = $values['database']['host'];
|
|
||||||
$database = $values['database']['dbname'];
|
|
||||||
$dir = __DIR__;
|
|
||||||
|
|
||||||
passthru("export PGPASSWORD=$password && psql -h $host -U $username -q -f $dir/upgrade_sql/airtime_$airtime_upgrade_version/upgrade.sql $database 2>&1 | grep -v \"will create implicit index\"");
|
|
||||||
|
|
||||||
|
//Update disk_usage value in cc_pref
|
||||||
$storDir = isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE']."srv/airtime/stor" : "/srv/airtime/stor";
|
$storDir = isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE']."srv/airtime/stor" : "/srv/airtime/stor";
|
||||||
$diskUsage = shell_exec("du -sb $storDir | awk '{print $1}'");
|
$diskUsage = shell_exec("du -sb $storDir | awk '{print $1}'");
|
||||||
|
|
||||||
Application_Model_Preference::setDiskUsage($diskUsage);
|
Application_Model_Preference::setDiskUsage($diskUsage);
|
||||||
|
|
||||||
$iniFile = isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE']."application.ini" : "/usr/share/airtime/application/configs/application.ini";
|
|
||||||
|
|
||||||
//update application.ini
|
//update application.ini
|
||||||
$newLines = "resources.frontController.moduleDirectory = APPLICATION_PATH '/modules'\n".
|
$iniFile = isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE']."application.ini" : "/usr/share/airtime/application/configs/application.ini";
|
||||||
"resources.frontController.plugins.putHandler = 'Zend_Controller_Plugin_PutHandler'\n".
|
|
||||||
|
$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".
|
";load everything in the modules directory including models\n".
|
||||||
"resources.modules[] = ''\n";
|
"resources.modules[] = \"\"\n";
|
||||||
|
|
||||||
$currentIniFile = file_get_contents($iniFile);
|
$currentIniFile = file_get_contents($iniFile);
|
||||||
|
|
||||||
|
@ -73,7 +64,8 @@ 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);
|
||||||
|
|
||||||
|
|
||||||
//delete maintenance.txt to give users access back to Airtime
|
//delete maintenance.txt to give users access back to Airtime
|
||||||
unlink($maintenanceFile);
|
unlink($maintenanceFile);
|
||||||
|
|
||||||
|
@ -81,6 +73,19 @@ class UpgradeController extends Zend_Controller_Action
|
||||||
|
|
||||||
$con->commit();
|
$con->commit();
|
||||||
|
|
||||||
|
//update system_version in cc_pref and change some columns in cc_files
|
||||||
|
$airtimeConf = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
||||||
|
$values = parse_ini_file($airtimeConf, true);
|
||||||
|
|
||||||
|
$username = $values['database']['dbuser'];
|
||||||
|
$password = $values['database']['dbpass'];
|
||||||
|
$host = $values['database']['host'];
|
||||||
|
$database = $values['database']['dbname'];
|
||||||
|
$dir = __DIR__;
|
||||||
|
|
||||||
|
passthru("export PGPASSWORD=$password && psql -h $host -U $username -q -f $dir/upgrade_sql/airtime_$airtime_upgrade_version/upgrade.sql $database 2>&1 | grep -v \"will create implicit index\"");
|
||||||
|
|
||||||
|
|
||||||
$this->getResponse()
|
$this->getResponse()
|
||||||
->setHttpResponseCode(200)
|
->setHttpResponseCode(200)
|
||||||
->appendBody("Upgrade to Airtime 2.5.3 OK");
|
->appendBody("Upgrade to Airtime 2.5.3 OK");
|
||||||
|
|
|
@ -65,8 +65,10 @@ if ($return_code == 0) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop media-monitor
|
// Stop media-monitor and disable it -- Airtime 2.5.3+
|
||||||
service media-monitor stop-with-monit
|
@exec("service media-monitor stop-with-monit");
|
||||||
|
@exec("rm /etc/init.d/airtime-media-monitor");
|
||||||
|
|
||||||
|
|
||||||
//convert strings like 1.9.0-devel to 1.9.0
|
//convert strings like 1.9.0-devel to 1.9.0
|
||||||
$version = substr($version, 0, 5);
|
$version = substr($version, 0, 5);
|
||||||
|
|
Loading…
Reference in New Issue