Skip to content

Commit

Permalink
Set multisite constants false while checking wp core is-installed
Browse files Browse the repository at this point in the history
Creates php file that defines multisite constants false, then uses the
file in `--require` param of task that checks `wp core is-installed`.
Prevents `WordPress database error Table 'tablename' doesn't exist`
that occurs when WordPress loads with...
  - constants set true for MULTISITE and SUBDOMAIN_INSTALL
  - no DB tables
  • Loading branch information
fullyint committed Feb 19, 2017
1 parent 019acbc commit 51f7b72
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### HEAD
* Set multisite constants false while checking `wp core is-installed` ([#766](https://github.com/roots/trellis/pull/766))
* Forward extra bin/deploy.sh parameters to ansible-playbook ([#748](https://github.com/roots/trellis/pull/748))
* Update WP-CLI to 1.1.0 ([#759](https://github.com/roots/trellis/pull/759))
* Add DOMAIN_CURRENT_SITE to default env variables ([#760](https://github.com/roots/trellis/pull/760))
Expand Down
4 changes: 4 additions & 0 deletions roles/deploy/files/tmp_multisite_constants.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
error_reporting(E_ALL & ~E_NOTICE);
define('MULTISITE', false);
define('SUBDOMAIN_INSTALL', false);
7 changes: 6 additions & 1 deletion roles/deploy/hooks/finalize-after.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
---
- name: Create file with multisite constants defined as false
copy:
src: "tmp_multisite_constants.php"
dest: "{{ deploy_helper.shared_path }}/tmp_multisite_constants.php"

- name: WordPress Installed?
command: wp core is-installed {{ project.multisite.enabled | default(false) | ternary('--network', '') }}
command: wp core is-installed --require={{ deploy_helper.shared_path }}/tmp_multisite_constants.php
args:
chdir: "{{ deploy_helper.current_path }}"
register: wp_installed
Expand Down

0 comments on commit 51f7b72

Please sign in to comment.