ddev-pull-wp-scripts icon indicating copy to clipboard operation
ddev-pull-wp-scripts copied to clipboard

Add better support / warnings for wp-config.php quote variants

Open mandrasch opened this issue 3 years ago • 0 comments

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 👍

mandrasch avatar Nov 06 '22 09:11 mandrasch