SetupDatabaseService

Service class helping to manage database related settings and operations required to set up TYPO3

Internal

This class is only meant to be used within EXT:install and is not part of the TYPO3 Core API.

Tags
phpstan-import-type

Params from DriverManager

Table of Contents

Properties

$validDrivers  : array<string|int, mixed>

Methods

__construct()  : mixed
checkDatabaseRequirementsForDriver()  : FlashMessageQueue
checkDatabaseSelect()  : bool
checkExistingDatabase()  : FlashMessage
Checks whether an existing database on the default connection can be used for a TYPO3 installation. The database name is only persisted to the local configuration if the database is empty.
checkRequiredDatabasePermissions()  : array<string|int, mixed>
createDatabase()  : void
createNewDatabase()  : FlashMessage
Creates a new database on the default connection
getBackendUserPasswordValidationErrors()  : array<string|int, mixed>
getDatabaseConfigurationFromEnvironment()  : array<string|int, mixed>
Try to fetch db credentials from a .env file and see if connect works
getDatabaseConfiguredMysqliSocket()  : string
Returns configured socket, if set.
getDatabaseConfiguredPdoMysqlSocket()  : string
Returns configured socket, if set.
getDatabaseList()  : array<string|int, mixed>
Returns list of available databases (with access-check based on username/password)
getDriverOptions()  : array<string|int, mixed>
importDatabaseData()  : array<string|int, FlashMessage>
Create tables and import static rows
isDatabaseConfigurationComplete()  : bool
Check system/settings.php for required database settings: - 'username' and 'password' are mandatory, but may be empty - if 'driver' is pdo_sqlite and 'path' is set, its ok, too
isDatabaseConnectSuccessful()  : bool
Test connection with given credentials and return exception message if exception thrown
isValidDbHost()  : bool
isValidDbName()  : bool
isValidDbPort()  : bool
markWizardsDone()  : void
setDefaultConnectionSettings()  : array<string|int, mixed>

Properties

$validDrivers

protected array<string|int, mixed> $validDrivers = ['mysqli', 'pdo_mysql', 'pdo_pgsql', 'pdo_sqlite']

Methods

checkDatabaseSelect()

public checkDatabaseSelect() : bool
Return values
bool

checkExistingDatabase()

Checks whether an existing database on the default connection can be used for a TYPO3 installation. The database name is only persisted to the local configuration if the database is empty.

public checkExistingDatabase(string $dbName) : FlashMessage
Parameters
$dbName : string

name of the database

Return values
FlashMessage

checkRequiredDatabasePermissions()

public checkRequiredDatabasePermissions() : array<string|int, mixed>
Return values
array<string|int, mixed>

createDatabase()

public createDatabase(string $name) : void
Parameters
$name : string
Tags
throws
Exception

createNewDatabase()

Creates a new database on the default connection

public createNewDatabase(string $dbName) : FlashMessage
Parameters
$dbName : string

name of database

Return values
FlashMessage

getBackendUserPasswordValidationErrors()

public getBackendUserPasswordValidationErrors(string $password) : array<string|int, mixed>
Parameters
$password : string
Return values
array<string|int, mixed>

getDatabaseConfigurationFromEnvironment()

Try to fetch db credentials from a .env file and see if connect works

public getDatabaseConfigurationFromEnvironment() : array<string|int, mixed>
Return values
array<string|int, mixed>

Empty array if no file is found or connect is not successful, else working credentials

getDatabaseConfiguredMysqliSocket()

Returns configured socket, if set.

public getDatabaseConfiguredMysqliSocket() : string
Return values
string

getDatabaseConfiguredPdoMysqlSocket()

Returns configured socket, if set.

public getDatabaseConfiguredPdoMysqlSocket() : string
Return values
string

getDatabaseList()

Returns list of available databases (with access-check based on username/password)

public getDatabaseList() : array<string|int, mixed>
Tags
throws
Exception
Return values
array<string|int, mixed>

List of available databases

getDriverOptions()

public getDriverOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

importDatabaseData()

Create tables and import static rows

public importDatabaseData() : array<string|int, FlashMessage>
Return values
array<string|int, FlashMessage>

isDatabaseConfigurationComplete()

Check system/settings.php for required database settings: - 'username' and 'password' are mandatory, but may be empty - if 'driver' is pdo_sqlite and 'path' is set, its ok, too

public isDatabaseConfigurationComplete() : bool
Return values
bool

TRUE if required settings are present

isDatabaseConnectSuccessful()

Test connection with given credentials and return exception message if exception thrown

public isDatabaseConnectSuccessful() : bool
Return values
bool

isValidDbHost()

public isValidDbHost(string $name) : bool
Parameters
$name : string
Return values
bool

isValidDbName()

public isValidDbName(string $name) : bool
Parameters
$name : string
Return values
bool

isValidDbPort()

public isValidDbPort(int $number) : bool
Parameters
$number : int
Return values
bool

markWizardsDone()

public markWizardsDone(ContainerInterface $container) : void
Parameters
$container : ContainerInterface

setDefaultConnectionSettings()

public setDefaultConnectionSettings(array<string|int, mixed> $values) : array<string|int, mixed>
Parameters
$values : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results