mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
ENHANCEMENT Added MSSQLDatabaseConfigurationHelper::getDatabaseVersion()
This commit is contained in:
parent
a0768ec44d
commit
5ad91ce0ed
@ -98,15 +98,7 @@ class MSSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getDatabaseVersion($databaseConfig) {
|
||||||
* Ensure that the SQL Server version is at least 10.00.2531 (SQL Server 2008 SP1).
|
|
||||||
* @see http://www.sqlteam.com/article/sql-server-versions
|
|
||||||
* @param array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc
|
|
||||||
* @return array Result - e.g. array('success' => true, 'error' => 'details of error')
|
|
||||||
*/
|
|
||||||
public function requireDatabaseVersion($databaseConfig) {
|
|
||||||
$success = false;
|
|
||||||
$error = '';
|
|
||||||
$version = 0;
|
$version = 0;
|
||||||
|
|
||||||
// Get the version using SERVERPROPERTY() function
|
// Get the version using SERVERPROPERTY() function
|
||||||
@ -127,6 +119,20 @@ class MSSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper {
|
|||||||
$version = trim($row[0]);
|
$version = trim($row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure that the SQL Server version is at least 10.00.2531 (SQL Server 2008 SP1).
|
||||||
|
* @see http://www.sqlteam.com/article/sql-server-versions
|
||||||
|
* @param array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc
|
||||||
|
* @return array Result - e.g. array('success' => true, 'error' => 'details of error')
|
||||||
|
*/
|
||||||
|
public function requireDatabaseVersion($databaseConfig) {
|
||||||
|
$success = false;
|
||||||
|
$error = '';
|
||||||
|
$version = $this->getDatabaseVersion($databaseConfig);
|
||||||
|
|
||||||
if($version) {
|
if($version) {
|
||||||
$success = version_compare($version, '10.00.2531', '>=');
|
$success = version_compare($version, '10.00.2531', '>=');
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
|
Loading…
Reference in New Issue
Block a user