Skip to content

Commit

Permalink
Allow to set template path in Drupal 7 Settings recipe (#1613)
Browse files Browse the repository at this point in the history
* Change drupal:settings task to drupal:configure

* Drupal 7 recipe - Set template file path

* Changelog
  • Loading branch information
sergiocarracedo authored and antonmedv committed Aug 27, 2018
1 parent c9333cc commit 2b154be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Fixed missing `var/sessions` in Symfony 4 shared_dirs
- Fixed warning with host without configuration [#1583]
- Removed the `magento:enable` task from the Magento 2 recipe since the module states are defined in `app/etc/config.php` and this task overwrote that.
- Allow to set template file path in Drupal 7 recipe [#1603]


## v6.2.0
Expand Down Expand Up @@ -378,7 +379,7 @@
- Fixed typo3 recipe
- Fixed remove of shared dir on first deploy


[#1603]: https://github.com/deployphp/deployer/issues/1603
[#1583]: https://github.com/deployphp/deployer/issues/1583
[#1580]: https://github.com/deployphp/deployer/pull/1580
[#1575]: https://github.com/deployphp/deployer/pull/1575
Expand Down
9 changes: 5 additions & 4 deletions recipe/drupal7.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
//Set Drupal 7 site. Change if you use different site
set('drupal_site', 'default');


//Drupal 7 shared dirs
set('shared_dirs', [
'sites/{{drupal_site}}/files',
Expand All @@ -44,7 +43,9 @@
//Create and upload Drupal 7 settings.php using values from secrets
task('drupal:settings', function () {
if (askConfirmation('Are you sure to generate and upload settings.php file?')) {
$basepath = dirname(__FILE__) . '/drupal7';

//Get template
$template = get('settings_template');

//Import secrets
$secrets = get('settings');
Expand All @@ -66,13 +67,13 @@
}

//Create settings from template
$settings = file_get_contents($basepath . '/settings.php');
$settings = file_get_contents($template);

$settings = strtr($settings, $replacements);

writeln('settings.php created succesfuly');

$tmpFilename = tempnam($basepath, 'tmp_settings_');
$tmpFilename = tempnam(sys_get_temp_dir(), 'tmp_settings_');
file_put_contents($tmpFilename, $settings);

upload($tmpFilename, '{{deploy_path}}/shared/sites/{{drupal_site}}/settings.php');
Expand Down
Empty file modified src/Deployer.php
100644 → 100755
Empty file.

0 comments on commit 2b154be

Please sign in to comment.