class SQLiteDatabaseConfigurationHelper implements DatabaseConfigurationHelper (View source)

This is a helper class for the SS installer.

It does all the specific checking for SQLiteDatabase to ensure that the configuration is setup correctly.

Methods

bool
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.

static bool
create_db_dir(string $path)

Creates the provided directory and prepares it for storing SQLlite. Use {@link secure_db_dir()} to secure it against unauthorized access.

static bool
secure_db_dir(string $path)

Secure the provided directory via web-access by placing a .htaccess file in it.

array
requireDatabaseAlterPermissions(array $databaseConfig)

Ensure we have permissions to alter tables.

Details

bool 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

bool

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')

array requireDatabaseConnection(array $databaseConfig)

Ensure a database connection is possible using credentials provided.

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')

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

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')

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')

static bool create_db_dir(string $path)

Creates the provided directory and prepares it for storing SQLlite. Use {@link secure_db_dir()} to secure it against unauthorized access.

Parameters

string $path

Absolute path, usually with a hidden folder.

Return Value

bool

static bool secure_db_dir(string $path)

Secure the provided directory via web-access by placing a .htaccess file in it.

This is just required if the database directory is placed within a publically accessible webroot (the default path is in a hidden folder within assets/).

Parameters

string $path

Absolute path, containing a SQLite datatbase

Return Value

bool

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