interface DatabaseConfigurationHelper

Interface for database helper classes.

Methods

boolean
requireDatabaseFunctions(array $databaseConfig)

Ensure that the database function for connectivity is available.

array
requireDatabaseServer(array $databaseConfig)

Ensure that the database server exists.

array
requireDatabaseConnection(array $databaseConfig)

Ensure a database connection is possible using credentials provided.

string
getDatabaseVersion(array $databaseConfig)

Determines the version of the database server

array
requireDatabaseVersion(array $databaseConfig)

Check database version is greater than the minimum supported

array
requireDatabaseOrCreatePermissions(array $databaseConfig)

Ensure that the database connection is able to use an existing database, or be able to create one if it doesn't exist.

array
requireDatabaseAlterPermissions(array $databaseConfig)

Ensure we have permissions to alter tables.

Details

at line 18
boolean requireDatabaseFunctions(array $databaseConfig)

Ensure that the database function for connectivity is available.

If it is, we assume the PHP module for this database has been setup correctly.

Parameters

array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc

Return Value

boolean

at line 26
array requireDatabaseServer(array $databaseConfig)

Ensure that the database server exists.

Parameters

array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc

Return Value

array Result - e.g. array('okay' => true, 'error' => 'details of error')

at line 35
array requireDatabaseConnection(array $databaseConfig)

Ensure a database connection is possible using credentials provided.

The established connection resource is returned with the results as well.

Parameters

array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc

Return Value

array Result - e.g. array('okay' => true, 'connection' => mysql link, 'error' => 'details of error')

at line 43
string getDatabaseVersion(array $databaseConfig)

Determines the version of the database server

Parameters

array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc

Return Value

string Version of database server or false on failure

at line 51
array requireDatabaseVersion(array $databaseConfig)

Check database version is greater than the minimum supported

Parameters

array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc

Return Value

array Result - e.g. array('success' => true, 'error' => 'details of error')

at line 60
array requireDatabaseOrCreatePermissions(array $databaseConfig)

Ensure that the database connection is able to use an existing database, or be able to create one if it doesn't exist.

Parameters

array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc

Return Value

array Result - e.g. array('okay' => true, 'existsAlready' => 'true')

at line 70
array requireDatabaseAlterPermissions(array $databaseConfig)

Ensure we have permissions to alter tables.

Parameters

array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc

Return Value

array Result - e.g. array('okay' => true, 'applies' => true), where applies is whether the test is relevant for the database