ENHANCEMENT Installer now supports requireDatabaseVersion() on each database configuration helper implementation, e.g. MySQLDatabaseConfigurationHelper. If it's not defined, the test is skipped.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/branches/2.4@104707 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
sharvey 2010-05-12 12:36:42 +00:00 committed by Sam Minnee
parent 461c753a53
commit 9a2a058048

View File

@ -235,6 +235,14 @@ class InstallRequirements {
"I couldn't find a database server on '$databaseConfig[server]'", "I couldn't find a database server on '$databaseConfig[server]'",
$databaseConfig['server'] $databaseConfig['server']
) )
)) {
if($this->requireDatabaseVersion(
$databaseConfig,
array(
"Database Version",
"Database server meets required version",
"Database does not meet the required version"
)
)) { )) {
if($this->requireDatabaseConnection( if($this->requireDatabaseConnection(
$databaseConfig, $databaseConfig,
@ -256,6 +264,7 @@ class InstallRequirements {
} }
} }
} }
}
function checkAdminConfig($adminConfig) { function checkAdminConfig($adminConfig) {
if(!$adminConfig['username']) { if(!$adminConfig['username']) {
@ -717,6 +726,23 @@ class InstallRequirements {
} }
} }
function requireDatabaseVersion($databaseConfig, $testDetails) {
$this->testing($testDetails);
$helper = $this->getDatabaseConfigurationHelper($databaseConfig['type']);
if(method_exists($helper, 'requireDatabaseVersion')) {
$result = $helper->requireDatabaseVersion($databaseConfig);
if($result['success']) {
return true;
} else {
$testDetails[2] .= ": " . $result['error'];
$this->error($testDetails);
return false;
}
}
// Skipped test because this database has no required version
return true;
}
function requireDatabaseServer($databaseConfig, $testDetails) { function requireDatabaseServer($databaseConfig, $testDetails) {
$this->testing($testDetails); $this->testing($testDetails);
$helper = $this->getDatabaseConfigurationHelper($databaseConfig['type']); $helper = $this->getDatabaseConfigurationHelper($databaseConfig['type']);