Run database upgrades when setting up tests

This commit is contained in:
Lucas Bickel 2017-03-10 18:27:11 +01:00
parent 2a53241ba3
commit 288473e4fc
3 changed files with 10 additions and 32 deletions

View file

@ -38,12 +38,6 @@ class UpgradeManager
$schemaVersion = Application_Model_Preference::GetSchemaVersion();
$supportedSchemaVersions = self::getSupportedSchemaVersions();
return !in_array($schemaVersion, $supportedSchemaVersions);
// We shouldn't run the upgrade as a side-effect of this function!
/*
if ($upgradeNeeded) {
self::doUpgrade();
}
*/
}
/**
@ -187,8 +181,6 @@ abstract class AirtimeUpgrader
* allowing child classes to overwrite _runUpgrade to reduce duplication
*/
public function upgrade() {
assert($this->checkIfUpgradeSupported());
try {
// $this->toggleMaintenanceScreen(true);
@ -200,6 +192,7 @@ abstract class AirtimeUpgrader
// $this->toggleMaintenanceScreen(false);
} catch(Exception $e) {
// $this->toggleMaintenanceScreen(false);
Logging::error('Error in upgrade: '. $e->getMessage());
return false;
}
@ -236,13 +229,12 @@ abstract class AirtimeUpgrader
}
protected function _getDbValues() {
$airtimeConf = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
$values = parse_ini_file($airtimeConf, true);
$config = Config::getConfig();
$this->username = $values['database']['dbuser'];
$this->password = $values['database']['dbpass'];
$this->host = $values['database']['host'];
$this->database = $values['database']['dbname'];
$this->username = $config['dsn']['username'];
$this->password = $config['dsn']['password'];
$this->host = $config['dsn']['hostspec'];
$this->database = $config['dsn']['database'];
}
protected function _runUpgrade() {