summaryrefslogtreecommitdiffstats
path: root/lib/private/setup
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@owncloud.com>2013-11-28 12:04:28 +0100
committerAndreas Fischer <bantu@owncloud.com>2013-11-28 12:04:28 +0100
commit904573d0d079d93cb6a0b1153c4a6cf127a8ddce (patch)
tree856dfbcc4361101d6e902f8644fdd46a4734628d /lib/private/setup
parent955127231ad4adb248f2cbfdb9eabdc56b58a183 (diff)
downloadnextcloud-server-904573d0d079d93cb6a0b1153c4a6cf127a8ddce.tar.gz
nextcloud-server-904573d0d079d93cb6a0b1153c4a6cf127a8ddce.zip
Add getLastError()
Diffstat (limited to 'lib/private/setup')
-rw-r--r--lib/private/setup/oci.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/private/setup/oci.php b/lib/private/setup/oci.php
index f4ecb22de5f..3676a54c50d 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 '';
+ }
}