SetupDatabaseService
Service class helping to manage database related settings and operations required to set up TYPO3
This class is only meant to be used within EXT:install and is not part of the TYPO3 Core API.
Tags
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
__construct()
public
__construct(LateBootService $lateBootService, ConfigurationManager $configurationManager, PermissionsCheck $databasePermissionsCheck, Registry $registry, SchemaMigrator $schemaMigrator) : mixed
Parameters
- $lateBootService : LateBootService
- $configurationManager : ConfigurationManager
- $databasePermissionsCheck : PermissionsCheck
- $registry : Registry
- $schemaMigrator : SchemaMigrator
checkDatabaseRequirementsForDriver()
public
checkDatabaseRequirementsForDriver(string $databaseDriverName) : FlashMessageQueue
Parameters
- $databaseDriverName : string
Return values
FlashMessageQueuecheckDatabaseSelect()
public
checkDatabaseSelect() : bool
Return values
boolcheckExistingDatabase()
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
FlashMessagecheckRequiredDatabasePermissions()
public
checkRequiredDatabasePermissions() : array<string|int, mixed>
Return values
array<string|int, mixed>createDatabase()
public
createDatabase(string $name) : void
Parameters
- $name : string
Tags
createNewDatabase()
Creates a new database on the default connection
public
createNewDatabase(string $dbName) : FlashMessage
Parameters
- $dbName : string
-
name of database
Return values
FlashMessagegetBackendUserPasswordValidationErrors()
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
stringgetDatabaseConfiguredPdoMysqlSocket()
Returns configured socket, if set.
public
getDatabaseConfiguredPdoMysqlSocket() : string
Return values
stringgetDatabaseList()
Returns list of available databases (with access-check based on username/password)
public
getDatabaseList() : array<string|int, mixed>
Tags
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
boolisValidDbHost()
public
isValidDbHost(string $name) : bool
Parameters
- $name : string
Return values
boolisValidDbName()
public
isValidDbName(string $name) : bool
Parameters
- $name : string
Return values
boolisValidDbPort()
public
isValidDbPort(int $number) : bool
Parameters
- $number : int
Return values
boolmarkWizardsDone()
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>