Skip to content
Snippets Groups Projects
Commit 50ce328c authored by Alex Pott's avatar Alex Pott
Browse files

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

parent 8d99809c
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -1103,6 +1103,9 @@ function db_run_tasks($driver) { ...@@ -1103,6 +1103,9 @@ function db_run_tasks($driver) {
* *
* @param $driver * @param $driver
* The name of the 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) { function db_installer_object($driver) {
// We cannot use Database::getConnection->getDriverClass() here, because // We cannot use Database::getConnection->getDriverClass() here, because
......
...@@ -24,22 +24,21 @@ class Tasks extends InstallTasks { ...@@ -24,22 +24,21 @@ class Tasks extends InstallTasks {
protected $pdoDriver = 'mysql'; protected $pdoDriver = 'mysql';
/** /**
* Returns a human-readable name string for MySQL and equivalent databases. * {@inheritdoc}
*/ */
public function name() { public function name() {
return t('MySQL, MariaDB, Percona Server, or equivalent'); return t('MySQL, MariaDB, Percona Server, or equivalent');
} }
/** /**
* Returns the minimum version for MySQL. * {@inheritdoc}
*/ */
public function minimumVersion() { public function minimumVersion() {
return '5.0.15'; return '5.0.15';
} }
/** /**
* Check database connection and attempt to create database if the database is * {@inheritdoc}
* missing.
*/ */
protected function connect() { protected function connect() {
try { try {
......
...@@ -13,11 +13,18 @@ ...@@ -13,11 +13,18 @@
use Drupal\Core\Database\DatabaseNotFoundException; use Drupal\Core\Database\DatabaseNotFoundException;
/** /**
* PostgreSQL specific install functions * Specifies installation tasks for PostgreSQL databases.
*/ */
class Tasks extends InstallTasks { class Tasks extends InstallTasks {
/**
* {@inheritdoc}
*/
protected $pdoDriver = 'pgsql'; protected $pdoDriver = 'pgsql';
/**
* Constructs a \Drupal\Core\Database\Driver\pgsql\Install\Tasks object.
*/
public function __construct() { public function __construct() {
$this->tasks[] = array( $this->tasks[] = array(
'function' => 'checkEncoding', 'function' => 'checkEncoding',
...@@ -33,17 +40,22 @@ public function __construct() { ...@@ -33,17 +40,22 @@ public function __construct() {
); );
} }
/**
* {@inheritdoc}
*/
public function name() { public function name() {
return t('PostgreSQL'); return t('PostgreSQL');
} }
/**
* {@inheritdoc}
*/
public function minimumVersion() { public function minimumVersion() {
return '8.3'; return '8.3';
} }
/** /**
* Check database connection and attempt to create database if the database is * {@inheritdoc}
* missing.
*/ */
protected function connect() { protected function connect() {
try { try {
......
...@@ -12,22 +12,34 @@ ...@@ -12,22 +12,34 @@
use Drupal\Core\Database\DatabaseNotFoundException; use Drupal\Core\Database\DatabaseNotFoundException;
use Drupal\Core\Database\Install\Tasks as InstallTasks; use Drupal\Core\Database\Install\Tasks as InstallTasks;
/**
* Specifies installation tasks for SQLite databases.
*/
class Tasks extends InstallTasks { class Tasks extends InstallTasks {
/**
* {@inheritdoc}
*/
protected $pdoDriver = 'sqlite'; protected $pdoDriver = 'sqlite';
/**
* {@inheritdoc}
*/
public function name() { public function name() {
return t('SQLite'); return t('SQLite');
} }
/** /**
* Minimum engine version. * {@inheritdoc}
*
* @todo Consider upping to 3.6.8 in Drupal 8 to get SAVEPOINT support.
*/ */
public function minimumVersion() { public function minimumVersion() {
// @todo Consider upping to 3.6.8 in Drupal 8 to get SAVEPOINT support.
return '3.3.7'; return '3.3.7';
} }
/**
* {@inheritdoc}
*/
public function getFormOptions($database) { public function getFormOptions($database) {
$form = parent::getFormOptions($database); $form = parent::getFormOptions($database);
...@@ -43,8 +55,7 @@ public function getFormOptions($database) { ...@@ -43,8 +55,7 @@ public function getFormOptions($database) {
} }
/** /**
* Check database connection and attempt to create database if the database is * {@inheritdoc}
* missing.
*/ */
protected function connect() { protected function connect() {
try { try {
......
...@@ -16,6 +16,13 @@ ...@@ -16,6 +16,13 @@
*/ */
abstract class Tasks { abstract class Tasks {
/**
* The name of the PDO driver this database type requires.
*
* @var string
*/
protected $pdoDriver;
/** /**
* Structure that describes each task to run. * Structure that describes each task to run.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment