@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $this->createDatabase($connection); |
54 | 54 | |
55 | 55 | //fill the database if needed |
56 | - $query='select count(*) from information_schema.tables where table_schema=? AND table_name = ?'; |
|
56 | + $query = 'select count(*) from information_schema.tables where table_schema=? AND table_name = ?'; |
|
57 | 57 | $connection->executeQuery($query, [$this->dbName, $this->tablePrefix.'users']); |
58 | 58 | } |
59 | 59 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param \OC\DB\Connection $connection |
62 | 62 | */ |
63 | 63 | private function createDatabase($connection) { |
64 | - try{ |
|
64 | + try { |
|
65 | 65 | $name = $this->dbName; |
66 | 66 | $user = $this->dbUser; |
67 | 67 | //we can't use OC_DB functions here because we need to connect as the administrative user. |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | try { |
81 | 81 | //this query will fail if there aren't the right permissions, ignore the error |
82 | - $query="GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `$name` . * TO '$user'"; |
|
82 | + $query = "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `$name` . * TO '$user'"; |
|
83 | 83 | $connection->executeUpdate($query); |
84 | 84 | } catch (\Exception $ex) { |
85 | 85 | $this->logger->logException($ex, [ |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @throws \OC\DatabaseSetupException |
96 | 96 | */ |
97 | 97 | private function createDBUser($connection) { |
98 | - try{ |
|
98 | + try { |
|
99 | 99 | $name = $this->dbUser; |
100 | 100 | $password = $this->dbPassword; |
101 | 101 | // we need to create 2 accounts, one for global use and one for local user. if we don't specify the local one, |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'"; |
106 | 106 | $connection->executeUpdate($query); |
107 | 107 | } |
108 | - catch (\Exception $ex){ |
|
108 | + catch (\Exception $ex) { |
|
109 | 109 | $this->logger->logException($ex, [ |
110 | 110 | 'message' => 'Database user creation failed.', |
111 | 111 | 'level' => ILogger::ERROR, |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | //we don't have a dbuser specified in config |
128 | 128 | if ($this->dbUser !== $oldUser) { |
129 | 129 | //add prefix to the admin username to prevent collisions |
130 | - $adminUser = substr('oc_' . $username, 0, 16); |
|
130 | + $adminUser = substr('oc_'.$username, 0, 16); |
|
131 | 131 | |
132 | 132 | $i = 1; |
133 | 133 | while (true) { |
@@ -144,15 +144,15 @@ discard block |
||
144 | 144 | $this->dbUser = $adminUser; |
145 | 145 | |
146 | 146 | //create a random password so we don't need to store the admin password in the config file |
147 | - $this->dbPassword = $this->random->generate(30); |
|
147 | + $this->dbPassword = $this->random->generate(30); |
|
148 | 148 | |
149 | 149 | $this->createDBUser($connection); |
150 | 150 | |
151 | 151 | break; |
152 | 152 | } else { |
153 | 153 | //repeat with different username |
154 | - $length = strlen((string)$i); |
|
155 | - $adminUser = substr('oc_' . $username, 0, 16 - $length) . $i; |
|
154 | + $length = strlen((string) $i); |
|
155 | + $adminUser = substr('oc_'.$username, 0, 16 - $length).$i; |
|
156 | 156 | $i++; |
157 | 157 | } |
158 | 158 | } else { |