SAAS-596: Store file size and hash in database
Added upgrader class to add new filesize column
This commit is contained in:
parent
58f9ffd0eb
commit
fd0db11450
|
@ -18,6 +18,7 @@ class UpgradeController extends Zend_Controller_Action
|
||||||
array_push($upgraders, new AirtimeUpgrader254());
|
array_push($upgraders, new AirtimeUpgrader254());
|
||||||
array_push($upgraders, new AirtimeUpgrader255());
|
array_push($upgraders, new AirtimeUpgrader255());
|
||||||
array_push($upgraders, new AirtimeUpgrader259());
|
array_push($upgraders, new AirtimeUpgrader259());
|
||||||
|
array_push($upgraders, new AirtimeUpgrader2510());
|
||||||
|
|
||||||
$didWePerformAnUpgrade = false;
|
$didWePerformAnUpgrade = false;
|
||||||
try
|
try
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE cc_files ADD COLUMN filesize integer NOT NULL
|
||||||
|
CONSTRAINT filesize_default DEFAULT 0
|
|
@ -296,3 +296,48 @@ class AirtimeUpgrader259 extends AirtimeUpgrader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AirtimeUpgrader2510 extends AirtimeUpgrader
|
||||||
|
{
|
||||||
|
protected function getSupportedVersions() {
|
||||||
|
return array (
|
||||||
|
'2.5.9'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNewVersion() {
|
||||||
|
return '2.5.10';
|
||||||
|
}
|
||||||
|
|
||||||
|
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 -E \"will create implicit sequence|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