Closed betrcode closed 8 years ago
It can't be set (for now). Does wp-cli support it?
@tersmitten Yep, there is a "dbprefix" option to the wp-cli command. I hacked around it for now. Like this:
- name: Remove Wordpress config so we can recreate it
file: path="{{ www_root }}wp-config.php" state=absent
sudo: yes
- name: Overwrite Wordpress config
command: "wp-cli --allow-root --no-color --path='{{ item.path }}' core config --dbprefix='{{ wordpress_db_prefix }}' --dbname='{{ item.dbname }}' --dbuser='{{ item.dbuser }}' --dbpass='{{ item.dbpass }}' --dbhost='{{ item.dbhost | default('localhost') }}'"
with_items: wordpress_installs
sudo: yes
notify: restart apache
Should be straightforward to add the option to this role so my ugly workaround wouldn't be needed. Wanna do it yourself or do you want a PR? :-)
Can you make a pull request?
Add the dbprefix
to wordpress_installs.{n}
. And add some logic like this (look for skip_update
).
Yep, my motivation is to get rid of my ugly hack. :-) Will make a PR but it may have to wait until tomorrow. Thanks for the quick response and being helpful!
I'll wait for the PR, thanks in advance.
There is no --skip-update option for wp-cli core config. See:
http://wp-cli.org/commands/core/config/
Will try without it.
That was just to illustrate the inline if
Oh, I see! It seems cleaner and easier to go with a default. PR is incoming.
Fixed in #44
In wp-config.php there is a table_prefix setting:
$table_prefix = 'wp_';
How can it be set using this role? Thanks!