Skip to content

Commit 813ad24

Browse files
hjuarez20enzolutions
authored andcommitted
[site:install] Change dbFile if the installation is a multisite (#4056)
1 parent 3c23a09 commit 813ad24

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Command/Site/InstallCommand.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,11 @@ function ($profile) {
279279
if ($dbType === 'sqlite') {
280280
// --db-file option
281281
if (!$input->getOption('db-file')) {
282+
$uri = parse_url($input->getParameterOption(['--uri', '-l'], 'default'), PHP_URL_HOST);
283+
$uriPath = $this->site->multisiteMode($uri) ? $this->site->getMultisiteDir($uri) : 'default';
282284
$dbFile = $this->getIo()->ask(
283285
$this->trans('commands.migrate.execute.questions.db-file'),
284-
'sites/default/files/.ht.sqlite'
286+
'sites/'.$uriPath.'/files/.ht.sqlite'
285287
);
286288
$input->setOption('db-file', $dbFile);
287289
}
@@ -419,7 +421,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
419421
];
420422

421423
if ($database_install['driver'] === 'sqlite') {
422-
$database_install['database'] = $input->getOption('db-file');
424+
$uriPath = $this->site->multisiteMode($uri) ? $this->site->getMultisiteDir($uri) : 'default';
425+
$dbFile = $input->getOption('db-file')?:'sites/'.$uriPath.'/files/.ht.sqlite';
426+
427+
$database_install['database'] = $dbFile;
423428
unset(
424429
$database_install['username'],
425430
$database_install['password'],

0 commit comments

Comments
 (0)