CC-2172 : Create Upgrade structure so that a user can upgrade from any version of Airtime properly
This commit is contained in:
parent
e56f50e8b2
commit
c4e264b936
|
@ -7,14 +7,15 @@
|
|||
*/
|
||||
|
||||
require_once(dirname(__FILE__).'/include/AirtimeIni.php');
|
||||
require_once(dirname(__FILE__).'/include/AirtimeInstall.php');
|
||||
|
||||
AirtimeIni::ExitIfNotRoot();
|
||||
|
||||
if(file_exists(dirname(__FILE__).'/../VERSION')) {
|
||||
$version = file_get_contents(dirname(__FILE__).'/../VERSION');
|
||||
echo "Airtime Version: ".$version." ".PHP_EOL;
|
||||
}
|
||||
else if(AirtimeInstall::DbTableExists('cc_show_rebroadcast') === true) {
|
||||
//if(file_exists(dirname(__FILE__).'/../VERSION')) {
|
||||
// $version = file_get_contents(dirname(__FILE__).'/../VERSION');
|
||||
// echo "Airtime Version: ".$version." ".PHP_EOL;
|
||||
//}
|
||||
if(AirtimeInstall::DbTableExists('cc_show_rebroadcast') === true) {
|
||||
$version = "1.7.0";
|
||||
echo "Airtime Version: ".$version." ".PHP_EOL;
|
||||
}
|
||||
|
@ -32,6 +33,8 @@ if(strcmp($version, "1.8.0") < 0) {
|
|||
system("php ".__DIR__."/upgrades/airtime-1.8/airtime-upgrade.php");
|
||||
}
|
||||
|
||||
AirtimeInstall::SetAirtimeVersion("1.8.0");
|
||||
|
||||
echo "******************************* Update Complete *******************************".PHP_EOL;
|
||||
|
||||
|
||||
|
|
|
@ -165,6 +165,32 @@ class AirtimeInstall {
|
|||
system($command);
|
||||
}
|
||||
|
||||
public static function SetAirtimeVersion($p_version)
|
||||
{
|
||||
global $CC_DBC;
|
||||
$sql = "DELETE FROM cc_pref WHERE keystr = 'system_version'";
|
||||
$CC_DBC->query($sql);
|
||||
|
||||
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('system_version', $p_version)";
|
||||
$result = $CC_DBC->query($sql);
|
||||
if (PEAR::isError($result)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function GetAirtimeVersion()
|
||||
{
|
||||
global $CC_DBC;
|
||||
$sql = "SELECT valstr FROM cc_pref WHERE keystr = 'system_version'";
|
||||
$version = $CC_DBC->GetOne($sql);
|
||||
|
||||
if (PEAR::isError($version)) {
|
||||
return false;
|
||||
}
|
||||
return $version;
|
||||
}
|
||||
|
||||
public static function DeleteFilesRecursive($p_path)
|
||||
{
|
||||
$command = "rm -rf $p_path";
|
||||
|
|
Loading…
Reference in New Issue