mirror of
https://github.com/silverstripe/silverstripe-installer
synced 2024-10-22 17:05:33 +02:00
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:
parent
461c753a53
commit
9a2a058048
42
install.php
42
install.php
@ -236,22 +236,31 @@ class InstallRequirements {
|
|||||||
$databaseConfig['server']
|
$databaseConfig['server']
|
||||||
)
|
)
|
||||||
)) {
|
)) {
|
||||||
if($this->requireDatabaseConnection(
|
if($this->requireDatabaseVersion(
|
||||||
$databaseConfig,
|
$databaseConfig,
|
||||||
array(
|
array(
|
||||||
"Database Configuration",
|
"Database Version",
|
||||||
"Database access credentials correct",
|
"Database server meets required version",
|
||||||
"That username/password doesn't work"
|
"Database does not meet the required version"
|
||||||
)
|
)
|
||||||
)) {
|
)) {
|
||||||
$this->requireDatabaseOrCreatePermissions(
|
if($this->requireDatabaseConnection(
|
||||||
$databaseConfig,
|
$databaseConfig,
|
||||||
array(
|
array(
|
||||||
"Database Configuration",
|
"Database Configuration",
|
||||||
"Can I access/create the database",
|
"Database access credentials correct",
|
||||||
"I can't create new databases and the database '$databaseConfig[database]' doesn't exist"
|
"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"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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']);
|
||||||
|
Loading…
Reference in New Issue
Block a user