Commit 9c89864f authored by Steven Jones's avatar Steven Jones Committed by helmo

Issue #1066000 by omega8cc, Steven Jones, helmo: Local.settings.php can stop...

Issue #1066000 by omega8cc, Steven Jones, helmo: Local.settings.php can stop working due to file ownership/permissions
parent 1041e920
......@@ -68,5 +68,23 @@ class Provision_Config_Drupal_Settings extends Provision_Config {
// then react to this and change any settings we don't want backed up.
$backup_file = drush_get_option('backup_file');
$this->backup_in_progress = !empty($backup_file);
// Create a blank local.settings.php file if not exists.
$local_settings = $this->site_path . '/local.settings.php';
$local_settings_blank = "<?php # local settings.php \n";
$local_description = 'Drupal local.settings.php file';
if (!provision_file()->exists($local_settings)->status()) {
provision_file()->file_put_contents($local_settings, $local_settings_blank)
->succeed('Generated blank ' . $local_description)
->fail('Could not generate ' . $local_description);
}
// Set permissions on local.settings.php.
provision_file()->chgrp($local_settings, $this->group)
->succeed('Changed group ownership of <code>@path</code> to @gid')
->fail('Could not change group ownership of <code>@path</code> to @gid');
provision_file()->chmod($local_settings, $this->mode | 0440)
->succeed('Changed permissions of <code>@path</code> to @perm')
->fail('Could not change permissions of <code>@path</code> to @perm');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment