Permalink
Browse files

ENHANCEMENT Added PostgreSQLDatabaseConfigurationHelper::getDatabaseV…

…ersion()
  • Loading branch information...
1 parent 2c38c37 commit 133e6ff6eca2ce81c209d5600a65dcc7589c9b37 @halkyon halkyon committed May 26, 2010
Showing with 15 additions and 9 deletions.
  1. +15 −9 code/PostgreSQLDatabaseConfigurationHelper.php
@@ -80,15 +80,8 @@ public function requireDatabaseConnection($databaseConfig) {
);
}
- /**
- * Ensure that the PostgreSQL version is at least 8.3.
- * @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 = '';
-
+ public function getDatabaseVersion($databaseConfig) {
+ $version = 0;
$username = $databaseConfig['username'] ? $databaseConfig['username'] : '';
$password = $databaseConfig['password'] ? $databaseConfig['password'] : '';
$server = $databaseConfig['server'];
@@ -110,6 +103,19 @@ public function requireDatabaseVersion($databaseConfig) {
}
}
+ return $version;
+ }
+
+ /**
+ * Ensure that the PostgreSQL version is at least 8.3.
+ * @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) {
$success = version_compare($version, '8.3', '>=');
if(!$success) {

0 comments on commit 133e6ff

Please sign in to comment.