mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-23 10:28:55 +00:00
[ticket/17530] Better classes naming
PHPBB-17530
This commit is contained in:
parent
980b6e6f9e
commit
86195ac0f9
16 changed files with 41 additions and 39 deletions
|
@ -15,8 +15,8 @@ namespace phpbb\db\doctrine;
|
||||||
|
|
||||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||||
use Doctrine\DBAL\Types\Type;
|
use Doctrine\DBAL\Types\Type;
|
||||||
use phpbb\db\middleware\postgresql\phpbb_postgresql_platform;
|
use phpbb\db\middleware\oracle\platform as oracle_platform;
|
||||||
use phpbb\db\middleware\oracle\phpbb_oracle_platform;
|
use phpbb\db\middleware\postgresql\platform as postgresql_platform;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Case-insensitive string type (only supported by Postgres).
|
* Case-insensitive string type (only supported by Postgres).
|
||||||
|
@ -30,7 +30,7 @@ class case_insensitive_string extends Type
|
||||||
*/
|
*/
|
||||||
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
|
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
|
||||||
{
|
{
|
||||||
if ($platform instanceof phpbb_postgresql_platform)
|
if ($platform instanceof postgresql_platform)
|
||||||
{
|
{
|
||||||
return 'varchar_ci';
|
return 'varchar_ci';
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class case_insensitive_string extends Type
|
||||||
// we used 3 times larger capacity for strings on oracle for unicode strings
|
// we used 3 times larger capacity for strings on oracle for unicode strings
|
||||||
// as on other platforms. This is not the case with varchar_ci, which uses
|
// as on other platforms. This is not the case with varchar_ci, which uses
|
||||||
// the same length as other platforms.
|
// the same length as other platforms.
|
||||||
if ($platform instanceof phpbb_oracle_platform)
|
if ($platform instanceof oracle_platform)
|
||||||
{
|
{
|
||||||
return $platform->getAsciiStringTypeDeclarationSQL($column);
|
return $platform->getAsciiStringTypeDeclarationSQL($column);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,10 @@ use Doctrine\DBAL\Exception;
|
||||||
use Doctrine\DBAL\Types\Type;
|
use Doctrine\DBAL\Types\Type;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use phpbb\config_php_file;
|
use phpbb\config_php_file;
|
||||||
use phpbb\db\middleware\mysql\phpbb_mysql_middleware;
|
use phpbb\db\middleware\mysql\middleware as mysql_middleware;
|
||||||
use phpbb\db\middleware\oracle\phpbb_oracle_middleware;
|
use phpbb\db\middleware\oracle\middleware as oracle_middleware;
|
||||||
use phpbb\db\middleware\postgresql\phpbb_postgresql_middleware;
|
use phpbb\db\middleware\postgresql\middleware as postgresql_middleware;
|
||||||
use phpbb\db\middleware\sqlsrv\phpbb_sqlsrv_middleware;
|
use phpbb\db\middleware\sqlsrv\middleware as sqlsrv_middleware;
|
||||||
use phpbb\exception\runtime_exception;
|
use phpbb\exception\runtime_exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,10 +101,10 @@ class connection_factory
|
||||||
|
|
||||||
$middleware = match($driver)
|
$middleware = match($driver)
|
||||||
{
|
{
|
||||||
'pdo_mysql', 'mysqli' => [new phpbb_mysql_middleware()],
|
'pdo_mysql', 'mysqli' => [new mysql_middleware()],
|
||||||
'pdo_oci', 'oci8' => [new phpbb_oracle_middleware()],
|
'pdo_oci', 'oci8' => [new oracle_middleware()],
|
||||||
'pdo_pgsql', 'pgsql' => [new phpbb_postgresql_middleware()],
|
'pdo_pgsql', 'pgsql' => [new postgresql_middleware()],
|
||||||
'pdo_sqlsrv', 'sqlsrv' => [new phpbb_sqlsrv_middleware()],
|
'pdo_sqlsrv', 'sqlsrv' => [new sqlsrv_middleware()],
|
||||||
default => [],
|
default => [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
|
|
||||||
namespace phpbb\db\doctrine;
|
namespace phpbb\db\doctrine;
|
||||||
|
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class to generate Doctrine DBAL configuration.
|
* Helper class to generate Doctrine DBAL configuration.
|
||||||
*/
|
*/
|
||||||
|
@ -32,7 +30,7 @@ class connection_parameter_factory
|
||||||
*
|
*
|
||||||
* @return array Doctrine DBAL connection parameters.
|
* @return array Doctrine DBAL connection parameters.
|
||||||
*
|
*
|
||||||
* @throws InvalidArgumentException If a required parameter is empty or null.
|
* @throws \InvalidArgumentException If a required parameter is empty or null.
|
||||||
*/
|
*/
|
||||||
public static function get_configuration(
|
public static function get_configuration(
|
||||||
string $driver,
|
string $driver,
|
||||||
|
@ -68,7 +66,7 @@ class connection_parameter_factory
|
||||||
*
|
*
|
||||||
* @return array Doctrine's DBAL configuration for SQLite.
|
* @return array Doctrine's DBAL configuration for SQLite.
|
||||||
*
|
*
|
||||||
* @throws InvalidArgumentException If a required parameter is empty or null.
|
* @throws \InvalidArgumentException If a required parameter is empty or null.
|
||||||
*/
|
*/
|
||||||
private static function build_connection_parameters(
|
private static function build_connection_parameters(
|
||||||
array $params,
|
array $params,
|
||||||
|
@ -87,7 +85,7 @@ class connection_parameter_factory
|
||||||
|
|
||||||
if (empty($user) || empty($name))
|
if (empty($user) || empty($name))
|
||||||
{
|
{
|
||||||
throw new InvalidArgumentException('Required database parameter is not set.');
|
throw new \InvalidArgumentException('Required database parameter is not set.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = array_merge($params, [
|
$params = array_merge($params, [
|
||||||
|
|
|
@ -19,13 +19,13 @@ use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware;
|
||||||
* MySQL Doctrine driver middleware.
|
* MySQL Doctrine driver middleware.
|
||||||
* Makes use of phpBB's MySQL specific platform.
|
* Makes use of phpBB's MySQL specific platform.
|
||||||
*/
|
*/
|
||||||
class phpbb_mysql_driver extends AbstractDriverMiddleware
|
class driver extends AbstractDriverMiddleware
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public function createDatabasePlatformForVersion($version)
|
public function createDatabasePlatformForVersion($version)
|
||||||
{
|
{
|
||||||
return new phpbb_mysql_platform();
|
return new platform();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,15 +14,16 @@
|
||||||
namespace phpbb\db\middleware\mysql;
|
namespace phpbb\db\middleware\mysql;
|
||||||
|
|
||||||
use Doctrine\DBAL\Driver;
|
use Doctrine\DBAL\Driver;
|
||||||
|
use phpbb\db\middleware\mysql\driver as mysql_driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MySQL Doctrine middleware.
|
* MySQL Doctrine middleware.
|
||||||
* Makes use of phpBB's MySQL specific platform.
|
* Makes use of phpBB's MySQL specific platform.
|
||||||
*/
|
*/
|
||||||
class phpbb_mysql_middleware implements Driver\Middleware
|
class middleware implements Driver\Middleware
|
||||||
{
|
{
|
||||||
public function wrap(Driver $driver): Driver
|
public function wrap(Driver $driver): Driver
|
||||||
{
|
{
|
||||||
return new phpbb_mysql_driver($driver);
|
return new mysql_driver($driver);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -23,7 +23,7 @@ use Doctrine\DBAL\Schema\TableDiff;
|
||||||
* If it's indexed as primary key, it should be declared as NOT NULL
|
* If it's indexed as primary key, it should be declared as NOT NULL
|
||||||
* because MySQL primary key columns cannot be NULL.
|
* because MySQL primary key columns cannot be NULL.
|
||||||
*/
|
*/
|
||||||
class phpbb_mysql_platform extends AbstractMySQLPlatform
|
class platform extends AbstractMySQLPlatform
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
|
@ -21,14 +21,14 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||||
* Oracle Doctrine driver middleware.
|
* Oracle Doctrine driver middleware.
|
||||||
* Makes use of phpBB's Oracle specific platform.
|
* Makes use of phpBB's Oracle specific platform.
|
||||||
*/
|
*/
|
||||||
class phpbb_oracle_driver extends AbstractDriverMiddleware
|
class driver extends AbstractDriverMiddleware
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public function getSchemaManager(DoctrineConnection $conn, AbstractPlatform $platform)
|
public function getSchemaManager(DoctrineConnection $conn, AbstractPlatform $platform)
|
||||||
{
|
{
|
||||||
return new phpbb_oracle_schema_manager($conn, $platform);
|
return new schema_manager($conn, $platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,6 +36,6 @@ class phpbb_oracle_driver extends AbstractDriverMiddleware
|
||||||
*/
|
*/
|
||||||
public function createDatabasePlatformForVersion($version)
|
public function createDatabasePlatformForVersion($version)
|
||||||
{
|
{
|
||||||
return new phpbb_oracle_platform();
|
return new platform();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,15 +14,16 @@
|
||||||
namespace phpbb\db\middleware\oracle;
|
namespace phpbb\db\middleware\oracle;
|
||||||
|
|
||||||
use Doctrine\DBAL\Driver;
|
use Doctrine\DBAL\Driver;
|
||||||
|
use phpbb\db\middleware\oracle\driver as oracle_driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Oracle Doctrine middleware.
|
* Oracle Doctrine middleware.
|
||||||
* Makes use of phpBB's Oracle specific platform.
|
* Makes use of phpBB's Oracle specific platform.
|
||||||
*/
|
*/
|
||||||
class phpbb_oracle_middleware implements Driver\Middleware
|
class middleware implements Driver\Middleware
|
||||||
{
|
{
|
||||||
public function wrap(Driver $driver): Driver
|
public function wrap(Driver $driver): Driver
|
||||||
{
|
{
|
||||||
return new phpbb_oracle_driver($driver);
|
return new oracle_driver($driver);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,7 +21,7 @@ use Doctrine\DBAL\Schema\Table;
|
||||||
/**
|
/**
|
||||||
* Oracle specific schema restrictions for BC.
|
* Oracle specific schema restrictions for BC.
|
||||||
*/
|
*/
|
||||||
class phpbb_oracle_platform extends OraclePlatform
|
class platform extends OraclePlatform
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
|
@ -18,7 +18,7 @@ use Doctrine\DBAL\Schema\AbstractSchemaManager;
|
||||||
use Doctrine\DBAL\Schema\OracleSchemaManager;
|
use Doctrine\DBAL\Schema\OracleSchemaManager;
|
||||||
use Doctrine\DBAL\Schema\Table;
|
use Doctrine\DBAL\Schema\Table;
|
||||||
|
|
||||||
class phpbb_oracle_schema_manager extends OracleSchemaManager
|
class schema_manager extends OracleSchemaManager
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
|
@ -19,13 +19,13 @@ use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware;
|
||||||
* PostgreSQL Doctrine driver middleware.
|
* PostgreSQL Doctrine driver middleware.
|
||||||
* Makes use of phpBB's PostgreSQL specific platform.
|
* Makes use of phpBB's PostgreSQL specific platform.
|
||||||
*/
|
*/
|
||||||
class phpbb_postgresql_driver extends AbstractDriverMiddleware
|
class driver extends AbstractDriverMiddleware
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public function createDatabasePlatformForVersion($version)
|
public function createDatabasePlatformForVersion($version)
|
||||||
{
|
{
|
||||||
return new phpbb_postgresql_platform();
|
return new platform();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,15 +14,16 @@
|
||||||
namespace phpbb\db\middleware\postgresql;
|
namespace phpbb\db\middleware\postgresql;
|
||||||
|
|
||||||
use Doctrine\DBAL\Driver;
|
use Doctrine\DBAL\Driver;
|
||||||
|
use phpbb\db\middleware\postgresql\driver as postgresql_driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PostgreSQL Doctrine middleware.
|
* PostgreSQL Doctrine middleware.
|
||||||
* Makes use of phpBB's PostgreSQL specific platform.
|
* Makes use of phpBB's PostgreSQL specific platform.
|
||||||
*/
|
*/
|
||||||
class phpbb_postgresql_middleware implements Driver\Middleware
|
class middleware implements Driver\Middleware
|
||||||
{
|
{
|
||||||
public function wrap(Driver $driver): Driver
|
public function wrap(Driver $driver): Driver
|
||||||
{
|
{
|
||||||
return new phpbb_postgresql_driver($driver);
|
return new postgresql_driver($driver);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -31,7 +31,7 @@ use Doctrine\DBAL\Types\Type;
|
||||||
* to stay compatible with the existing DB we have to change its
|
* to stay compatible with the existing DB we have to change its
|
||||||
* naming and not ours.
|
* naming and not ours.
|
||||||
*/
|
*/
|
||||||
class phpbb_postgresql_platform extends PostgreSQLPlatform
|
class platform extends PostgreSQLPlatform
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
|
@ -19,13 +19,13 @@ use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware;
|
||||||
* Microsoft SQL server Doctrine driver middleware.
|
* Microsoft SQL server Doctrine driver middleware.
|
||||||
* Makes use of phpBB's SQL Server specific platform.
|
* Makes use of phpBB's SQL Server specific platform.
|
||||||
*/
|
*/
|
||||||
class phpbb_sqlsrv_driver extends AbstractDriverMiddleware
|
class driver extends AbstractDriverMiddleware
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public function createDatabasePlatformForVersion($version)
|
public function createDatabasePlatformForVersion($version)
|
||||||
{
|
{
|
||||||
return new phpbb_sqlsrv_platform();
|
return new platform();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,15 +14,16 @@
|
||||||
namespace phpbb\db\middleware\sqlsrv;
|
namespace phpbb\db\middleware\sqlsrv;
|
||||||
|
|
||||||
use Doctrine\DBAL\Driver;
|
use Doctrine\DBAL\Driver;
|
||||||
|
use phpbb\db\middleware\sqlsrv\driver as sqlsrv_driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Microsoft SQL server Doctrine middleware.
|
* Microsoft SQL server Doctrine middleware.
|
||||||
* Makes use of phpBB's SQL Server specific platform.
|
* Makes use of phpBB's SQL Server specific platform.
|
||||||
*/
|
*/
|
||||||
class phpbb_sqlsrv_middleware implements Driver\Middleware
|
class middleware implements Driver\Middleware
|
||||||
{
|
{
|
||||||
public function wrap(Driver $driver): Driver
|
public function wrap(Driver $driver): Driver
|
||||||
{
|
{
|
||||||
return new phpbb_sqlsrv_driver($driver);
|
return new sqlsrv_driver($driver);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,7 +20,7 @@ use Doctrine\DBAL\Schema\TableDiff;
|
||||||
/**
|
/**
|
||||||
* SQLServer specific schema restrictions for BC.
|
* SQLServer specific schema restrictions for BC.
|
||||||
*/
|
*/
|
||||||
class phpbb_sqlsrv_platform extends SQLServerPlatform
|
class platform extends SQLServerPlatform
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
Loading…
Add table
Reference in a new issue