ddev-pull-wp-scripts
ddev-pull-wp-scripts copied to clipboard
Add better support / warnings for wp-config.php quote variants
The scripts provided here parses out config settings like DB_NAME from wp-config.php.
See:
- https://github.com/mandrasch/ddev-pull-wp-scripts/blob/main/.ddev/providers/ssh.yaml#L60
- https://github.com/mandrasch/ddev-pull-wp-scripts/blob/main/.ddev/providers/backup.yaml#L35
Settings for wp-config.php can be written in 3 styles:
// single quotes
define('DB_NAME', 'my-db');
// double quotes
define("DB_NAME", "my-db");
// mixed quotes
define('DB_NAME', "my-db");
Currently only single quotes are supported, which causes problems for users, e.g. https://github.com/mandrasch/ddev-pull-wp-scripts/issues/2.
A better regex could get values from all three variants.
If anyone is a pro, I'm happy to receive PRs for this challenge 👍