From fbdeb47f616cf85829b778006ab3d859618b07fc Mon Sep 17 00:00:00 2001 From: Matt Bosma Date: Fri, 9 Aug 2019 10:46:16 -0400 Subject: [PATCH 1/2] add drush_reset_modules_after_clone example --- .../drush_reset_modules_after_clone.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 drush_reset_modules_after_clone/drush_reset_modules_after_clone.php diff --git a/drush_reset_modules_after_clone/drush_reset_modules_after_clone.php b/drush_reset_modules_after_clone/drush_reset_modules_after_clone.php new file mode 100644 index 0000000..25de45d --- /dev/null +++ b/drush_reset_modules_after_clone/drush_reset_modules_after_clone.php @@ -0,0 +1,22 @@ + +config_readonly) && $modules->config_readonly->status == 'Enabled') { + // This time let's just passthru() to run the drush command so the command output prints to the workflow log. + passthru('drush pm-uninstall -y config_readonly'); + } +} \ No newline at end of file From 8a26f27393efbc1abbdaf22c8ed819c80c23dda5 Mon Sep 17 00:00:00 2001 From: Matt Bosma Date: Fri, 9 Aug 2019 10:53:02 -0400 Subject: [PATCH 2/2] Create readme.md --- drush_reset_modules_after_clone/readme.md | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 drush_reset_modules_after_clone/readme.md diff --git a/drush_reset_modules_after_clone/readme.md b/drush_reset_modules_after_clone/readme.md new file mode 100644 index 0000000..c8393fd --- /dev/null +++ b/drush_reset_modules_after_clone/readme.md @@ -0,0 +1,33 @@ +# Reset Modules After Clone # + +The script disables the [config_readonly](https://www.drupal.org/project/config_readonly) +module after a database has been cloned to a `dev` or `multidev` environment. +Purpose: when config_readonly is enabled in a live environment, the configuration can't be changed. +If the database is copied to a dev or multi-dev environment, the module is still enabled, and the dev/multi-dev site is set to read only. +If the site is read-only, you can't uninstall modules, and you are locked out and can't make edits to your site. + +## Instructions ## + +- Be sure the [config_readonly](https://www.drupal.org/project/config_readonly) module is installed into your Drupal codebase. +- Copy the `drush_reset_modules_after_clone` directory into the private/scripts directory of your code repository. +- Add a Quicksilver operation to your pantheon.yml to fire the script after a `clone_database`. +- Test a database clone to dev from an environment where the config_readonly module is enabled. + +Note: While Pantheon does not require a `settings.php` file to run Drupal, Drush does. Make sure you have one committed to the codebase. + +### Example `pantheon.yml` ### + +Here's an example of what your `pantheon.yml` would look like if this were the only Quicksilver operation you wanted to use: + +```yaml +api_version: 1 + +workflows: + + # Database Clones + clone_database: + after: + - type: webphp + description: Reset modules per environment after database clone + script: private/scripts/drush_reset_modules_after_clone/drush_reset_modules_after_clone.php +```