Skip to content

Commit

Permalink
[issue-190] Ensure the directory is writable before copying default.s…
Browse files Browse the repository at this point in the history
…ettings.php to settings.php (#191)

Co-authored-by: Nigel Banks <nigel.g.banks@gmail.com:w>
  • Loading branch information
nigelgbanks and Nigel Banks authored Feb 24, 2022
1 parent a65eb49 commit 9ecefee
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ public function createSettingsIfMissing()
$settings_file = $this->getSettingFilePath();
$fs = new Filesystem();
if (!$fs->exists($settings_file)) {
// After drush site-install has been run it is possible for the default
// directory to be non-writable by anyone.
$site_directory = dirname($settings_file);
$prev = fileperms($site_directory);
$fs->chmod($site_directory, 0775);
$fs->copy(DRUPAL_ROOT . '/sites/default/default.settings.php', $settings_file);
$fs->chmod($site_directory, $prev);
}
}

Expand Down

0 comments on commit 9ecefee

Please sign in to comment.