[Pkg-owncloud-commits] [owncloud] 06/85: Added PostgreSQL version warning + log on upgrade

David Prévot taffit at moszumanska.debian.org
Tue Jun 17 19:12:39 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch 6.0
in repository owncloud.

commit a152f3a50fbae79c2fae98cf013aa71ca82174fb
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Sat Mar 15 13:28:20 2014 +0100

    Added PostgreSQL version warning + log on upgrade
    
    Backport of 3cd09f2, a25b86a, 6bfeb34 from master
---
 lib/private/util.php | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/lib/private/util.php b/lib/private/util.php
index 6db1727..5901042 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -488,6 +488,8 @@ class OC_Util {
 			);
 		}
 
+		$errors = array_merge($errors, self::checkDatabaseVersion());
+
 		// Cache the result of this function
 		\OC::$session->set('checkServer_suceeded', count($errors) == 0);
 
@@ -495,6 +497,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
 	 */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list