Cloud storage upgrade script
This commit is contained in:
parent
6cda01fba9
commit
f147fb34bb
|
@ -0,0 +1,10 @@
|
||||||
|
CREATE TABLE cloud_file
|
||||||
|
(
|
||||||
|
id serial NOT NULL,
|
||||||
|
resource_id text NOT NULL,
|
||||||
|
cc_file_id integer,
|
||||||
|
CONSTRAINT cloud_file_pkey PRIMARY KEY (id),
|
||||||
|
CONSTRAINT "cloud_file_FK_1" FOREIGN KEY (cc_file_id)
|
||||||
|
REFERENCES cc_files (id) MATCH SIMPLE
|
||||||
|
ON UPDATE NO ACTION ON DELETE CASCADE
|
||||||
|
)
|
|
@ -208,47 +208,91 @@ class AirtimeUpgrader254 extends AirtimeUpgrader
|
||||||
}
|
}
|
||||||
|
|
||||||
class AirtimeUpgrader255 extends AirtimeUpgrader {
|
class AirtimeUpgrader255 extends AirtimeUpgrader {
|
||||||
protected function getSupportedVersions() {
|
protected function getSupportedVersions() {
|
||||||
return array (
|
return array (
|
||||||
'2.5.4'
|
'2.5.4'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNewVersion() {
|
public function getNewVersion() {
|
||||||
return '2.5.5';
|
return '2.5.5';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function upgrade($dir = __DIR__) {
|
public function upgrade($dir = __DIR__) {
|
||||||
Cache::clear();
|
Cache::clear();
|
||||||
assert($this->checkIfUpgradeSupported());
|
assert($this->checkIfUpgradeSupported());
|
||||||
|
|
||||||
$newVersion = $this->getNewVersion();
|
$newVersion = $this->getNewVersion();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->toggleMaintenanceScreen(true);
|
$this->toggleMaintenanceScreen(true);
|
||||||
Cache::clear();
|
Cache::clear();
|
||||||
|
|
||||||
// Begin upgrade
|
// Begin upgrade
|
||||||
$airtimeConf = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
$airtimeConf = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
||||||
$values = parse_ini_file($airtimeConf, true);
|
$values = parse_ini_file($airtimeConf, true);
|
||||||
|
|
||||||
$username = $values['database']['dbuser'];
|
$username = $values['database']['dbuser'];
|
||||||
$password = $values['database']['dbpass'];
|
$password = $values['database']['dbpass'];
|
||||||
$host = $values['database']['host'];
|
$host = $values['database']['host'];
|
||||||
$database = $values['database']['dbname'];
|
$database = $values['database']['dbname'];
|
||||||
|
|
||||||
passthru("export PGPASSWORD=$password && psql -h $host -U $username -q -f $dir/upgrade_sql/airtime_"
|
passthru("export PGPASSWORD=$password && psql -h $host -U $username -q -f $dir/upgrade_sql/airtime_"
|
||||||
.$this->getNewVersion()."/upgrade.sql $database 2>&1 | grep -v \"will create implicit index\"");
|
.$this->getNewVersion()."/upgrade.sql $database 2>&1 | grep -v \"will create implicit index\"");
|
||||||
|
|
||||||
Application_Model_Preference::SetAirtimeVersion($newVersion);
|
Application_Model_Preference::SetAirtimeVersion($newVersion);
|
||||||
Cache::clear();
|
Cache::clear();
|
||||||
|
|
||||||
$this->toggleMaintenanceScreen(false);
|
$this->toggleMaintenanceScreen(false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
$this->toggleMaintenanceScreen(false);
|
$this->toggleMaintenanceScreen(false);
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AirtimeUpgrader259 extends AirtimeUpgrader {
|
||||||
|
protected function getSupportedVersions() {
|
||||||
|
return array (
|
||||||
|
'2.5.5'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getNewVersion() {
|
||||||
|
return '2.5.9';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function upgrade($dir = __DIR__) {
|
||||||
|
Cache::clear();
|
||||||
|
assert($this->checkIfUpgradeSupported());
|
||||||
|
|
||||||
|
$newVersion = $this->getNewVersion();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->toggleMaintenanceScreen(true);
|
||||||
|
Cache::clear();
|
||||||
|
|
||||||
|
// Begin upgrade
|
||||||
|
$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'];
|
||||||
|
|
||||||
|
passthru("export PGPASSWORD=$password && psql -h $host -U $username -q -f $dir/upgrade_sql/airtime_"
|
||||||
|
.$this->getNewVersion()."/upgrade.sql $database 2>&1 | grep -v \"will create implicit index\"");
|
||||||
|
|
||||||
|
Application_Model_Preference::SetAirtimeVersion($newVersion);
|
||||||
|
Cache::clear();
|
||||||
|
|
||||||
|
$this->toggleMaintenanceScreen(false);
|
||||||
|
} catch(Exception $e) {
|
||||||
|
$this->toggleMaintenanceScreen(false);
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue