Skip to content

Manage the settings.php file if we create it #308

Closed

Description

@rfay

What happened (or feature request):

In many/most situations ddev wants to manage the settings.php file. It generally will create one if there isn't one during an import-db. However, that settings.php sticks around and can cause no end of confusion.

What you expected to happen:

I would expect

  • the settings.php (if we generated it) to be managed, meaning that we should delete it before ddev rm and recreate it before ddev import-db
  • Our settings.php should not import settings.local.php, because that can only lead to pain, when we bring in a settings.local.php that's intended for another purpose. People can use their own crafted (unmanaged) settings.php + settings.local.php if they want that.

I recommend that we put text in the settings.php that identifies it easily as ddev-generated, for example a comment that says

// ddev-generated by ddev <version> on <date>. Do not edit; you can replace this with your own
// and remove this comment.

Also I recommend that our generated settings.php not include settings.local.php.

How to reproduce it (as minimally and precisely as possible):

I was testing a PR but my repo had a settings.php from an earlier version of our containers (with different db and mysql username). So simple testing failed. This could happen to all our users really easily.

Anything else do we need to know:

Related source links or issues:

Activity

  1. added this to the milestone on Jun 13, 2017
  2. added a commit that references this issue on Jun 14, 2017
    1ec798d
  3. rickmanelius commented on Jun 15, 2017

    @rickmanelius
    Contributor

    Adding the needs decision label. I know work is already in flight here, but I know we need to think through the scenarios to see what could break.

  4. rfay commented on Jun 15, 2017

    @rfay
    MemberAuthor

    The current strategy in #325 is:

    • If the settings file has "#ddev-created" in it (or if there is no settings file) we overwrite it on every import (which is currently the only time we do settings creation)
    • If the settings.php does not have that signature, we do not touch it.
  5. rickmanelius commented on Jun 15, 2017

    @rickmanelius
    Contributor

    Hi @rfay. Thanks for the summary. I'm tracking and overall like the idea/strategy. A few comments:

    • I checked your PR and confirmed that you added helper text to ensure an end-user understands what #ddev-created means. Thanks!
    • You mention "we should delete it before ddev rm". I thought ddev rm would be the trigger to delete it. Am I overthinking the order of operations?
    • We'll likely need to expand this ticket to do the same thing for WordPress.
  6. rickmanelius commented on Jun 15, 2017

    @rickmanelius
    Contributor

    Updated the labels to indicate that there is no issue with the approach and therefore no decision needed. It sounds like we have valid acceptance criteria for Drupal. Need to expand that to include WordPress.

  7. rfay commented on Jun 15, 2017

    @rfay
    MemberAuthor

    @rickmanelius yes, I had originally thought we'd want to delete in some situations, but since we always recreate it seemed silly to add more code.

    Wordpress configs already do all this in #325, there's no difference in the approach.

  8. rickmanelius commented on Jun 15, 2017

    @rickmanelius
    Contributor

    Ah. Helps to read the entire PR first :) Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions