Skip to content

Commit

Permalink
Fix #5010. sql:dump includes path to sqlite3 database file in result-…
Browse files Browse the repository at this point in the history
…file=auto filename. Also uses in-memory sqlite during CI. (#5012)
  • Loading branch information
weitzman committed Jan 12, 2022
1 parent 95bac55 commit be0718a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
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

0 comments on commit be0718a

Please sign in to comment.