fix(doctor): see, reach and fix a site's database whatever framework it belongs to - #1406
Merged
Merged
Conversation
…it belongs to Three things stood between the doctor and a Drupal site's database, and together they let a site be misconfigured, say so, and offer nothing. The wiring finding named the problem and stopped. It had no fix because, when it was written, `lerd env` would have appended constants Drupal never reads and the button would have resolved nothing. lerd writes the array Drupal actually runs on now, so the finding offers to write it, from the dashboard and from `lerd site:doctor --fix` alike. The detail says it repoints the app, because it does. `lerd env` then failed on the file it needed to write: Drupal's installer leaves settings.php read-only, which is right for a deployed site and no reason to refuse to configure a local one. Writing restores permission for the duration and puts the mode back exactly, even when the write fails, so a file lerd could not update is left as hardened as it was found. Every format goes through the one writer, so a hardened wp-config or env.php behaves the same. And the check that catches a database which does not exist could not see a Drupal one at all: it read DB_CONNECTION, DB_HOST and DB_DATABASE by name, which are Laravel's, from behind a dotenv gate. It resolves through the framework declaration now, like its SQLite sibling, so a project configured in a PHP settings file or behind a DSN is checked like any other, and an engine that cannot be reached still produces no finding rather than a false one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three things stood between the doctor and a Drupal site's database, and together they let a site be misconfigured, say so, and offer nothing.
The wiring finding named the problem and stopped there. It had no fix because, when it was written,
lerd envwould have appended constants Drupal never reads and the button would have resolved nothing. lerd writes the array Drupal actually runs on now, so the finding offers to write it, from the dashboard and fromlerd site:doctor --fixalike. The detail says it repoints the app, because it does.lerd envthen failed on the file it needed to write:Drupal's installer leaves settings.php read-only, and its directory too, which is right for a deployed site and no reason to refuse to configure a local one. By then the databases had been created, so the user was left to chmod by hand and work out what else was half done. Writing restores permission for the duration and puts the mode back exactly, even when the write fails, so a file lerd could not update is left as hardened as it was found. Every format goes through the one writer, so a hardened wp-config or env.php behaves the same.
And the check that catches a database which does not exist could not see a Drupal one at all: it read DB_CONNECTION, DB_HOST and DB_DATABASE by name, which are Laravel's, from behind a dotenv gate. It resolves through the framework declaration now, like its SQLite sibling, so a project configured in a PHP settings file or behind a DSN is checked like any other. An engine that cannot be reached still produces no finding rather than a false one.
Driven end to end against a Drupal project serving 200 throughout:
and with the database dropped out from under it:
which is the framework's own command, not Laravel's word for it.
Closes #1405