Commit 50ce328c authored by alexpott's avatar alexpott

Issue #2084659 by Xano, ju1iet: Database driver task code documentation.

parent 8d99809c
......@@ -1103,6 +1103,9 @@ function db_run_tasks($driver) {
*
* @param $driver
* The name of the driver.
*
* @return \Drupal\Core\Database\Install\Tasks
* A class defining the requirements and tasks for installing the database.
*/
function db_installer_object($driver) {
// We cannot use Database::getConnection->getDriverClass() here, because
......
......@@ -24,22 +24,21 @@ class Tasks extends InstallTasks {
protected $pdoDriver = 'mysql';
/**
* Returns a human-readable name string for MySQL and equivalent databases.
* {@inheritdoc}
*/
public function name() {
return t('MySQL, MariaDB, Percona Server, or equivalent');
}
/**
* Returns the minimum version for MySQL.
* {@inheritdoc}
*/
public function minimumVersion() {
return '5.0.15';
}
/**
* Check database connection and attempt to create database if the database is
* missing.
* {@inheritdoc}
*/
protected function connect() {
try {
......
......@@ -13,11 +13,18 @@
use Drupal\Core\Database\DatabaseNotFoundException;
/**
* PostgreSQL specific install functions
* Specifies installation tasks for PostgreSQL databases.
*/
class Tasks extends InstallTasks {
/**
* {@inheritdoc}
*/
protected $pdoDriver = 'pgsql';
/**
* Constructs a \Drupal\Core\Database\Driver\pgsql\Install\Tasks object.
*/
public function __construct() {
$this->tasks[] = array(
'function' => 'checkEncoding',
......@@ -33,17 +40,22 @@ public function __construct() {
);
}
/**
* {@inheritdoc}
*/
public function name() {
return t('PostgreSQL');
}
/**
* {@inheritdoc}
*/
public function minimumVersion() {
return '8.3';
}
/**
* Check database connection and attempt to create database if the database is
* missing.
* {@inheritdoc}
*/
protected function connect() {
try {
......
......@@ -12,22 +12,34 @@
use Drupal\Core\Database\DatabaseNotFoundException;
use Drupal\Core\Database\Install\Tasks as InstallTasks;
/**
* Specifies installation tasks for SQLite databases.
*/
class Tasks extends InstallTasks {
/**
* {@inheritdoc}
*/
protected $pdoDriver = 'sqlite';
/**
* {@inheritdoc}
*/
public function name() {
return t('SQLite');
}
/**
* Minimum engine version.
*
* @todo Consider upping to 3.6.8 in Drupal 8 to get SAVEPOINT support.
* {@inheritdoc}
*/
public function minimumVersion() {
// @todo Consider upping to 3.6.8 in Drupal 8 to get SAVEPOINT support.
return '3.3.7';
}
/**
* {@inheritdoc}
*/
public function getFormOptions($database) {
$form = parent::getFormOptions($database);
......@@ -43,8 +55,7 @@ public function getFormOptions($database) {
}
/**
* Check database connection and attempt to create database if the database is
* missing.
* {@inheritdoc}
*/
protected function connect() {
try {
......
......@@ -16,6 +16,13 @@
*/
abstract class Tasks {
/**
* The name of the PDO driver this database type requires.
*
* @var string
*/
protected $pdoDriver;
/**
* Structure that describes each task to run.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment