CC-2806: Create upgrade template file
-initial commit
This commit is contained in:
parent
1593313805
commit
b9863e660e
6 changed files with 1264 additions and 386 deletions
|
@ -19,6 +19,25 @@ if(exec("whoami") != "root"){
|
|||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* This class is responsible for tasks that need to be executed only *once*
|
||||
* per upgrade, even if it's upgrading over multiple versions of Airtime. */
|
||||
class AirtimeMasterUpgrade{
|
||||
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
|
||||
|
||||
public static function InstallAirtimePhpServerCode($phpDir)
|
||||
{
|
||||
$AIRTIME_SRC = realpath(__DIR__.'/../../airtime_mvc');
|
||||
|
||||
// delete old files
|
||||
exec("rm -rf \"$phpDir\"");
|
||||
echo "* Installing PHP code to ".$phpDir.PHP_EOL;
|
||||
exec("mkdir -p ".$phpDir);
|
||||
exec("cp -R ".$AIRTIME_SRC."/* ".$phpDir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
global $CC_DBC, $CC_CONFIG;
|
||||
|
||||
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
|
||||
|
@ -86,6 +105,13 @@ if (strcmp($version, "2.0.0") < 0){
|
|||
$sql = "DELETE FROM cc_pref WHERE keystr = 'system_version'";
|
||||
$CC_DBC->query($sql);
|
||||
|
||||
$values = parse_ini_file(AirtimeMasterUpgrade::CONF_FILE_AIRTIME, true);
|
||||
$phpDir = $values['general']['airtime_dir'];
|
||||
AirtimeMasterUpgrade::InstallAirtimePhpServerCode($phpDir);
|
||||
AirtimeInstall::InstallBinaries();
|
||||
AirtimeInstall::CreateSymlinksToUtils();
|
||||
|
||||
|
||||
$newVersion = AIRTIME_VERSION;
|
||||
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('system_version', '$newVersion')";
|
||||
$CC_DBC->query($sql);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue