abstract class Tasks (View source)

Database installer structure.

Defines basic Drupal requirements for databases.

Properties

protected string $pdoDriver

The name of the PDO driver this database type requires.

protected array $tasks

Structure that describes each task to run.

protected array $results

Results from tasks.

Methods

bool
hasPdoDriver()

Ensure the PDO driver is supported by the version of PHP in use.

fail($message)

Asserts test as failed.

pass($message)

Asserts test as a pass.

bool
installable()

Checks whether Drupal is installable on the database.

string
name()

Returns the human-readable name of the driver.

string|null
minimumVersion()

Returns the minimum required version of the engine.

string[]
runTasks()

Runs database tasks and tests to see if Drupal can run on the database.

engineVersionRequirementsCheck()

Checks engine version requirements for the status report.

bool
connect()

Checks if we can connect to the database.

runTestQuery($query, $pass, $fail, $fatal = FALSE)

Ensures the database can execute commands with the current user.

checkEngineVersion()

Checks the engine version.

array
getFormOptions(array $database)

Returns driver specific configuration options.

validateDatabaseSettings(array $database)

Validates driver specific configuration settings.

t(string $string, array $args = [], array $options = [])

Translates a string to the current language or to a given language.

bool
isConnectionActive()

Determines if there is an active connection.

getConnection()

Returns the database connection.

Details

protected bool hasPdoDriver()

Ensure the PDO driver is supported by the version of PHP in use.

Return Value

bool

TRUE if the PDO driver is supported, otherwise FALSE.

protected fail($message)

Asserts test as failed.

Parameters

$message

protected pass($message)

Asserts test as a pass.

Parameters

$message

bool installable()

Checks whether Drupal is installable on the database.

Return Value

bool

TRUE if Drupal can be installed on the database, otherwise FALSE.

abstract string name()

Returns the human-readable name of the driver.

Return Value

string

The human-readable name of the driver.

string|null minimumVersion()

Returns the minimum required version of the engine.

Return Value

string|null

A version string. If not NULL, it will be checked against the version reported by the Database engine using version_compare().

string[] runTasks()

Runs database tasks and tests to see if Drupal can run on the database.

Return Value

string[]

A list of error messages.

final TranslatableMarkup[] engineVersionRequirementsCheck()

Checks engine version requirements for the status report.

This method is called during runtime and update requirements checks.

Return Value

TranslatableMarkup[]

A list of error messages.

protected bool connect()

Checks if we can connect to the database.

Return Value

bool

TRUE if we can connect to the database, otherwise FALSE.

protected runTestQuery($query, $pass, $fail, $fatal = FALSE)

Ensures the database can execute commands with the current user.

Parameters

$query
$pass
$fail
$fatal

protected checkEngineVersion()

Checks the engine version.

array getFormOptions(array $database)

Returns driver specific configuration options.

Parameters

array $database

An array of driver specific configuration options.

Return Value

array

The options form array.

TranslatableMarkup[] validateDatabaseSettings(array $database)

Validates driver specific configuration settings.

Checks to ensure correct basic database settings and that a proper connection to the database can be established.

Parameters

array $database

An array of driver specific configuration options.

Return Value

TranslatableMarkup[]

An array of driver configuration errors, keyed by form element name.

protected TranslatableMarkup t(string $string, array $args = [], array $options = [])

Translates a string to the current language or to a given language.

Parameters

string $string

The string literal to translate.

array $args

Placeholder arguments to use inside the translated string (if any).

array $options

Options for the translation.

Return Value

TranslatableMarkup

An object representing the translatable markup for the given string.

See also

TranslatableMarkup::__construct

protected bool isConnectionActive()

Determines if there is an active connection.

Return Value

bool

TRUE if there is at least one database connection established, FALSE otherwise.

protected Connection getConnection()

Returns the database connection.

Return Value

Connection

The database connection.