@@ -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)); |
@@ -40,219 +40,219 @@ |
||
| 40 | 40 | * Takes care of creating and configuring Doctrine connections. |
| 41 | 41 | */ |
| 42 | 42 | class ConnectionFactory { |
| 43 | - /** @var string default database name */ |
|
| 44 | - public const DEFAULT_DBNAME = 'owncloud'; |
|
| 43 | + /** @var string default database name */ |
|
| 44 | + public const DEFAULT_DBNAME = 'owncloud'; |
|
| 45 | 45 | |
| 46 | - /** @var string default database table prefix */ |
|
| 47 | - public const DEFAULT_DBTABLEPREFIX = 'oc_'; |
|
| 46 | + /** @var string default database table prefix */ |
|
| 47 | + public const DEFAULT_DBTABLEPREFIX = 'oc_'; |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @var array |
|
| 51 | - * |
|
| 52 | - * Array mapping DBMS type to default connection parameters passed to |
|
| 53 | - * \Doctrine\DBAL\DriverManager::getConnection(). |
|
| 54 | - */ |
|
| 55 | - protected $defaultConnectionParams = [ |
|
| 56 | - 'mysql' => [ |
|
| 57 | - 'adapter' => AdapterMySQL::class, |
|
| 58 | - 'charset' => 'UTF8', |
|
| 59 | - 'driver' => 'pdo_mysql', |
|
| 60 | - 'wrapperClass' => Connection::class, |
|
| 61 | - ], |
|
| 62 | - 'oci' => [ |
|
| 63 | - 'adapter' => AdapterOCI8::class, |
|
| 64 | - 'charset' => 'AL32UTF8', |
|
| 65 | - 'driver' => 'oci8', |
|
| 66 | - 'wrapperClass' => OracleConnection::class, |
|
| 67 | - ], |
|
| 68 | - 'pgsql' => [ |
|
| 69 | - 'adapter' => AdapterPgSql::class, |
|
| 70 | - 'driver' => 'pdo_pgsql', |
|
| 71 | - 'wrapperClass' => Connection::class, |
|
| 72 | - ], |
|
| 73 | - 'sqlite3' => [ |
|
| 74 | - 'adapter' => AdapterSqlite::class, |
|
| 75 | - 'driver' => 'pdo_sqlite', |
|
| 76 | - 'wrapperClass' => Connection::class, |
|
| 77 | - ], |
|
| 78 | - ]; |
|
| 49 | + /** |
|
| 50 | + * @var array |
|
| 51 | + * |
|
| 52 | + * Array mapping DBMS type to default connection parameters passed to |
|
| 53 | + * \Doctrine\DBAL\DriverManager::getConnection(). |
|
| 54 | + */ |
|
| 55 | + protected $defaultConnectionParams = [ |
|
| 56 | + 'mysql' => [ |
|
| 57 | + 'adapter' => AdapterMySQL::class, |
|
| 58 | + 'charset' => 'UTF8', |
|
| 59 | + 'driver' => 'pdo_mysql', |
|
| 60 | + 'wrapperClass' => Connection::class, |
|
| 61 | + ], |
|
| 62 | + 'oci' => [ |
|
| 63 | + 'adapter' => AdapterOCI8::class, |
|
| 64 | + 'charset' => 'AL32UTF8', |
|
| 65 | + 'driver' => 'oci8', |
|
| 66 | + 'wrapperClass' => OracleConnection::class, |
|
| 67 | + ], |
|
| 68 | + 'pgsql' => [ |
|
| 69 | + 'adapter' => AdapterPgSql::class, |
|
| 70 | + 'driver' => 'pdo_pgsql', |
|
| 71 | + 'wrapperClass' => Connection::class, |
|
| 72 | + ], |
|
| 73 | + 'sqlite3' => [ |
|
| 74 | + 'adapter' => AdapterSqlite::class, |
|
| 75 | + 'driver' => 'pdo_sqlite', |
|
| 76 | + 'wrapperClass' => Connection::class, |
|
| 77 | + ], |
|
| 78 | + ]; |
|
| 79 | 79 | |
| 80 | - /** @var SystemConfig */ |
|
| 81 | - private $config; |
|
| 80 | + /** @var SystemConfig */ |
|
| 81 | + private $config; |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * ConnectionFactory constructor. |
|
| 85 | - * |
|
| 86 | - * @param SystemConfig $systemConfig |
|
| 87 | - */ |
|
| 88 | - public function __construct(SystemConfig $systemConfig) { |
|
| 89 | - $this->config = $systemConfig; |
|
| 90 | - if ($this->config->getValue('mysql.utf8mb4', false)) { |
|
| 91 | - $this->defaultConnectionParams['mysql']['charset'] = 'utf8mb4'; |
|
| 92 | - } |
|
| 93 | - } |
|
| 83 | + /** |
|
| 84 | + * ConnectionFactory constructor. |
|
| 85 | + * |
|
| 86 | + * @param SystemConfig $systemConfig |
|
| 87 | + */ |
|
| 88 | + public function __construct(SystemConfig $systemConfig) { |
|
| 89 | + $this->config = $systemConfig; |
|
| 90 | + if ($this->config->getValue('mysql.utf8mb4', false)) { |
|
| 91 | + $this->defaultConnectionParams['mysql']['charset'] = 'utf8mb4'; |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * @brief Get default connection parameters for a given DBMS. |
|
| 97 | - * @param string $type DBMS type |
|
| 98 | - * @throws \InvalidArgumentException If $type is invalid |
|
| 99 | - * @return array Default connection parameters. |
|
| 100 | - */ |
|
| 101 | - public function getDefaultConnectionParams($type) { |
|
| 102 | - $normalizedType = $this->normalizeType($type); |
|
| 103 | - if (!isset($this->defaultConnectionParams[$normalizedType])) { |
|
| 104 | - throw new \InvalidArgumentException("Unsupported type: $type"); |
|
| 105 | - } |
|
| 106 | - $result = $this->defaultConnectionParams[$normalizedType]; |
|
| 107 | - // \PDO::MYSQL_ATTR_FOUND_ROWS may not be defined, e.g. when the MySQL |
|
| 108 | - // driver is missing. In this case, we won't be able to connect anyway. |
|
| 109 | - if ($normalizedType === 'mysql' && defined('\PDO::MYSQL_ATTR_FOUND_ROWS')) { |
|
| 110 | - $result['driverOptions'] = [ |
|
| 111 | - \PDO::MYSQL_ATTR_FOUND_ROWS => true, |
|
| 112 | - ]; |
|
| 113 | - } |
|
| 114 | - return $result; |
|
| 115 | - } |
|
| 95 | + /** |
|
| 96 | + * @brief Get default connection parameters for a given DBMS. |
|
| 97 | + * @param string $type DBMS type |
|
| 98 | + * @throws \InvalidArgumentException If $type is invalid |
|
| 99 | + * @return array Default connection parameters. |
|
| 100 | + */ |
|
| 101 | + public function getDefaultConnectionParams($type) { |
|
| 102 | + $normalizedType = $this->normalizeType($type); |
|
| 103 | + if (!isset($this->defaultConnectionParams[$normalizedType])) { |
|
| 104 | + throw new \InvalidArgumentException("Unsupported type: $type"); |
|
| 105 | + } |
|
| 106 | + $result = $this->defaultConnectionParams[$normalizedType]; |
|
| 107 | + // \PDO::MYSQL_ATTR_FOUND_ROWS may not be defined, e.g. when the MySQL |
|
| 108 | + // driver is missing. In this case, we won't be able to connect anyway. |
|
| 109 | + if ($normalizedType === 'mysql' && defined('\PDO::MYSQL_ATTR_FOUND_ROWS')) { |
|
| 110 | + $result['driverOptions'] = [ |
|
| 111 | + \PDO::MYSQL_ATTR_FOUND_ROWS => true, |
|
| 112 | + ]; |
|
| 113 | + } |
|
| 114 | + return $result; |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * @brief Get default connection parameters for a given DBMS. |
|
| 119 | - * @param string $type DBMS type |
|
| 120 | - * @param array $additionalConnectionParams Additional connection parameters |
|
| 121 | - * @return \OC\DB\Connection |
|
| 122 | - */ |
|
| 123 | - public function getConnection($type, $additionalConnectionParams) { |
|
| 124 | - $normalizedType = $this->normalizeType($type); |
|
| 125 | - $eventManager = new EventManager(); |
|
| 126 | - $eventManager->addEventSubscriber(new SetTransactionIsolationLevel()); |
|
| 127 | - switch ($normalizedType) { |
|
| 128 | - case 'mysql': |
|
| 129 | - $eventManager->addEventSubscriber( |
|
| 130 | - new SQLSessionInit("SET SESSION AUTOCOMMIT=1")); |
|
| 131 | - break; |
|
| 132 | - case 'oci': |
|
| 133 | - $eventManager->addEventSubscriber(new OracleSessionInit); |
|
| 134 | - // the driverOptions are unused in dbal and need to be mapped to the parameters |
|
| 135 | - if (isset($additionalConnectionParams['driverOptions'])) { |
|
| 136 | - $additionalConnectionParams = array_merge($additionalConnectionParams, $additionalConnectionParams['driverOptions']); |
|
| 137 | - } |
|
| 138 | - $host = $additionalConnectionParams['host']; |
|
| 139 | - $port = isset($additionalConnectionParams['port']) ? $additionalConnectionParams['port'] : null; |
|
| 140 | - $dbName = $additionalConnectionParams['dbname']; |
|
| 117 | + /** |
|
| 118 | + * @brief Get default connection parameters for a given DBMS. |
|
| 119 | + * @param string $type DBMS type |
|
| 120 | + * @param array $additionalConnectionParams Additional connection parameters |
|
| 121 | + * @return \OC\DB\Connection |
|
| 122 | + */ |
|
| 123 | + public function getConnection($type, $additionalConnectionParams) { |
|
| 124 | + $normalizedType = $this->normalizeType($type); |
|
| 125 | + $eventManager = new EventManager(); |
|
| 126 | + $eventManager->addEventSubscriber(new SetTransactionIsolationLevel()); |
|
| 127 | + switch ($normalizedType) { |
|
| 128 | + case 'mysql': |
|
| 129 | + $eventManager->addEventSubscriber( |
|
| 130 | + new SQLSessionInit("SET SESSION AUTOCOMMIT=1")); |
|
| 131 | + break; |
|
| 132 | + case 'oci': |
|
| 133 | + $eventManager->addEventSubscriber(new OracleSessionInit); |
|
| 134 | + // the driverOptions are unused in dbal and need to be mapped to the parameters |
|
| 135 | + if (isset($additionalConnectionParams['driverOptions'])) { |
|
| 136 | + $additionalConnectionParams = array_merge($additionalConnectionParams, $additionalConnectionParams['driverOptions']); |
|
| 137 | + } |
|
| 138 | + $host = $additionalConnectionParams['host']; |
|
| 139 | + $port = isset($additionalConnectionParams['port']) ? $additionalConnectionParams['port'] : null; |
|
| 140 | + $dbName = $additionalConnectionParams['dbname']; |
|
| 141 | 141 | |
| 142 | - // we set the connect string as dbname and unset the host to coerce doctrine into using it as connect string |
|
| 143 | - if ($host === '') { |
|
| 144 | - $additionalConnectionParams['dbname'] = $dbName; // use dbname as easy connect name |
|
| 145 | - } else { |
|
| 146 | - $additionalConnectionParams['dbname'] = '//' . $host . (!empty($port) ? ":{$port}" : "") . '/' . $dbName; |
|
| 147 | - } |
|
| 148 | - unset($additionalConnectionParams['host']); |
|
| 149 | - break; |
|
| 142 | + // we set the connect string as dbname and unset the host to coerce doctrine into using it as connect string |
|
| 143 | + if ($host === '') { |
|
| 144 | + $additionalConnectionParams['dbname'] = $dbName; // use dbname as easy connect name |
|
| 145 | + } else { |
|
| 146 | + $additionalConnectionParams['dbname'] = '//' . $host . (!empty($port) ? ":{$port}" : "") . '/' . $dbName; |
|
| 147 | + } |
|
| 148 | + unset($additionalConnectionParams['host']); |
|
| 149 | + break; |
|
| 150 | 150 | |
| 151 | - case 'sqlite3': |
|
| 152 | - $journalMode = $additionalConnectionParams['sqlite.journal_mode']; |
|
| 153 | - $additionalConnectionParams['platform'] = new OCSqlitePlatform(); |
|
| 154 | - $eventManager->addEventSubscriber(new SQLiteSessionInit(true, $journalMode)); |
|
| 155 | - break; |
|
| 156 | - } |
|
| 157 | - /** @var Connection $connection */ |
|
| 158 | - $connection = DriverManager::getConnection( |
|
| 159 | - array_merge($this->getDefaultConnectionParams($type), $additionalConnectionParams), |
|
| 160 | - new Configuration(), |
|
| 161 | - $eventManager |
|
| 162 | - ); |
|
| 163 | - return $connection; |
|
| 164 | - } |
|
| 151 | + case 'sqlite3': |
|
| 152 | + $journalMode = $additionalConnectionParams['sqlite.journal_mode']; |
|
| 153 | + $additionalConnectionParams['platform'] = new OCSqlitePlatform(); |
|
| 154 | + $eventManager->addEventSubscriber(new SQLiteSessionInit(true, $journalMode)); |
|
| 155 | + break; |
|
| 156 | + } |
|
| 157 | + /** @var Connection $connection */ |
|
| 158 | + $connection = DriverManager::getConnection( |
|
| 159 | + array_merge($this->getDefaultConnectionParams($type), $additionalConnectionParams), |
|
| 160 | + new Configuration(), |
|
| 161 | + $eventManager |
|
| 162 | + ); |
|
| 163 | + return $connection; |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | - /** |
|
| 167 | - * @brief Normalize DBMS type |
|
| 168 | - * @param string $type DBMS type |
|
| 169 | - * @return string Normalized DBMS type |
|
| 170 | - */ |
|
| 171 | - public function normalizeType($type) { |
|
| 172 | - return $type === 'sqlite' ? 'sqlite3' : $type; |
|
| 173 | - } |
|
| 166 | + /** |
|
| 167 | + * @brief Normalize DBMS type |
|
| 168 | + * @param string $type DBMS type |
|
| 169 | + * @return string Normalized DBMS type |
|
| 170 | + */ |
|
| 171 | + public function normalizeType($type) { |
|
| 172 | + return $type === 'sqlite' ? 'sqlite3' : $type; |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | - /** |
|
| 176 | - * Checks whether the specified DBMS type is valid. |
|
| 177 | - * |
|
| 178 | - * @param string $type |
|
| 179 | - * @return bool |
|
| 180 | - */ |
|
| 181 | - public function isValidType($type) { |
|
| 182 | - $normalizedType = $this->normalizeType($type); |
|
| 183 | - return isset($this->defaultConnectionParams[$normalizedType]); |
|
| 184 | - } |
|
| 175 | + /** |
|
| 176 | + * Checks whether the specified DBMS type is valid. |
|
| 177 | + * |
|
| 178 | + * @param string $type |
|
| 179 | + * @return bool |
|
| 180 | + */ |
|
| 181 | + public function isValidType($type) { |
|
| 182 | + $normalizedType = $this->normalizeType($type); |
|
| 183 | + return isset($this->defaultConnectionParams[$normalizedType]); |
|
| 184 | + } |
|
| 185 | 185 | |
| 186 | - /** |
|
| 187 | - * Create the connection parameters for the config |
|
| 188 | - * |
|
| 189 | - * @return array |
|
| 190 | - */ |
|
| 191 | - public function createConnectionParams() { |
|
| 192 | - $type = $this->config->getValue('dbtype', 'sqlite'); |
|
| 186 | + /** |
|
| 187 | + * Create the connection parameters for the config |
|
| 188 | + * |
|
| 189 | + * @return array |
|
| 190 | + */ |
|
| 191 | + public function createConnectionParams() { |
|
| 192 | + $type = $this->config->getValue('dbtype', 'sqlite'); |
|
| 193 | 193 | |
| 194 | - $connectionParams = [ |
|
| 195 | - 'user' => $this->config->getValue('dbuser', ''), |
|
| 196 | - 'password' => $this->config->getValue('dbpassword', ''), |
|
| 197 | - ]; |
|
| 198 | - $name = $this->config->getValue('dbname', self::DEFAULT_DBNAME); |
|
| 194 | + $connectionParams = [ |
|
| 195 | + 'user' => $this->config->getValue('dbuser', ''), |
|
| 196 | + 'password' => $this->config->getValue('dbpassword', ''), |
|
| 197 | + ]; |
|
| 198 | + $name = $this->config->getValue('dbname', self::DEFAULT_DBNAME); |
|
| 199 | 199 | |
| 200 | - if ($this->normalizeType($type) === 'sqlite3') { |
|
| 201 | - $dataDir = $this->config->getValue("datadirectory", \OC::$SERVERROOT . '/data'); |
|
| 202 | - $connectionParams['path'] = $dataDir . '/' . $name . '.db'; |
|
| 203 | - } else { |
|
| 204 | - $host = $this->config->getValue('dbhost', ''); |
|
| 205 | - $connectionParams = array_merge($connectionParams, $this->splitHostFromPortAndSocket($host)); |
|
| 206 | - $connectionParams['dbname'] = $name; |
|
| 207 | - } |
|
| 200 | + if ($this->normalizeType($type) === 'sqlite3') { |
|
| 201 | + $dataDir = $this->config->getValue("datadirectory", \OC::$SERVERROOT . '/data'); |
|
| 202 | + $connectionParams['path'] = $dataDir . '/' . $name . '.db'; |
|
| 203 | + } else { |
|
| 204 | + $host = $this->config->getValue('dbhost', ''); |
|
| 205 | + $connectionParams = array_merge($connectionParams, $this->splitHostFromPortAndSocket($host)); |
|
| 206 | + $connectionParams['dbname'] = $name; |
|
| 207 | + } |
|
| 208 | 208 | |
| 209 | - $connectionParams['tablePrefix'] = $this->config->getValue('dbtableprefix', self::DEFAULT_DBTABLEPREFIX); |
|
| 210 | - $connectionParams['sqlite.journal_mode'] = $this->config->getValue('sqlite.journal_mode', 'WAL'); |
|
| 209 | + $connectionParams['tablePrefix'] = $this->config->getValue('dbtableprefix', self::DEFAULT_DBTABLEPREFIX); |
|
| 210 | + $connectionParams['sqlite.journal_mode'] = $this->config->getValue('sqlite.journal_mode', 'WAL'); |
|
| 211 | 211 | |
| 212 | - //additional driver options, eg. for mysql ssl |
|
| 213 | - $driverOptions = $this->config->getValue('dbdriveroptions', null); |
|
| 214 | - if ($driverOptions) { |
|
| 215 | - $connectionParams['driverOptions'] = $driverOptions; |
|
| 216 | - } |
|
| 212 | + //additional driver options, eg. for mysql ssl |
|
| 213 | + $driverOptions = $this->config->getValue('dbdriveroptions', null); |
|
| 214 | + if ($driverOptions) { |
|
| 215 | + $connectionParams['driverOptions'] = $driverOptions; |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | - // set default table creation options |
|
| 219 | - $connectionParams['defaultTableOptions'] = [ |
|
| 220 | - 'collate' => 'utf8_bin', |
|
| 221 | - 'tablePrefix' => $connectionParams['tablePrefix'] |
|
| 222 | - ]; |
|
| 218 | + // set default table creation options |
|
| 219 | + $connectionParams['defaultTableOptions'] = [ |
|
| 220 | + 'collate' => 'utf8_bin', |
|
| 221 | + 'tablePrefix' => $connectionParams['tablePrefix'] |
|
| 222 | + ]; |
|
| 223 | 223 | |
| 224 | - if ($this->config->getValue('mysql.utf8mb4', false)) { |
|
| 225 | - $connectionParams['defaultTableOptions'] = [ |
|
| 226 | - 'collate' => 'utf8mb4_bin', |
|
| 227 | - 'charset' => 'utf8mb4', |
|
| 228 | - 'row_format' => 'compressed', |
|
| 229 | - 'tablePrefix' => $connectionParams['tablePrefix'] |
|
| 230 | - ]; |
|
| 231 | - } |
|
| 224 | + if ($this->config->getValue('mysql.utf8mb4', false)) { |
|
| 225 | + $connectionParams['defaultTableOptions'] = [ |
|
| 226 | + 'collate' => 'utf8mb4_bin', |
|
| 227 | + 'charset' => 'utf8mb4', |
|
| 228 | + 'row_format' => 'compressed', |
|
| 229 | + 'tablePrefix' => $connectionParams['tablePrefix'] |
|
| 230 | + ]; |
|
| 231 | + } |
|
| 232 | 232 | |
| 233 | - return $connectionParams; |
|
| 234 | - } |
|
| 233 | + return $connectionParams; |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | - /** |
|
| 237 | - * @param string $host |
|
| 238 | - * @return array |
|
| 239 | - */ |
|
| 240 | - protected function splitHostFromPortAndSocket($host): array { |
|
| 241 | - $params = [ |
|
| 242 | - 'host' => $host, |
|
| 243 | - ]; |
|
| 236 | + /** |
|
| 237 | + * @param string $host |
|
| 238 | + * @return array |
|
| 239 | + */ |
|
| 240 | + protected function splitHostFromPortAndSocket($host): array { |
|
| 241 | + $params = [ |
|
| 242 | + 'host' => $host, |
|
| 243 | + ]; |
|
| 244 | 244 | |
| 245 | - $matches = []; |
|
| 246 | - if (preg_match('/^(.*):([^\]:]+)$/', $host, $matches)) { |
|
| 247 | - // Host variable carries a port or socket. |
|
| 248 | - $params['host'] = $matches[1]; |
|
| 249 | - if (is_numeric($matches[2])) { |
|
| 250 | - $params['port'] = (int) $matches[2]; |
|
| 251 | - } else { |
|
| 252 | - $params['unix_socket'] = $matches[2]; |
|
| 253 | - } |
|
| 254 | - } |
|
| 245 | + $matches = []; |
|
| 246 | + if (preg_match('/^(.*):([^\]:]+)$/', $host, $matches)) { |
|
| 247 | + // Host variable carries a port or socket. |
|
| 248 | + $params['host'] = $matches[1]; |
|
| 249 | + if (is_numeric($matches[2])) { |
|
| 250 | + $params['port'] = (int) $matches[2]; |
|
| 251 | + } else { |
|
| 252 | + $params['unix_socket'] = $matches[2]; |
|
| 253 | + } |
|
| 254 | + } |
|
| 255 | 255 | |
| 256 | - return $params; |
|
| 257 | - } |
|
| 256 | + return $params; |
|
| 257 | + } |
|
| 258 | 258 | } |
@@ -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> |
@@ -31,18 +31,18 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | interface ITimeFactory { |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @return int the result of a call to time() |
|
| 36 | - * @since 8.0.0 |
|
| 37 | - */ |
|
| 38 | - public function getTime(): int; |
|
| 34 | + /** |
|
| 35 | + * @return int the result of a call to time() |
|
| 36 | + * @since 8.0.0 |
|
| 37 | + */ |
|
| 38 | + public function getTime(): int; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @param string $time |
|
| 42 | - * @param \DateTimeZone $timezone |
|
| 43 | - * @return \DateTime |
|
| 44 | - * @since 15.0.0 |
|
| 45 | - */ |
|
| 46 | - public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime; |
|
| 40 | + /** |
|
| 41 | + * @param string $time |
|
| 42 | + * @param \DateTimeZone $timezone |
|
| 43 | + * @return \DateTime |
|
| 44 | + * @since 15.0.0 |
|
| 45 | + */ |
|
| 46 | + public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime; |
|
| 47 | 47 | |
| 48 | 48 | } |
@@ -34,21 +34,21 @@ |
||
| 34 | 34 | class TimeFactory implements ITimeFactory { |
| 35 | 35 | |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @return int the result of a call to time() |
|
| 39 | - */ |
|
| 40 | - public function getTime(): int { |
|
| 41 | - return time(); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @param string $time |
|
| 46 | - * @param \DateTimeZone $timezone |
|
| 47 | - * @return \DateTime |
|
| 48 | - * @since 15.0.0 |
|
| 49 | - */ |
|
| 50 | - public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime { |
|
| 51 | - return new \DateTime($time, $timezone); |
|
| 52 | - } |
|
| 37 | + /** |
|
| 38 | + * @return int the result of a call to time() |
|
| 39 | + */ |
|
| 40 | + public function getTime(): int { |
|
| 41 | + return time(); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @param string $time |
|
| 46 | + * @param \DateTimeZone $timezone |
|
| 47 | + * @return \DateTime |
|
| 48 | + * @since 15.0.0 |
|
| 49 | + */ |
|
| 50 | + public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime { |
|
| 51 | + return new \DateTime($time, $timezone); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | } |