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

@ -236,22 +236,31 @@ class InstallRequirements {
$databaseConfig['server']
)
)) {
if($this->requireDatabaseConnection(
if($this->requireDatabaseVersion(
$databaseConfig,
array(
"Database Configuration",
"Database access credentials correct",
"That username/password doesn't work"
"Database Version",
"Database server meets required version",
"Database does not meet the required version"
)
)) {
$this->requireDatabaseOrCreatePermissions(
if($this->requireDatabaseConnection(
$databaseConfig,
array(
"Database Configuration",
"Can I access/create the database",
"I can't create new databases and the database '$databaseConfig[database]' doesn't exist"
"Database access credentials correct",
"That username/password doesn't work"
)
);
)) {
$this->requireDatabaseOrCreatePermissions(
$databaseConfig,
array(
"Database Configuration",
"Can I access/create the database",
"I can't create new databases and the database '$databaseConfig[database]' doesn't exist"
)
);
}
}
}
}
@ -716,7 +725,24 @@ class InstallRequirements {
return false;
}
}
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) {
$this->testing($testDetails);
$helper = $this->getDatabaseConfigurationHelper($databaseConfig['type']);