2010-04-14 05:32:30 +02:00
|
|
|
<?php
|
2013-06-21 00:32:08 +02:00
|
|
|
|
2016-08-19 00:51:35 +02:00
|
|
|
namespace SilverStripe\Dev\Install;
|
|
|
|
|
2010-04-14 05:32:30 +02:00
|
|
|
/**
|
|
|
|
* Interface for database helper classes.
|
|
|
|
*/
|
|
|
|
interface DatabaseConfigurationHelper {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ensure that the database function for connectivity is available.
|
|
|
|
* If it is, we assume the PHP module for this database has been setup correctly.
|
2014-08-15 08:53:05 +02:00
|
|
|
*
|
2010-04-14 05:32:30 +02:00
|
|
|
* @param array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc
|
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public function requireDatabaseFunctions($databaseConfig);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ensure that the database server exists.
|
2014-08-15 08:53:05 +02:00
|
|
|
*
|
2010-04-14 05:32:30 +02:00
|
|
|
* @param array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc
|
|
|
|
* @return array Result - e.g. array('okay' => true, 'error' => 'details of error')
|
|
|
|
*/
|
|
|
|
public function requireDatabaseServer($databaseConfig);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ensure a database connection is possible using credentials provided.
|
|
|
|
* The established connection resource is returned with the results as well.
|
2014-08-15 08:53:05 +02:00
|
|
|
*
|
2010-04-14 05:32:30 +02:00
|
|
|
* @param array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc
|
|
|
|
* @return array Result - e.g. array('okay' => true, 'connection' => mysql link, 'error' => 'details of error')
|
|
|
|
*/
|
|
|
|
public function requireDatabaseConnection($databaseConfig);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2013-06-21 00:32:08 +02:00
|
|
|
/**
|
|
|
|
* Determines the version of the database server
|
2014-08-15 08:53:05 +02:00
|
|
|
*
|
2013-06-21 00:32:08 +02:00
|
|
|
* @param array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc
|
|
|
|
* @return string Version of database server or false on failure
|
|
|
|
*/
|
|
|
|
public function getDatabaseVersion($databaseConfig);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2013-06-21 00:32:08 +02:00
|
|
|
/**
|
|
|
|
* Check database version is greater than the minimum supported
|
2014-08-15 08:53:05 +02:00
|
|
|
*
|
2013-06-21 00:32:08 +02:00
|
|
|
* @param array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc
|
|
|
|
* @return array Result - e.g. array('success' => true, 'error' => 'details of error')
|
|
|
|
*/
|
|
|
|
public function requireDatabaseVersion($databaseConfig);
|
2010-04-14 05:32:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Ensure that the database connection is able to use an existing database,
|
|
|
|
* or be able to create one if it doesn't exist.
|
2014-08-15 08:53:05 +02:00
|
|
|
*
|
2010-04-14 05:32:30 +02:00
|
|
|
* @param array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc
|
|
|
|
* @return array Result - e.g. array('okay' => true, 'existsAlready' => 'true')
|
|
|
|
*/
|
|
|
|
public function requireDatabaseOrCreatePermissions($databaseConfig);
|
|
|
|
|
2013-03-21 15:04:51 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Ensure we have permissions to alter tables.
|
|
|
|
*
|
|
|
|
* @param array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc
|
|
|
|
* @return array Result - e.g. array('okay' => true, 'applies' => true), where applies is whether
|
|
|
|
* the test is relevant for the database
|
|
|
|
*/
|
|
|
|
public function requireDatabaseAlterPermissions($databaseConfig);
|
|
|
|
|
2012-03-24 04:04:52 +01:00
|
|
|
}
|