File tree Expand file tree Collapse file tree 3 files changed +18
-8
lines changed
Expand file tree Collapse file tree 3 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 1616use Doctrine \DBAL \Driver \ServerInfoAwareConnection ;
1717use Doctrine \DBAL \Exception ;
1818use Doctrine \DBAL \Exception \ConnectionLost ;
19+ use Doctrine \DBAL \Platforms \MariaDBPlatform ;
1920use Doctrine \DBAL \Platforms \MySQLPlatform ;
2021use Doctrine \DBAL \Platforms \OraclePlatform ;
2122use Doctrine \DBAL \Platforms \PostgreSQLPlatform ;
@@ -915,11 +916,13 @@ private function getConnectionName(): string {
915916 }
916917
917918 /**
918- * @return IDBConnection::PLATFORM_MYSQL|IDBConnection::PLATFORM_ORACLE|IDBConnection::PLATFORM_POSTGRES|IDBConnection::PLATFORM_SQLITE
919+ * @return IDBConnection::PLATFORM_MYSQL|IDBConnection::PLATFORM_ORACLE|IDBConnection::PLATFORM_POSTGRES|IDBConnection::PLATFORM_SQLITE|IDBConnection::PLATFORM_MARIADB
919920 */
920- public function getDatabaseProvider (): string {
921+ public function getDatabaseProvider (bool $ strict = false ): string {
921922 $ platform = $ this ->getDatabasePlatform ();
922- if ($ platform instanceof MySQLPlatform) {
923+ if ($ strict && $ platform instanceof MariaDBPlatform) {
924+ return IDBConnection::PLATFORM_MARIADB ;
925+ } elseif ($ platform instanceof MySQLPlatform) {
923926 return IDBConnection::PLATFORM_MYSQL ;
924927 } elseif ($ platform instanceof OraclePlatform) {
925928 return IDBConnection::PLATFORM_ORACLE ;
Original file line number Diff line number Diff line change @@ -237,10 +237,10 @@ public function getInner(): Connection {
237237 }
238238
239239 /**
240- * @return self::PLATFORM_MYSQL|self::PLATFORM_ORACLE|self::PLATFORM_POSTGRES|self::PLATFORM_SQLITE
240+ * @return self::PLATFORM_MYSQL|self::PLATFORM_ORACLE|self::PLATFORM_POSTGRES|self::PLATFORM_SQLITE|self::PLATFORM_MARIADB
241241 */
242- public function getDatabaseProvider (): string {
243- return $ this ->inner ->getDatabaseProvider ();
242+ public function getDatabaseProvider (bool $ strict = false ): string {
243+ return $ this ->inner ->getDatabaseProvider ($ strict );
244244 }
245245
246246 /**
Original file line number Diff line number Diff line change @@ -44,6 +44,11 @@ interface IDBConnection {
4444 */
4545 public const PLATFORM_SQLITE = 'sqlite ' ;
4646
47+ /**
48+ * @since 32.0.0
49+ */
50+ public const PLATFORM_MARIADB = 'mariadb ' ;
51+
4752 /**
4853 * Gets the QueryBuilder for the connection.
4954 *
@@ -357,11 +362,13 @@ public function migrateToSchema(Schema $toSchema): void;
357362
358363 /**
359364 * Returns the database provider name
365+ *
366+ * @param bool $strict differentiate between database flavors, e.g. MySQL vs MariaDB
360367 * @link https://github.com/nextcloud/server/issues/30877
361368 * @since 28.0.0
362- * @return self::PLATFORM_MYSQL|self::PLATFORM_ORACLE|self::PLATFORM_POSTGRES|self::PLATFORM_SQLITE
369+ * @return self::PLATFORM_MYSQL|self::PLATFORM_ORACLE|self::PLATFORM_POSTGRES|self::PLATFORM_SQLITE|self::PLATFORM_MARIADB
363370 */
364- public function getDatabaseProvider (): string ;
371+ public function getDatabaseProvider (bool $ strict = false ): string ;
365372
366373 /**
367374 * Get the shard definition by name, if configured
You can’t perform that action at this time.
0 commit comments