[Pkg-owncloud-commits] [owncloud] 29/49: Add getLastError()

David Prévot taffit at moszumanska.debian.org
Thu Dec 5 16:02:55 UTC 2013


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

taffit pushed a commit to branch master
in repository owncloud.

commit 18903cc8f7b5bd0fb7e63856b9f6a4e453b4d24e
Author: Andreas Fischer <bantu at owncloud.com>
Date:   Thu Nov 28 12:04:28 2013 +0100

    Add getLastError()
---
 lib/private/setup/oci.php | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/lib/private/setup/oci.php b/lib/private/setup/oci.php
index f4ecb22..3676a54 100644
--- a/lib/private/setup/oci.php
+++ b/lib/private/setup/oci.php
@@ -29,10 +29,10 @@ class OCI extends AbstractDatabase {
 		\OC_Log::write('setup oracle', 'connect string: ' . $easy_connect_string, \OC_Log::DEBUG);
 		$connection = @oci_connect($this->dbuser, $this->dbpassword, $easy_connect_string);
 		if(!$connection) {
-			$e = oci_error();
-			if (is_array ($e) && isset ($e['message'])) {
+			$errorMessage = $this->getLastError();
+			if ($errorMessage) {
 				throw new \DatabaseSetupException($this->trans->t('Oracle connection could not be established'),
-				$e['message'].' Check environment: ORACLE_HOME='.getenv('ORACLE_HOME')
+				$errorMessage.' Check environment: ORACLE_HOME='.getenv('ORACLE_HOME')
 							.' ORACLE_SID='.getenv('ORACLE_SID')
 							.' LD_LIBRARY_PATH='.getenv('LD_LIBRARY_PATH')
 							.' NLS_LANG='.getenv('NLS_LANG')
@@ -207,4 +207,21 @@ class OCI extends AbstractDatabase {
 			\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
 		}
 	}
+
+	/**
+	 * @param resource $connection
+	 */
+	protected function getLastError($connection = null) {
+		if ($connection) {
+			$error = oci_error($connection);
+		} else {
+			$error = oci_error();
+		}
+		foreach (array('message', 'code') as $key) {
+			if (isset($error[$key])) {
+				return $error[$key];
+			}
+		}
+		return '';
+	}
 }

-- 
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