@@ -30,19 +30,19 @@ |
||
30 | 30 | |
31 | 31 | class CheckBackupCodes implements IRepairStep { |
32 | 32 | |
33 | - /** @var IJobList */ |
|
34 | - private $jobList; |
|
33 | + /** @var IJobList */ |
|
34 | + private $jobList; |
|
35 | 35 | |
36 | - public function __construct(IJobList $jobList) { |
|
37 | - $this->jobList = $jobList; |
|
38 | - } |
|
36 | + public function __construct(IJobList $jobList) { |
|
37 | + $this->jobList = $jobList; |
|
38 | + } |
|
39 | 39 | |
40 | - public function getName(): string { |
|
41 | - return 'Add background job to check for backup codes'; |
|
42 | - } |
|
40 | + public function getName(): string { |
|
41 | + return 'Add background job to check for backup codes'; |
|
42 | + } |
|
43 | 43 | |
44 | - public function run(IOutput $output) { |
|
45 | - $this->jobList->add(\OCA\TwoFactorBackupCodes\BackgroundJob\CheckBackupCodes::class); |
|
46 | - } |
|
44 | + public function run(IOutput $output) { |
|
45 | + $this->jobList->add(\OCA\TwoFactorBackupCodes\BackgroundJob\CheckBackupCodes::class); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | } |
@@ -64,10 +64,10 @@ |
||
64 | 64 | public function setupDatabase($username) { |
65 | 65 | $datadir = $this->config->getValue( |
66 | 66 | 'datadirectory', |
67 | - \OC::$SERVERROOT . '/data' |
|
67 | + \OC::$SERVERROOT.'/data' |
|
68 | 68 | ); |
69 | 69 | |
70 | - $sqliteFile = $datadir . '/' . $this->dbName . 'db'; |
|
70 | + $sqliteFile = $datadir.'/'.$this->dbName.'db'; |
|
71 | 71 | if (file_exists($sqliteFile)) { |
72 | 72 | unlink($sqliteFile); |
73 | 73 | } |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | use OC\DB\ConnectionFactory; |
27 | 27 | |
28 | 28 | class Sqlite extends AbstractDatabase { |
29 | - public $dbprettyname = 'Sqlite'; |
|
29 | + public $dbprettyname = 'Sqlite'; |
|
30 | 30 | |
31 | - public function validate($config) { |
|
32 | - return []; |
|
33 | - } |
|
31 | + public function validate($config) { |
|
32 | + return []; |
|
33 | + } |
|
34 | 34 | |
35 | - public function initialize($config) { |
|
36 | - /* |
|
35 | + public function initialize($config) { |
|
36 | + /* |
|
37 | 37 | * Web: When using web based installer its not possible to set dbname |
38 | 38 | * or dbtableprefix. Defaults used from ConnectionFactory and dbtype = 'sqlite' |
39 | 39 | * is written to config.php. |
@@ -44,32 +44,32 @@ discard block |
||
44 | 44 | * in connection factory configuration is obtained from config.php. |
45 | 45 | */ |
46 | 46 | |
47 | - $this->dbName = empty($config['dbname']) |
|
48 | - ? ConnectionFactory::DEFAULT_DBNAME |
|
49 | - : $config['dbname']; |
|
47 | + $this->dbName = empty($config['dbname']) |
|
48 | + ? ConnectionFactory::DEFAULT_DBNAME |
|
49 | + : $config['dbname']; |
|
50 | 50 | |
51 | - $this->tablePrefix = empty($config['dbtableprefix']) |
|
52 | - ? ConnectionFactory::DEFAULT_DBTABLEPREFIX |
|
53 | - : $config['dbtableprefix']; |
|
51 | + $this->tablePrefix = empty($config['dbtableprefix']) |
|
52 | + ? ConnectionFactory::DEFAULT_DBTABLEPREFIX |
|
53 | + : $config['dbtableprefix']; |
|
54 | 54 | |
55 | - if ($this->dbName !== ConnectionFactory::DEFAULT_DBNAME) { |
|
56 | - $this->config->setValue('dbname', $this->dbName); |
|
57 | - } |
|
55 | + if ($this->dbName !== ConnectionFactory::DEFAULT_DBNAME) { |
|
56 | + $this->config->setValue('dbname', $this->dbName); |
|
57 | + } |
|
58 | 58 | |
59 | - if ($this->tablePrefix !== ConnectionFactory::DEFAULT_DBTABLEPREFIX) { |
|
60 | - $this->config->setValue('dbtableprefix', $this->tablePrefix); |
|
61 | - } |
|
62 | - } |
|
59 | + if ($this->tablePrefix !== ConnectionFactory::DEFAULT_DBTABLEPREFIX) { |
|
60 | + $this->config->setValue('dbtableprefix', $this->tablePrefix); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - public function setupDatabase($username) { |
|
65 | - $datadir = $this->config->getValue( |
|
66 | - 'datadirectory', |
|
67 | - \OC::$SERVERROOT . '/data' |
|
68 | - ); |
|
64 | + public function setupDatabase($username) { |
|
65 | + $datadir = $this->config->getValue( |
|
66 | + 'datadirectory', |
|
67 | + \OC::$SERVERROOT . '/data' |
|
68 | + ); |
|
69 | 69 | |
70 | - $sqliteFile = $datadir . '/' . $this->dbName . 'db'; |
|
71 | - if (file_exists($sqliteFile)) { |
|
72 | - unlink($sqliteFile); |
|
73 | - } |
|
74 | - } |
|
70 | + $sqliteFile = $datadir . '/' . $this->dbName . 'db'; |
|
71 | + if (file_exists($sqliteFile)) { |
|
72 | + unlink($sqliteFile); |
|
73 | + } |
|
74 | + } |
|
75 | 75 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | if ($host === '') { |
141 | 141 | $additionalConnectionParams['dbname'] = $dbName; // use dbname as easy connect name |
142 | 142 | } else { |
143 | - $additionalConnectionParams['dbname'] = '//' . $host . (!empty($port) ? ":{$port}" : "") . '/' . $dbName; |
|
143 | + $additionalConnectionParams['dbname'] = '//'.$host.(!empty($port) ? ":{$port}" : "").'/'.$dbName; |
|
144 | 144 | } |
145 | 145 | unset($additionalConnectionParams['host']); |
146 | 146 | break; |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | $name = $this->config->getValue('dbname', self::DEFAULT_DBNAME); |
196 | 196 | |
197 | 197 | if ($this->normalizeType($type) === 'sqlite3') { |
198 | - $dataDir = $this->config->getValue("datadirectory", \OC::$SERVERROOT . '/data'); |
|
199 | - $connectionParams['path'] = $dataDir . '/' . $name . '.db'; |
|
198 | + $dataDir = $this->config->getValue("datadirectory", \OC::$SERVERROOT.'/data'); |
|
199 | + $connectionParams['path'] = $dataDir.'/'.$name.'.db'; |
|
200 | 200 | } else { |
201 | 201 | $host = $this->config->getValue('dbhost', ''); |
202 | 202 | $connectionParams = array_merge($connectionParams, $this->splitHostFromPortAndSocket($host)); |
@@ -39,222 +39,222 @@ |
||
39 | 39 | * Takes care of creating and configuring Doctrine connections. |
40 | 40 | */ |
41 | 41 | class ConnectionFactory { |
42 | - /** @var string default database name */ |
|
43 | - public const DEFAULT_DBNAME = 'owncloud'; |
|
42 | + /** @var string default database name */ |
|
43 | + public const DEFAULT_DBNAME = 'owncloud'; |
|
44 | 44 | |
45 | - /** @var string default database table prefix */ |
|
46 | - public const DEFAULT_DBTABLEPREFIX = 'oc_'; |
|
45 | + /** @var string default database table prefix */ |
|
46 | + public const DEFAULT_DBTABLEPREFIX = 'oc_'; |
|
47 | 47 | |
48 | - /** |
|
49 | - * @var array |
|
50 | - * |
|
51 | - * Array mapping DBMS type to default connection parameters passed to |
|
52 | - * \Doctrine\DBAL\DriverManager::getConnection(). |
|
53 | - */ |
|
54 | - protected $defaultConnectionParams = [ |
|
55 | - 'mysql' => [ |
|
56 | - 'adapter' => AdapterMySQL::class, |
|
57 | - 'charset' => 'UTF8', |
|
58 | - 'driver' => 'pdo_mysql', |
|
59 | - 'wrapperClass' => Connection::class, |
|
60 | - ], |
|
61 | - 'oci' => [ |
|
62 | - 'adapter' => AdapterOCI8::class, |
|
63 | - 'charset' => 'AL32UTF8', |
|
64 | - 'driver' => 'oci8', |
|
65 | - 'wrapperClass' => OracleConnection::class, |
|
66 | - ], |
|
67 | - 'pgsql' => [ |
|
68 | - 'adapter' => AdapterPgSql::class, |
|
69 | - 'driver' => 'pdo_pgsql', |
|
70 | - 'wrapperClass' => Connection::class, |
|
71 | - ], |
|
72 | - 'sqlite3' => [ |
|
73 | - 'adapter' => AdapterSqlite::class, |
|
74 | - 'driver' => 'pdo_sqlite', |
|
75 | - 'wrapperClass' => Connection::class, |
|
76 | - ], |
|
77 | - ]; |
|
48 | + /** |
|
49 | + * @var array |
|
50 | + * |
|
51 | + * Array mapping DBMS type to default connection parameters passed to |
|
52 | + * \Doctrine\DBAL\DriverManager::getConnection(). |
|
53 | + */ |
|
54 | + protected $defaultConnectionParams = [ |
|
55 | + 'mysql' => [ |
|
56 | + 'adapter' => AdapterMySQL::class, |
|
57 | + 'charset' => 'UTF8', |
|
58 | + 'driver' => 'pdo_mysql', |
|
59 | + 'wrapperClass' => Connection::class, |
|
60 | + ], |
|
61 | + 'oci' => [ |
|
62 | + 'adapter' => AdapterOCI8::class, |
|
63 | + 'charset' => 'AL32UTF8', |
|
64 | + 'driver' => 'oci8', |
|
65 | + 'wrapperClass' => OracleConnection::class, |
|
66 | + ], |
|
67 | + 'pgsql' => [ |
|
68 | + 'adapter' => AdapterPgSql::class, |
|
69 | + 'driver' => 'pdo_pgsql', |
|
70 | + 'wrapperClass' => Connection::class, |
|
71 | + ], |
|
72 | + 'sqlite3' => [ |
|
73 | + 'adapter' => AdapterSqlite::class, |
|
74 | + 'driver' => 'pdo_sqlite', |
|
75 | + 'wrapperClass' => Connection::class, |
|
76 | + ], |
|
77 | + ]; |
|
78 | 78 | |
79 | - /** @var SystemConfig */ |
|
80 | - private $config; |
|
79 | + /** @var SystemConfig */ |
|
80 | + private $config; |
|
81 | 81 | |
82 | - /** |
|
83 | - * ConnectionFactory constructor. |
|
84 | - * |
|
85 | - * @param SystemConfig $systemConfig |
|
86 | - */ |
|
87 | - public function __construct(SystemConfig $systemConfig) { |
|
88 | - $this->config = $systemConfig; |
|
89 | - if ($this->config->getValue('mysql.utf8mb4', false)) { |
|
90 | - $this->defaultConnectionParams['mysql']['charset'] = 'utf8mb4'; |
|
91 | - } |
|
92 | - $collationOverride = $this->config->getValue('mysql.collation', null); |
|
93 | - if ($collationOverride) { |
|
94 | - $this->defaultConnectionParams['mysql']['collation'] = $collationOverride; |
|
95 | - } |
|
96 | - } |
|
82 | + /** |
|
83 | + * ConnectionFactory constructor. |
|
84 | + * |
|
85 | + * @param SystemConfig $systemConfig |
|
86 | + */ |
|
87 | + public function __construct(SystemConfig $systemConfig) { |
|
88 | + $this->config = $systemConfig; |
|
89 | + if ($this->config->getValue('mysql.utf8mb4', false)) { |
|
90 | + $this->defaultConnectionParams['mysql']['charset'] = 'utf8mb4'; |
|
91 | + } |
|
92 | + $collationOverride = $this->config->getValue('mysql.collation', null); |
|
93 | + if ($collationOverride) { |
|
94 | + $this->defaultConnectionParams['mysql']['collation'] = $collationOverride; |
|
95 | + } |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * @brief Get default connection parameters for a given DBMS. |
|
100 | - * @param string $type DBMS type |
|
101 | - * @throws \InvalidArgumentException If $type is invalid |
|
102 | - * @return array Default connection parameters. |
|
103 | - */ |
|
104 | - public function getDefaultConnectionParams($type) { |
|
105 | - $normalizedType = $this->normalizeType($type); |
|
106 | - if (!isset($this->defaultConnectionParams[$normalizedType])) { |
|
107 | - throw new \InvalidArgumentException("Unsupported type: $type"); |
|
108 | - } |
|
109 | - $result = $this->defaultConnectionParams[$normalizedType]; |
|
110 | - // \PDO::MYSQL_ATTR_FOUND_ROWS may not be defined, e.g. when the MySQL |
|
111 | - // driver is missing. In this case, we won't be able to connect anyway. |
|
112 | - if ($normalizedType === 'mysql' && defined('\PDO::MYSQL_ATTR_FOUND_ROWS')) { |
|
113 | - $result['driverOptions'] = [ |
|
114 | - \PDO::MYSQL_ATTR_FOUND_ROWS => true, |
|
115 | - ]; |
|
116 | - } |
|
117 | - return $result; |
|
118 | - } |
|
98 | + /** |
|
99 | + * @brief Get default connection parameters for a given DBMS. |
|
100 | + * @param string $type DBMS type |
|
101 | + * @throws \InvalidArgumentException If $type is invalid |
|
102 | + * @return array Default connection parameters. |
|
103 | + */ |
|
104 | + public function getDefaultConnectionParams($type) { |
|
105 | + $normalizedType = $this->normalizeType($type); |
|
106 | + if (!isset($this->defaultConnectionParams[$normalizedType])) { |
|
107 | + throw new \InvalidArgumentException("Unsupported type: $type"); |
|
108 | + } |
|
109 | + $result = $this->defaultConnectionParams[$normalizedType]; |
|
110 | + // \PDO::MYSQL_ATTR_FOUND_ROWS may not be defined, e.g. when the MySQL |
|
111 | + // driver is missing. In this case, we won't be able to connect anyway. |
|
112 | + if ($normalizedType === 'mysql' && defined('\PDO::MYSQL_ATTR_FOUND_ROWS')) { |
|
113 | + $result['driverOptions'] = [ |
|
114 | + \PDO::MYSQL_ATTR_FOUND_ROWS => true, |
|
115 | + ]; |
|
116 | + } |
|
117 | + return $result; |
|
118 | + } |
|
119 | 119 | |
120 | - /** |
|
121 | - * @brief Get default connection parameters for a given DBMS. |
|
122 | - * @param string $type DBMS type |
|
123 | - * @param array $additionalConnectionParams Additional connection parameters |
|
124 | - * @return \OC\DB\Connection |
|
125 | - */ |
|
126 | - public function getConnection($type, $additionalConnectionParams) { |
|
127 | - $normalizedType = $this->normalizeType($type); |
|
128 | - $eventManager = new EventManager(); |
|
129 | - $eventManager->addEventSubscriber(new SetTransactionIsolationLevel()); |
|
130 | - switch ($normalizedType) { |
|
131 | - case 'mysql': |
|
132 | - $eventManager->addEventSubscriber( |
|
133 | - new SQLSessionInit("SET SESSION AUTOCOMMIT=1")); |
|
134 | - break; |
|
135 | - case 'oci': |
|
136 | - $eventManager->addEventSubscriber(new OracleSessionInit); |
|
137 | - // the driverOptions are unused in dbal and need to be mapped to the parameters |
|
138 | - if (isset($additionalConnectionParams['driverOptions'])) { |
|
139 | - $additionalConnectionParams = array_merge($additionalConnectionParams, $additionalConnectionParams['driverOptions']); |
|
140 | - } |
|
141 | - $host = $additionalConnectionParams['host']; |
|
142 | - $port = isset($additionalConnectionParams['port']) ? $additionalConnectionParams['port'] : null; |
|
143 | - $dbName = $additionalConnectionParams['dbname']; |
|
120 | + /** |
|
121 | + * @brief Get default connection parameters for a given DBMS. |
|
122 | + * @param string $type DBMS type |
|
123 | + * @param array $additionalConnectionParams Additional connection parameters |
|
124 | + * @return \OC\DB\Connection |
|
125 | + */ |
|
126 | + public function getConnection($type, $additionalConnectionParams) { |
|
127 | + $normalizedType = $this->normalizeType($type); |
|
128 | + $eventManager = new EventManager(); |
|
129 | + $eventManager->addEventSubscriber(new SetTransactionIsolationLevel()); |
|
130 | + switch ($normalizedType) { |
|
131 | + case 'mysql': |
|
132 | + $eventManager->addEventSubscriber( |
|
133 | + new SQLSessionInit("SET SESSION AUTOCOMMIT=1")); |
|
134 | + break; |
|
135 | + case 'oci': |
|
136 | + $eventManager->addEventSubscriber(new OracleSessionInit); |
|
137 | + // the driverOptions are unused in dbal and need to be mapped to the parameters |
|
138 | + if (isset($additionalConnectionParams['driverOptions'])) { |
|
139 | + $additionalConnectionParams = array_merge($additionalConnectionParams, $additionalConnectionParams['driverOptions']); |
|
140 | + } |
|
141 | + $host = $additionalConnectionParams['host']; |
|
142 | + $port = isset($additionalConnectionParams['port']) ? $additionalConnectionParams['port'] : null; |
|
143 | + $dbName = $additionalConnectionParams['dbname']; |
|
144 | 144 | |
145 | - // we set the connect string as dbname and unset the host to coerce doctrine into using it as connect string |
|
146 | - if ($host === '') { |
|
147 | - $additionalConnectionParams['dbname'] = $dbName; // use dbname as easy connect name |
|
148 | - } else { |
|
149 | - $additionalConnectionParams['dbname'] = '//' . $host . (!empty($port) ? ":{$port}" : "") . '/' . $dbName; |
|
150 | - } |
|
151 | - unset($additionalConnectionParams['host']); |
|
152 | - break; |
|
145 | + // we set the connect string as dbname and unset the host to coerce doctrine into using it as connect string |
|
146 | + if ($host === '') { |
|
147 | + $additionalConnectionParams['dbname'] = $dbName; // use dbname as easy connect name |
|
148 | + } else { |
|
149 | + $additionalConnectionParams['dbname'] = '//' . $host . (!empty($port) ? ":{$port}" : "") . '/' . $dbName; |
|
150 | + } |
|
151 | + unset($additionalConnectionParams['host']); |
|
152 | + break; |
|
153 | 153 | |
154 | - case 'sqlite3': |
|
155 | - $journalMode = $additionalConnectionParams['sqlite.journal_mode']; |
|
156 | - $additionalConnectionParams['platform'] = new OCSqlitePlatform(); |
|
157 | - $eventManager->addEventSubscriber(new SQLiteSessionInit(true, $journalMode)); |
|
158 | - break; |
|
159 | - } |
|
160 | - /** @var Connection $connection */ |
|
161 | - $connection = DriverManager::getConnection( |
|
162 | - array_merge($this->getDefaultConnectionParams($type), $additionalConnectionParams), |
|
163 | - new Configuration(), |
|
164 | - $eventManager |
|
165 | - ); |
|
166 | - return $connection; |
|
167 | - } |
|
154 | + case 'sqlite3': |
|
155 | + $journalMode = $additionalConnectionParams['sqlite.journal_mode']; |
|
156 | + $additionalConnectionParams['platform'] = new OCSqlitePlatform(); |
|
157 | + $eventManager->addEventSubscriber(new SQLiteSessionInit(true, $journalMode)); |
|
158 | + break; |
|
159 | + } |
|
160 | + /** @var Connection $connection */ |
|
161 | + $connection = DriverManager::getConnection( |
|
162 | + array_merge($this->getDefaultConnectionParams($type), $additionalConnectionParams), |
|
163 | + new Configuration(), |
|
164 | + $eventManager |
|
165 | + ); |
|
166 | + return $connection; |
|
167 | + } |
|
168 | 168 | |
169 | - /** |
|
170 | - * @brief Normalize DBMS type |
|
171 | - * @param string $type DBMS type |
|
172 | - * @return string Normalized DBMS type |
|
173 | - */ |
|
174 | - public function normalizeType($type) { |
|
175 | - return $type === 'sqlite' ? 'sqlite3' : $type; |
|
176 | - } |
|
169 | + /** |
|
170 | + * @brief Normalize DBMS type |
|
171 | + * @param string $type DBMS type |
|
172 | + * @return string Normalized DBMS type |
|
173 | + */ |
|
174 | + public function normalizeType($type) { |
|
175 | + return $type === 'sqlite' ? 'sqlite3' : $type; |
|
176 | + } |
|
177 | 177 | |
178 | - /** |
|
179 | - * Checks whether the specified DBMS type is valid. |
|
180 | - * |
|
181 | - * @param string $type |
|
182 | - * @return bool |
|
183 | - */ |
|
184 | - public function isValidType($type) { |
|
185 | - $normalizedType = $this->normalizeType($type); |
|
186 | - return isset($this->defaultConnectionParams[$normalizedType]); |
|
187 | - } |
|
178 | + /** |
|
179 | + * Checks whether the specified DBMS type is valid. |
|
180 | + * |
|
181 | + * @param string $type |
|
182 | + * @return bool |
|
183 | + */ |
|
184 | + public function isValidType($type) { |
|
185 | + $normalizedType = $this->normalizeType($type); |
|
186 | + return isset($this->defaultConnectionParams[$normalizedType]); |
|
187 | + } |
|
188 | 188 | |
189 | - /** |
|
190 | - * Create the connection parameters for the config |
|
191 | - * |
|
192 | - * @return array |
|
193 | - */ |
|
194 | - public function createConnectionParams() { |
|
195 | - $type = $this->config->getValue('dbtype', 'sqlite'); |
|
189 | + /** |
|
190 | + * Create the connection parameters for the config |
|
191 | + * |
|
192 | + * @return array |
|
193 | + */ |
|
194 | + public function createConnectionParams() { |
|
195 | + $type = $this->config->getValue('dbtype', 'sqlite'); |
|
196 | 196 | |
197 | - $connectionParams = [ |
|
198 | - 'user' => $this->config->getValue('dbuser', ''), |
|
199 | - 'password' => $this->config->getValue('dbpassword', ''), |
|
200 | - ]; |
|
201 | - $name = $this->config->getValue('dbname', self::DEFAULT_DBNAME); |
|
197 | + $connectionParams = [ |
|
198 | + 'user' => $this->config->getValue('dbuser', ''), |
|
199 | + 'password' => $this->config->getValue('dbpassword', ''), |
|
200 | + ]; |
|
201 | + $name = $this->config->getValue('dbname', self::DEFAULT_DBNAME); |
|
202 | 202 | |
203 | - if ($this->normalizeType($type) === 'sqlite3') { |
|
204 | - $dataDir = $this->config->getValue("datadirectory", \OC::$SERVERROOT . '/data'); |
|
205 | - $connectionParams['path'] = $dataDir . '/' . $name . '.db'; |
|
206 | - } else { |
|
207 | - $host = $this->config->getValue('dbhost', ''); |
|
208 | - $connectionParams = array_merge($connectionParams, $this->splitHostFromPortAndSocket($host)); |
|
209 | - $connectionParams['dbname'] = $name; |
|
210 | - } |
|
203 | + if ($this->normalizeType($type) === 'sqlite3') { |
|
204 | + $dataDir = $this->config->getValue("datadirectory", \OC::$SERVERROOT . '/data'); |
|
205 | + $connectionParams['path'] = $dataDir . '/' . $name . '.db'; |
|
206 | + } else { |
|
207 | + $host = $this->config->getValue('dbhost', ''); |
|
208 | + $connectionParams = array_merge($connectionParams, $this->splitHostFromPortAndSocket($host)); |
|
209 | + $connectionParams['dbname'] = $name; |
|
210 | + } |
|
211 | 211 | |
212 | - $connectionParams['tablePrefix'] = $this->config->getValue('dbtableprefix', self::DEFAULT_DBTABLEPREFIX); |
|
213 | - $connectionParams['sqlite.journal_mode'] = $this->config->getValue('sqlite.journal_mode', 'WAL'); |
|
212 | + $connectionParams['tablePrefix'] = $this->config->getValue('dbtableprefix', self::DEFAULT_DBTABLEPREFIX); |
|
213 | + $connectionParams['sqlite.journal_mode'] = $this->config->getValue('sqlite.journal_mode', 'WAL'); |
|
214 | 214 | |
215 | - //additional driver options, eg. for mysql ssl |
|
216 | - $driverOptions = $this->config->getValue('dbdriveroptions', null); |
|
217 | - if ($driverOptions) { |
|
218 | - $connectionParams['driverOptions'] = $driverOptions; |
|
219 | - } |
|
215 | + //additional driver options, eg. for mysql ssl |
|
216 | + $driverOptions = $this->config->getValue('dbdriveroptions', null); |
|
217 | + if ($driverOptions) { |
|
218 | + $connectionParams['driverOptions'] = $driverOptions; |
|
219 | + } |
|
220 | 220 | |
221 | - // set default table creation options |
|
222 | - $connectionParams['defaultTableOptions'] = [ |
|
223 | - 'collate' => 'utf8_bin', |
|
224 | - 'tablePrefix' => $connectionParams['tablePrefix'] |
|
225 | - ]; |
|
221 | + // set default table creation options |
|
222 | + $connectionParams['defaultTableOptions'] = [ |
|
223 | + 'collate' => 'utf8_bin', |
|
224 | + 'tablePrefix' => $connectionParams['tablePrefix'] |
|
225 | + ]; |
|
226 | 226 | |
227 | - if ($this->config->getValue('mysql.utf8mb4', false)) { |
|
228 | - $connectionParams['defaultTableOptions'] = [ |
|
229 | - 'collate' => 'utf8mb4_bin', |
|
230 | - 'charset' => 'utf8mb4', |
|
231 | - 'tablePrefix' => $connectionParams['tablePrefix'] |
|
232 | - ]; |
|
233 | - } |
|
227 | + if ($this->config->getValue('mysql.utf8mb4', false)) { |
|
228 | + $connectionParams['defaultTableOptions'] = [ |
|
229 | + 'collate' => 'utf8mb4_bin', |
|
230 | + 'charset' => 'utf8mb4', |
|
231 | + 'tablePrefix' => $connectionParams['tablePrefix'] |
|
232 | + ]; |
|
233 | + } |
|
234 | 234 | |
235 | - return $connectionParams; |
|
236 | - } |
|
235 | + return $connectionParams; |
|
236 | + } |
|
237 | 237 | |
238 | - /** |
|
239 | - * @param string $host |
|
240 | - * @return array |
|
241 | - */ |
|
242 | - protected function splitHostFromPortAndSocket($host): array { |
|
243 | - $params = [ |
|
244 | - 'host' => $host, |
|
245 | - ]; |
|
238 | + /** |
|
239 | + * @param string $host |
|
240 | + * @return array |
|
241 | + */ |
|
242 | + protected function splitHostFromPortAndSocket($host): array { |
|
243 | + $params = [ |
|
244 | + 'host' => $host, |
|
245 | + ]; |
|
246 | 246 | |
247 | - $matches = []; |
|
248 | - if (preg_match('/^(.*):([^\]:]+)$/', $host, $matches)) { |
|
249 | - // Host variable carries a port or socket. |
|
250 | - $params['host'] = $matches[1]; |
|
251 | - if (is_numeric($matches[2])) { |
|
252 | - $params['port'] = (int) $matches[2]; |
|
253 | - } else { |
|
254 | - $params['unix_socket'] = $matches[2]; |
|
255 | - } |
|
256 | - } |
|
247 | + $matches = []; |
|
248 | + if (preg_match('/^(.*):([^\]:]+)$/', $host, $matches)) { |
|
249 | + // Host variable carries a port or socket. |
|
250 | + $params['host'] = $matches[1]; |
|
251 | + if (is_numeric($matches[2])) { |
|
252 | + $params['port'] = (int) $matches[2]; |
|
253 | + } else { |
|
254 | + $params['unix_socket'] = $matches[2]; |
|
255 | + } |
|
256 | + } |
|
257 | 257 | |
258 | - return $params; |
|
259 | - } |
|
258 | + return $params; |
|
259 | + } |
|
260 | 260 | } |
@@ -33,11 +33,11 @@ |
||
33 | 33 | */ |
34 | 34 | interface IPersonalProviderSettings { |
35 | 35 | |
36 | - /** |
|
37 | - * @return Template |
|
38 | - * |
|
39 | - * @since 15.0.0 |
|
40 | - */ |
|
41 | - public function getBody(): Template; |
|
36 | + /** |
|
37 | + * @return Template |
|
38 | + * |
|
39 | + * @since 15.0.0 |
|
40 | + */ |
|
41 | + public function getBody(): Template; |
|
42 | 42 | |
43 | 43 | } |
@@ -35,13 +35,13 @@ |
||
35 | 35 | */ |
36 | 36 | interface IProvidesPersonalSettings extends IProvider { |
37 | 37 | |
38 | - /** |
|
39 | - * @param IUser $user |
|
40 | - * |
|
41 | - * @return IPersonalProviderSettings |
|
42 | - * |
|
43 | - * @since 15.0.0 |
|
44 | - */ |
|
45 | - public function getPersonalSettings(IUser $user): IPersonalProviderSettings; |
|
38 | + /** |
|
39 | + * @param IUser $user |
|
40 | + * |
|
41 | + * @return IPersonalProviderSettings |
|
42 | + * |
|
43 | + * @since 15.0.0 |
|
44 | + */ |
|
45 | + public function getPersonalSettings(IUser $user): IPersonalProviderSettings; |
|
46 | 46 | |
47 | 47 | } |
@@ -31,41 +31,41 @@ |
||
31 | 31 | */ |
32 | 32 | interface IManager { |
33 | 33 | |
34 | - /** |
|
35 | - * Registers a resource backend |
|
36 | - * |
|
37 | - * @param string $backendClass |
|
38 | - * @return void |
|
39 | - * @since 14.0.0 |
|
40 | - */ |
|
41 | - public function registerBackend(string $backendClass); |
|
34 | + /** |
|
35 | + * Registers a resource backend |
|
36 | + * |
|
37 | + * @param string $backendClass |
|
38 | + * @return void |
|
39 | + * @since 14.0.0 |
|
40 | + */ |
|
41 | + public function registerBackend(string $backendClass); |
|
42 | 42 | |
43 | - /** |
|
44 | - * Unregisters a resource backend |
|
45 | - * |
|
46 | - * @param string $backendClass |
|
47 | - * @return void |
|
48 | - * @since 14.0.0 |
|
49 | - */ |
|
50 | - public function unregisterBackend(string $backendClass); |
|
43 | + /** |
|
44 | + * Unregisters a resource backend |
|
45 | + * |
|
46 | + * @param string $backendClass |
|
47 | + * @return void |
|
48 | + * @since 14.0.0 |
|
49 | + */ |
|
50 | + public function unregisterBackend(string $backendClass); |
|
51 | 51 | |
52 | - /** |
|
53 | - * @return IBackend[] |
|
54 | - * @since 14.0.0 |
|
55 | - */ |
|
56 | - public function getBackends():array; |
|
52 | + /** |
|
53 | + * @return IBackend[] |
|
54 | + * @since 14.0.0 |
|
55 | + */ |
|
56 | + public function getBackends():array; |
|
57 | 57 | |
58 | - /** |
|
59 | - * @param string $backendId |
|
60 | - * @return IBackend|null |
|
61 | - * @since 14.0.0 |
|
62 | - */ |
|
63 | - public function getBackend($backendId); |
|
58 | + /** |
|
59 | + * @param string $backendId |
|
60 | + * @return IBackend|null |
|
61 | + * @since 14.0.0 |
|
62 | + */ |
|
63 | + public function getBackend($backendId); |
|
64 | 64 | |
65 | - /** |
|
66 | - * removes all registered backend instances |
|
67 | - * @return void |
|
68 | - * @since 14.0.0 |
|
69 | - */ |
|
70 | - public function clear(); |
|
65 | + /** |
|
66 | + * removes all registered backend instances |
|
67 | + * @return void |
|
68 | + * @since 14.0.0 |
|
69 | + */ |
|
70 | + public function clear(); |
|
71 | 71 | } |
@@ -31,41 +31,41 @@ |
||
31 | 31 | */ |
32 | 32 | interface IManager { |
33 | 33 | |
34 | - /** |
|
35 | - * Registers a room backend |
|
36 | - * |
|
37 | - * @param string $backendClass |
|
38 | - * @return void |
|
39 | - * @since 14.0.0 |
|
40 | - */ |
|
41 | - public function registerBackend(string $backendClass); |
|
34 | + /** |
|
35 | + * Registers a room backend |
|
36 | + * |
|
37 | + * @param string $backendClass |
|
38 | + * @return void |
|
39 | + * @since 14.0.0 |
|
40 | + */ |
|
41 | + public function registerBackend(string $backendClass); |
|
42 | 42 | |
43 | - /** |
|
44 | - * Unregisters a room backend |
|
45 | - * |
|
46 | - * @param string $backendClass |
|
47 | - * @return void |
|
48 | - * @since 14.0.0 |
|
49 | - */ |
|
50 | - public function unregisterBackend(string $backendClass); |
|
43 | + /** |
|
44 | + * Unregisters a room backend |
|
45 | + * |
|
46 | + * @param string $backendClass |
|
47 | + * @return void |
|
48 | + * @since 14.0.0 |
|
49 | + */ |
|
50 | + public function unregisterBackend(string $backendClass); |
|
51 | 51 | |
52 | - /** |
|
53 | - * @return IBackend[] |
|
54 | - * @since 14.0.0 |
|
55 | - */ |
|
56 | - public function getBackends():array; |
|
52 | + /** |
|
53 | + * @return IBackend[] |
|
54 | + * @since 14.0.0 |
|
55 | + */ |
|
56 | + public function getBackends():array; |
|
57 | 57 | |
58 | - /** |
|
59 | - * @param string $backendId |
|
60 | - * @return IBackend|null |
|
61 | - * @since 14.0.0 |
|
62 | - */ |
|
63 | - public function getBackend($backendId); |
|
58 | + /** |
|
59 | + * @param string $backendId |
|
60 | + * @return IBackend|null |
|
61 | + * @since 14.0.0 |
|
62 | + */ |
|
63 | + public function getBackend($backendId); |
|
64 | 64 | |
65 | - /** |
|
66 | - * removes all registered backend instances |
|
67 | - * @return void |
|
68 | - * @since 14.0.0 |
|
69 | - */ |
|
70 | - public function clear(); |
|
65 | + /** |
|
66 | + * removes all registered backend instances |
|
67 | + * @return void |
|
68 | + * @since 14.0.0 |
|
69 | + */ |
|
70 | + public function clear(); |
|
71 | 71 | } |
@@ -32,19 +32,19 @@ |
||
32 | 32 | */ |
33 | 33 | class ProviderAlreadyExistsException extends HintException { |
34 | 34 | |
35 | - /** |
|
36 | - * ProviderAlreadyExistsException constructor. |
|
37 | - * |
|
38 | - * @since 14.0.0 |
|
39 | - * |
|
40 | - * @param string $newProviderId cloud federation provider ID of the new provider |
|
41 | - * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
42 | - */ |
|
43 | - public function __construct($newProviderId, $existingProviderName) { |
|
44 | - $l = \OC::$server->getL10N('federation'); |
|
45 | - $message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
46 | - $hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]); |
|
47 | - parent::__construct($message, $hint); |
|
48 | - } |
|
35 | + /** |
|
36 | + * ProviderAlreadyExistsException constructor. |
|
37 | + * |
|
38 | + * @since 14.0.0 |
|
39 | + * |
|
40 | + * @param string $newProviderId cloud federation provider ID of the new provider |
|
41 | + * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
42 | + */ |
|
43 | + public function __construct($newProviderId, $existingProviderName) { |
|
44 | + $l = \OC::$server->getL10N('federation'); |
|
45 | + $message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
46 | + $hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]); |
|
47 | + parent::__construct($message, $hint); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | */ |
43 | 43 | public function __construct($newProviderId, $existingProviderName) { |
44 | 44 | $l = \OC::$server->getL10N('federation'); |
45 | - $message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
45 | + $message = 'ID "'.$newProviderId.'" already used by cloud federation provider "'.$existingProviderName.'"'; |
|
46 | 46 | $hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]); |
47 | 47 | parent::__construct($message, $hint); |
48 | 48 | } |
@@ -8,6 +8,6 @@ |
||
8 | 8 | </p> |
9 | 9 | <br /> |
10 | 10 | <p> |
11 | - <?php print_unescaped($l->t('Further information how to configure this can be found in the %1$sdocumentation%2$s.', ['<a href="' . $_['docUrl'] . '" target="blank">', '</a>'])); ?> |
|
11 | + <?php print_unescaped($l->t('Further information how to configure this can be found in the %1$sdocumentation%2$s.', ['<a href="'.$_['docUrl'].'" target="blank">', '</a>'])); ?> |
|
12 | 12 | </p> |
13 | 13 | </div> |