-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Studio: Ensure wp-config constants are defined after import #758
base: trunk
Are you sure you want to change the base?
Studio: Ensure wp-config constants are defined after import #758
Conversation
@katinthehatsite, what if we simplified it and skipped the |
For now I went with this approach so that user's config gets preserved. Happy to change it though if it seems overly complicated.
We can also do that as an alternative. Could there be any data that would be vital in the user's config that we could miss by keeping the default config in place? |
const configContent = await readFile( wpConfigPath, 'utf8' ); | ||
|
||
// Add a unique marker comment to identify our polyfill | ||
if ( ! configContent.includes( '/* WP_POLYFILL_MARKER */' ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I sort of added this check for the case when the user imports a config and the config might have polyfill added already (if they imported a site into Studio from elsewhere and then exported it again out of Studio and imported it the second time) to avoid adding this twice.
There might be a better approach though, not completely sure on this one.
The more I think about this, the more I think it is the better approach. I will wait for the clarification on my question and will adjust accordingly. |
Related issues
Closes https://github.com/Automattic/dotcom-forge/issues/10148
Proposed Changes
This PR adds polyfill for database constants in case they are not defined in the
wp-config.php
file when it is being imported. This ensures that the database constants are defined when the site is started.Testing Instructions
Alternatively, you can export a Studio site, edit
wp-config.php
file and remove the constants such asDB_HOST
etc. from that file. You can then attempt to import it and confirm that the import succeeds and that the site starts successfully.Pre-merge Checklist