public static function Connection::createConnectionOptionsFromUrl in Drupal 10
File
- core/
modules/ sqlite/ src/ Driver/ Database/ sqlite/ Connection.php, line 438
Class
- Connection
- SQLite implementation of \Drupal\Core\Database\Connection.
Namespace
Drupal\sqlite\Driver\Database\sqliteCode
public static function createConnectionOptionsFromUrl($url, $root) {
$database = parent::createConnectionOptionsFromUrl($url, $root);
// A SQLite database path with two leading slashes indicates a system path.
// Otherwise the path is relative to the Drupal root.
$url_components = parse_url($url);
if ($url_components['path'][0] === '/') {
$url_components['path'] = substr($url_components['path'], 1);
}
if ($url_components['path'][0] === '/' || $url_components['path'] === ':memory:') {
$database['database'] = $url_components['path'];
}
else {
$database['database'] = $root . '/' . $url_components['path'];
}
// User credentials and system port are irrelevant for SQLite.
unset($database['username'], $database['password'], $database['port']);
return $database;
}