brint / wordpress-cookbook

Development repository for Opscode Cookbook wordpress
https://supermarket.chef.io/cookbooks/wordpress
Apache License 2.0
80 stars 176 forks source link

Added output of wp-config options as key value pairs from a hash #49

Closed gsreynolds closed 9 years ago

gsreynolds commented 9 years ago

Adds an attribute wp_config_options to allow addition of any required configuration in wp-config.php

A possible solution to #47.

For example

"wordpress": {
  "allow_multisite": true,
  "wp_config_options": {
    "MULTISITE": "true",
    "SUBDOMAIN_INSTALL": "true",
    "DOMAIN_CURRENT_SITE": "'example.com'",
    "PATH_CURRENT_SITE": "'/'",
    "SITE_ID_CURRENT_SITE": "1",
    "BLOG_ID_CURRENT_SITE": "1",
    "SUNRISE": "1",
    "WP_CACHE": "true"
  }
}

outputs

/* Multisite */
define( 'WP_ALLOW_MULTISITE', true );

define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', true );
define( 'DOMAIN_CURRENT_SITE', 'example.com' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
define( 'SUNRISE', 1 );
define( 'WP_CACHE', true );
brint commented 9 years ago

Thanks @gsreynolds! Running through kitchen test, will merge after it passes.

brint commented 9 years ago

I'm going to build on your commit. To get tests passing, need to:

brint commented 9 years ago

Looks like php-fpm is having some issue with CentOS. Pushed up the changes to a branch. Need to come back and figure out why that's failing. Once that's figured out, we'll merge this in.

gsreynolds commented 9 years ago

:+1: Excellent, thanks for taking this forward.

On reflection my addition to README.md might need a bit of rewording. For example:

A hash of options to define in wp_config.php, output as key value pairs into a PHP constant e.g. define( '<%= @key %>', <%= @value %> );. Note: for values you will need to add single quotes around text but omit them for booleans and numbers. (default: {})

brint commented 9 years ago

@gsreynolds Feel free to make the adjustment and make a PR to that other branch for now. I like the adjustment in wording you've proposed.

MattMencel commented 9 years ago

This would be awesome. Any chance this could be merged soonish?