Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #5010. sql:dump includes path to sqlite3 database file in result-file=auto filename. Also uses in-memory sqlite during CI. #5012

Merged
merged 3 commits into from Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -73,7 +73,7 @@ jobs:
docker:
- image: wodby/php:7.4
environment:
- UNISH_DB_URL=sqlite://sut/sites/dev/files/.ht.sqlite
- "UNISH_DB_URL=sqlite://:memory:"
<<: *test74steps

test_74_drupal9_postgres:
Expand Down
2 changes: 2 additions & 0 deletions .ddev/config.yaml
Expand Up @@ -17,4 +17,6 @@ composer_version: ""
disable_settings_management: true
web_environment:
- UNISH_DB_URL=mysql://root:root@db
# - "UNISH_DB_URL=sqlite://:memory:"
# - UNISH_DB_URL=pgsql://postgres:@localhost
- DRUSH_OPTIONS_URI=$DDEV_PRIMARY_URL
2 changes: 2 additions & 0 deletions src/Commands/core/SiteInstallCommands.php
Expand Up @@ -48,6 +48,8 @@ class SiteInstallCommands extends DrushCommands implements SiteAliasManagerAware
* Install using the specified DB params.
* @usage drush si --db-url=sqlite://sites/example.com/files/.ht.sqlite
* Install using SQLite
* @usage drush si --db-url=sqlite://:memory:
* Install using SQLite in-memory database.
* @usage drush si --account-pass=mom
* Re-install with specified uid1 password.
* @usage drush si --existing-config
Expand Down
7 changes: 4 additions & 3 deletions src/Sql/SqlBase.php
Expand Up @@ -233,13 +233,14 @@ public function dumpCmd($table_selection): string
/*
* Generate a path to an output file for a SQL dump when needed.
*
* @param string|bool @file
* @param string|bool|null @file
* If TRUE, generate a path based on usual backup directory and current date.
* Otherwise, just return the path that was provided.
*/
public function dumpFile($file)
public function dumpFile($file): ?string
{
$database = $this->dbSpec['database'];
// basename() is needed for sqlite as $database is a path. Harmless otherwise.
$database = basename($this->dbSpec['database']);

// $file is passed in to us usually via --result-file. If the user
// has set $options['result-file'] = 'auto', then we
Expand Down