Passed
Push — master ( c6c512...8bc9e2 )
by Robin
16:17 queued 13s
created
lib/private/Setup/PostgreSQL.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 					//use the admin login data for the new database user
68 68
 
69 69
 					//add prefix to the postgresql user name to prevent collisions
70
-					$this->dbUser = 'oc_' . strtolower($username);
70
+					$this->dbUser = 'oc_'.strtolower($username);
71 71
 					//create a new password so we don't need to store the admin config in the config file
72 72
 					$this->dbPassword = \OC::$server->getSecureRandom()->generate(30, ISecureRandom::CHAR_ALPHANUMERIC);
73 73
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 					// Therefore we assume that the database is only used by one user/service which is Nextcloud
81 81
 					// Additional services should get installed in a separate database in order to stay secure
82 82
 					// Also see https://www.postgresql.org/docs/15/ddl-schemas.html#DDL-SCHEMAS-PATTERNS
83
-					$connectionMainDatabase->executeQuery('GRANT CREATE ON SCHEMA public TO ' . addslashes($this->dbUser));
83
+					$connectionMainDatabase->executeQuery('GRANT CREATE ON SCHEMA public TO '.addslashes($this->dbUser));
84 84
 					$connectionMainDatabase->close();
85 85
 				}
86 86
 			}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	private function createDatabase(Connection $connection) {
123 123
 		if (!$this->databaseExists($connection)) {
124 124
 			//The database does not exists... let's create it
125
-			$query = $connection->prepare("CREATE DATABASE " . addslashes($this->dbName) . " OWNER " . addslashes($this->dbUser));
125
+			$query = $connection->prepare("CREATE DATABASE ".addslashes($this->dbName)." OWNER ".addslashes($this->dbUser));
126 126
 			try {
127 127
 				$query->execute();
128 128
 			} catch (DatabaseException $e) {
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 				]);
132 132
 			}
133 133
 		} else {
134
-			$query = $connection->prepare("REVOKE ALL PRIVILEGES ON DATABASE " . addslashes($this->dbName) . " FROM PUBLIC");
134
+			$query = $connection->prepare("REVOKE ALL PRIVILEGES ON DATABASE ".addslashes($this->dbName)." FROM PUBLIC");
135 135
 			try {
136 136
 				$query->execute();
137 137
 			} catch (DatabaseException $e) {
@@ -168,14 +168,14 @@  discard block
 block discarded – undo
168 168
 			$i = 1;
169 169
 			while ($this->userExists($connection)) {
170 170
 				$i++;
171
-				$this->dbUser = $dbUser . $i;
171
+				$this->dbUser = $dbUser.$i;
172 172
 			}
173 173
 
174 174
 			// create the user
175
-			$query = $connection->prepare("CREATE USER " . addslashes($this->dbUser) . " CREATEDB PASSWORD '" . addslashes($this->dbPassword) . "'");
175
+			$query = $connection->prepare("CREATE USER ".addslashes($this->dbUser)." CREATEDB PASSWORD '".addslashes($this->dbPassword)."'");
176 176
 			$query->execute();
177 177
 			if ($this->databaseExists($connection)) {
178
-				$query = $connection->prepare('GRANT CONNECT ON DATABASE ' . addslashes($this->dbName) . ' TO '.addslashes($this->dbUser));
178
+				$query = $connection->prepare('GRANT CONNECT ON DATABASE '.addslashes($this->dbName).' TO '.addslashes($this->dbUser));
179 179
 				$query->execute();
180 180
 			}
181 181
 		} catch (DatabaseException $e) {
Please login to merge, or discard this patch.