Completed
Push — master ( c58853...11c7a9 )
by Lukas
14:51
created
lib/private/Setup/OCI.php 2 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -32,81 +32,81 @@
 block discarded – undo
32 32
 namespace OC\Setup;
33 33
 
34 34
 class OCI extends AbstractDatabase {
35
-	public $dbprettyname = 'Oracle';
35
+    public $dbprettyname = 'Oracle';
36 36
 
37
-	protected $dbtablespace;
37
+    protected $dbtablespace;
38 38
 
39
-	public function initialize($config) {
40
-		parent::initialize($config);
41
-		if (array_key_exists('dbtablespace', $config)) {
42
-			$this->dbtablespace = $config['dbtablespace'];
43
-		} else {
44
-			$this->dbtablespace = 'USERS';
45
-		}
46
-		// allow empty hostname for oracle
47
-		$this->dbHost = $config['dbhost'];
39
+    public function initialize($config) {
40
+        parent::initialize($config);
41
+        if (array_key_exists('dbtablespace', $config)) {
42
+            $this->dbtablespace = $config['dbtablespace'];
43
+        } else {
44
+            $this->dbtablespace = 'USERS';
45
+        }
46
+        // allow empty hostname for oracle
47
+        $this->dbHost = $config['dbhost'];
48 48
 
49
-		$this->config->setValues([
50
-			'dbhost' => $this->dbHost,
51
-			'dbtablespace' => $this->dbtablespace,
52
-		]);
53
-	}
49
+        $this->config->setValues([
50
+            'dbhost' => $this->dbHost,
51
+            'dbtablespace' => $this->dbtablespace,
52
+        ]);
53
+    }
54 54
 
55
-	public function validate($config) {
56
-		$errors = array();
57
-		if (empty($config['dbuser']) && empty($config['dbname'])) {
58
-			$errors[] = $this->trans->t("%s enter the database username and name.", array($this->dbprettyname));
59
-		} else if (empty($config['dbuser'])) {
60
-			$errors[] = $this->trans->t("%s enter the database username.", array($this->dbprettyname));
61
-		} else if (empty($config['dbname'])) {
62
-			$errors[] = $this->trans->t("%s enter the database name.", array($this->dbprettyname));
63
-		}
64
-		return $errors;
65
-	}
55
+    public function validate($config) {
56
+        $errors = array();
57
+        if (empty($config['dbuser']) && empty($config['dbname'])) {
58
+            $errors[] = $this->trans->t("%s enter the database username and name.", array($this->dbprettyname));
59
+        } else if (empty($config['dbuser'])) {
60
+            $errors[] = $this->trans->t("%s enter the database username.", array($this->dbprettyname));
61
+        } else if (empty($config['dbname'])) {
62
+            $errors[] = $this->trans->t("%s enter the database name.", array($this->dbprettyname));
63
+        }
64
+        return $errors;
65
+    }
66 66
 
67
-	public function setupDatabase($username) {
68
-		try {
69
-			$this->connect();
70
-		} catch (\Exception $e) {
71
-			$errorMessage = $this->getLastError();
72
-			if ($errorMessage) {
73
-				throw new \OC\DatabaseSetupException($this->trans->t('Oracle connection could not be established'),
74
-					$errorMessage . ' Check environment: ORACLE_HOME=' . getenv('ORACLE_HOME')
75
-					. ' ORACLE_SID=' . getenv('ORACLE_SID')
76
-					. ' LD_LIBRARY_PATH=' . getenv('LD_LIBRARY_PATH')
77
-					. ' NLS_LANG=' . getenv('NLS_LANG')
78
-					. ' tnsnames.ora is ' . (is_readable(getenv('ORACLE_HOME') . '/network/admin/tnsnames.ora') ? '' : 'not ') . 'readable');
79
-			}
80
-			throw new \OC\DatabaseSetupException($this->trans->t('Oracle username and/or password not valid'),
81
-				'Check environment: ORACLE_HOME=' . getenv('ORACLE_HOME')
82
-				. ' ORACLE_SID=' . getenv('ORACLE_SID')
83
-				. ' LD_LIBRARY_PATH=' . getenv('LD_LIBRARY_PATH')
84
-				. ' NLS_LANG=' . getenv('NLS_LANG')
85
-				. ' tnsnames.ora is ' . (is_readable(getenv('ORACLE_HOME') . '/network/admin/tnsnames.ora') ? '' : 'not ') . 'readable');
86
-		}
67
+    public function setupDatabase($username) {
68
+        try {
69
+            $this->connect();
70
+        } catch (\Exception $e) {
71
+            $errorMessage = $this->getLastError();
72
+            if ($errorMessage) {
73
+                throw new \OC\DatabaseSetupException($this->trans->t('Oracle connection could not be established'),
74
+                    $errorMessage . ' Check environment: ORACLE_HOME=' . getenv('ORACLE_HOME')
75
+                    . ' ORACLE_SID=' . getenv('ORACLE_SID')
76
+                    . ' LD_LIBRARY_PATH=' . getenv('LD_LIBRARY_PATH')
77
+                    . ' NLS_LANG=' . getenv('NLS_LANG')
78
+                    . ' tnsnames.ora is ' . (is_readable(getenv('ORACLE_HOME') . '/network/admin/tnsnames.ora') ? '' : 'not ') . 'readable');
79
+            }
80
+            throw new \OC\DatabaseSetupException($this->trans->t('Oracle username and/or password not valid'),
81
+                'Check environment: ORACLE_HOME=' . getenv('ORACLE_HOME')
82
+                . ' ORACLE_SID=' . getenv('ORACLE_SID')
83
+                . ' LD_LIBRARY_PATH=' . getenv('LD_LIBRARY_PATH')
84
+                . ' NLS_LANG=' . getenv('NLS_LANG')
85
+                . ' tnsnames.ora is ' . (is_readable(getenv('ORACLE_HOME') . '/network/admin/tnsnames.ora') ? '' : 'not ') . 'readable');
86
+        }
87 87
 
88
-		$this->config->setValues([
89
-			'dbuser' => $this->dbUser,
90
-			'dbname' => $this->dbName,
91
-			'dbpassword' => $this->dbPassword,
92
-		]);
93
-	}
88
+        $this->config->setValues([
89
+            'dbuser' => $this->dbUser,
90
+            'dbname' => $this->dbName,
91
+            'dbpassword' => $this->dbPassword,
92
+        ]);
93
+    }
94 94
 
95
-	/**
96
-	 * @param resource $connection
97
-	 * @return string
98
-	 */
99
-	protected function getLastError($connection = null) {
100
-		if ($connection) {
101
-			$error = oci_error($connection);
102
-		} else {
103
-			$error = oci_error();
104
-		}
105
-		foreach (array('message', 'code') as $key) {
106
-			if (isset($error[$key])) {
107
-				return $error[$key];
108
-			}
109
-		}
110
-		return '';
111
-	}
95
+    /**
96
+     * @param resource $connection
97
+     * @return string
98
+     */
99
+    protected function getLastError($connection = null) {
100
+        if ($connection) {
101
+            $error = oci_error($connection);
102
+        } else {
103
+            $error = oci_error();
104
+        }
105
+        foreach (array('message', 'code') as $key) {
106
+            if (isset($error[$key])) {
107
+                return $error[$key];
108
+            }
109
+        }
110
+        return '';
111
+    }
112 112
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -71,18 +71,18 @@
 block discarded – undo
71 71
 			$errorMessage = $this->getLastError();
72 72
 			if ($errorMessage) {
73 73
 				throw new \OC\DatabaseSetupException($this->trans->t('Oracle connection could not be established'),
74
-					$errorMessage . ' Check environment: ORACLE_HOME=' . getenv('ORACLE_HOME')
75
-					. ' ORACLE_SID=' . getenv('ORACLE_SID')
76
-					. ' LD_LIBRARY_PATH=' . getenv('LD_LIBRARY_PATH')
77
-					. ' NLS_LANG=' . getenv('NLS_LANG')
78
-					. ' tnsnames.ora is ' . (is_readable(getenv('ORACLE_HOME') . '/network/admin/tnsnames.ora') ? '' : 'not ') . 'readable');
74
+					$errorMessage.' Check environment: ORACLE_HOME='.getenv('ORACLE_HOME')
75
+					. ' ORACLE_SID='.getenv('ORACLE_SID')
76
+					. ' LD_LIBRARY_PATH='.getenv('LD_LIBRARY_PATH')
77
+					. ' NLS_LANG='.getenv('NLS_LANG')
78
+					. ' tnsnames.ora is '.(is_readable(getenv('ORACLE_HOME').'/network/admin/tnsnames.ora') ? '' : 'not ').'readable');
79 79
 			}
80 80
 			throw new \OC\DatabaseSetupException($this->trans->t('Oracle username and/or password not valid'),
81
-				'Check environment: ORACLE_HOME=' . getenv('ORACLE_HOME')
82
-				. ' ORACLE_SID=' . getenv('ORACLE_SID')
83
-				. ' LD_LIBRARY_PATH=' . getenv('LD_LIBRARY_PATH')
84
-				. ' NLS_LANG=' . getenv('NLS_LANG')
85
-				. ' tnsnames.ora is ' . (is_readable(getenv('ORACLE_HOME') . '/network/admin/tnsnames.ora') ? '' : 'not ') . 'readable');
81
+				'Check environment: ORACLE_HOME='.getenv('ORACLE_HOME')
82
+				. ' ORACLE_SID='.getenv('ORACLE_SID')
83
+				. ' LD_LIBRARY_PATH='.getenv('LD_LIBRARY_PATH')
84
+				. ' NLS_LANG='.getenv('NLS_LANG')
85
+				. ' tnsnames.ora is '.(is_readable(getenv('ORACLE_HOME').'/network/admin/tnsnames.ora') ? '' : 'not ').'readable');
86 86
 		}
87 87
 
88 88
 		$this->config->setValues([
Please login to merge, or discard this patch.