diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-03-25 23:17:18 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-03-25 23:17:18 +0100 |
commit | 743ca4581dc6cb5fcb6e7a3013f36293061266fb (patch) | |
tree | 0a822f2766360cb40fcda96874fcf4ed83c299f9 | |
parent | 1816f43722fb0427f980297c18bdee4faf88c603 (diff) | |
parent | 6bfeb342db32feff686f4fc6d7bd0d42de9d297b (diff) | |
download | nextcloud-server-743ca4581dc6cb5fcb6e7a3013f36293061266fb.tar.gz nextcloud-server-743ca4581dc6cb5fcb6e7a3013f36293061266fb.zip |
Merge pull request #7748 from owncloud/postgresversionwarning
Added PostgreSQL version warning on upgrade
-rwxr-xr-x | lib/private/util.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/private/util.php b/lib/private/util.php index f72276418ba..87e173fa765 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -490,6 +490,8 @@ class OC_Util { ); } + $errors = array_merge($errors, self::checkDatabaseVersion()); + // Cache the result of this function \OC::$session->set('checkServer_suceeded', count($errors) == 0); @@ -497,6 +499,39 @@ 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) { + \OCP\Util::logException('core', $e); + $errors[] = array( + 'error' => 'Error occurred while checking PostgreSQL version', + 'hint' => 'Please make sure you have PostgreSQL >= 9 or check the logs for more information about the error' + ); + } + } + return $errors; + } + + + /** * @brief check if there are still some encrypted files stored * @return boolean */ |