Skip to content

Commit cba5489

Browse files
authored
Don't mind if there was a previous drupal.
1 parent f179dfa commit cba5489

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

core-dev/src/Command/InstallCommand.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,19 @@ class InstallCommand extends CoreInstallCommand {
1818
*/
1919
function execute(InputInterface $input, OutputInterface $output): int {
2020
$filesystem = new Filesystem();
21-
$settings = __DIR__ . '/../../../../sites/default/settings.php';
22-
$files = __DIR__ . '/../../../../sites/default/files';
23-
$filesystem->chmod($files . '/../', 0755);
24-
$filesystem->chmod($settings, 0777, 0000, true);
25-
$filesystem->remove($settings);
26-
$filesystem->chmod($files, 0777, 0000, true);
27-
$filesystem->remove($files);
21+
try {
22+
$settings = __DIR__ . '/../../../../sites/default/settings.php';
23+
$files = __DIR__ . '/../../../../sites/default/files';
24+
$filesystem->chmod($files . '/../', 0755);
25+
$filesystem->chmod($settings, 0777, 0000, true);
26+
$filesystem->remove($settings);
27+
$filesystem->chmod($files, 0777, 0000, true);
28+
$filesystem->remove($files);
29+
$output->writeln('Removed a previous installation.');
30+
}
31+
catch (\Exception $e) {
32+
// This would fail if there was no previous installation, naively proceed to install Drupal.
33+
}
2834
return parent::execute($input, $output);
2935
}
3036
}

0 commit comments

Comments
 (0)