summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-03-15 13:28:20 +0100
committerVincent Petry <pvince81@owncloud.com>2014-03-17 18:58:00 +0100
commit3cd09f2b09e69821b8f938b2c54f9c12dbb303f0 (patch)
treeb36261040430993bc649f3409ea387ba157b0352 /lib
parent6fbf3dd7c4e64a68d2b8a0a2c24a1b92de7868b1 (diff)
downloadnextcloud-server-3cd09f2b09e69821b8f938b2c54f9c12dbb303f0.tar.gz
nextcloud-server-3cd09f2b09e69821b8f938b2c54f9c12dbb303f0.zip
Added PostgreSQL version warning on upgrade
Diffstat (limited to 'lib')
-rwxr-xr-xlib/private/util.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/private/util.php b/lib/private/util.php
index fc78566e456..54e04ce4d7a 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -485,6 +485,8 @@ class OC_Util {
);
}
+ $errors = array_merge($errors, self::checkDatabaseVersion());
+
// Cache the result of this function
\OC::$session->set('checkServer_suceeded', count($errors) == 0);
@@ -492,6 +494,38 @@ class OC_Util {
}
/**
+ * Check the database version
+ * @return array errors array
+ */
+ public static function checkDatabaseVersion() {
+ $errors = array();
+ $dbType = \OC_Config::getValue('dbtype', 'sqlite');
+ if ($dbType === 'pgsql') {
+ // check PostgreSQL version
+ try {
+ $result = \OC_DB::executeAudited('SHOW SERVER_VERSION');
+ $data = $result->fetchRow();
+ if (isset($data['server_version'])) {
+ $version = $data['server_version'];
+ if (version_compare($version, '9.0.0', '<')) {
+ $errors[] = array(
+ 'error' => 'PostgreSQL >= 9 required',
+ 'hint' => 'Please upgrade your database version'
+ );
+ }
+ }
+ }
+ catch (\Doctrine\DBAL\DBALException $e){
+ $errors[] = array(
+ 'error' => 'PostgreSQL >= 9 required'
+ );
+ }
+ }
+ return $errors;
+ }
+
+
+ /**
* @brief check if there are still some encrypted files stored
* @return boolean
*/