(mvc) BaseModel add getVersion() to retrieve the running config version, commit changes to in memory config after every migration step.

Errors will be send to syslog, current policy is to always upgrade and ignore migration errors.
(there's not really a way back, other then undo pkg install and revert the full config)
This commit is contained in:
Ad Schellevis 2016-08-12 11:27:49 +02:00
parent aaa0ddafe1
commit 89fa64dbcb

View File

@ -541,6 +541,7 @@ abstract class BaseModel
$migobj = $mig_class->newInstance();
try {
$migobj->run($this);
$this->serializeToConfig();
} catch (\Exception $e) {
$logger->error("failed migrating from version " .
$this->internal_current_model_version .
@ -554,4 +555,13 @@ abstract class BaseModel
}
}
}
/**
* return current version number
* @return null|string
*/
public function getVersion()
{
return $this->internal_current_model_version;
}
}