function DatabaseDriverList::getInstallableList

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Extension/DatabaseDriverList.php \Drupal\Core\Extension\DatabaseDriverList::getInstallableList()

Returns the list of installable database drivers.

Return value

\Drupal\Core\Extension\DatabaseDriver[] An array of installable database driver extension objects.

File

core/lib/Drupal/Core/Extension/DatabaseDriverList.php, line 107

Class

DatabaseDriverList
Provides a list of available database drivers.

Namespace

Drupal\Core\Extension

Code

public function getInstallableList() : array {
    $installableDrivers = [];
    foreach ($this->getList() as $name => $driver) {
        if ($driver->getInstallTasks()
            ->installable()) {
            $installableDrivers[$name] = $driver;
        }
    }
    // Usability: unconditionally put core MySQL driver on top.
    if (isset($installableDrivers[static::CORE_MYSQL_DRIVER_NAMESPACE])) {
        $mysqlDriver = $installableDrivers[static::CORE_MYSQL_DRIVER_NAMESPACE];
        unset($installableDrivers[static::CORE_MYSQL_DRIVER_NAMESPACE]);
        $installableDrivers = [
            static::CORE_MYSQL_DRIVER_NAMESPACE => $mysqlDriver,
        ] + $installableDrivers;
    }
    return $installableDrivers;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.