Airtime 1.9.5 upgrade script

This commit is contained in:
Martin Konecny 2011-11-02 15:34:47 -04:00
parent 4c5386c0f3
commit 3675e3c6e7
2 changed files with 40 additions and 0 deletions

View file

@ -77,6 +77,9 @@ if (strcmp($version, "1.9.3") < 0){
if (strcmp($version, "1.9.4") < 0){
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-1.9.4/airtime-upgrade.php");
}
if (strcmp($version, "1.9.5") < 0){
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-1.9.5/airtime-upgrade.php");
}
//set the new version in the database.
$sql = "DELETE FROM cc_pref WHERE keystr = 'system_version'";

View file

@ -0,0 +1,37 @@
<?php
require_once(dirname(__FILE__).'/../../include/AirtimeInstall.php');
class Airtime194Upgrade{
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
const CONF_PYPO_GRP = "pypo";
public static function BackupHtaccess($phpDir){
exec("mkdir -p /tmp");
exec("cp $phpDir/public/.htaccess /tmp");
}
public static function RestoreHtaccess($phpDir){
exec("cp /tmp/.htaccess $phpDir/public/");
exec("rm -f /tmp/.htaccess");
}
public static function InstallAirtimePhpServerCode($phpDir)
{
self::BackupHtaccess($phpDir);
$AIRTIME_SRC = realpath(__DIR__.'/../../../airtime_mvc');
echo "* Installing PHP code to ".$phpDir.PHP_EOL;
exec("rm -rf \"$phpDir\"");
exec("mkdir -p $phpDir");
exec("cp -R ".$AIRTIME_SRC."/* ".$phpDir);
self::RestoreHtaccess($phpDir);
}
}
$values = parse_ini_file(Airtime194Upgrade::CONF_FILE_AIRTIME, true);
$phpDir = $values['general']['airtime_dir'];
Airtime194Upgrade::InstallAirtimePhpServerCode($phpDir);