-
-
Notifications
You must be signed in to change notification settings - Fork 606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable multisite constants while checking wp core is-installed #754
Conversation
Would this help? http://wp-cli.org/commands/db/query/ |
The problem is that we can't use WP-CLI because it can't even load. Under these conditions WordPress fails to load before WP-CLI can do anything. |
if those were environment variables (i.e., in then the user's directory structure wouldn't matter, but the user wouldn't be able to hard-code those values. 🤔 |
I've also run into this. My hack was to install WP in the |
Avoids `WordPress database error Table 'tablename' doesn't exist` that occurs when WordPress loads with... - constants set for MULTISITE and SUBDOMAIN_INSTALL - no DB tables
This reverts commit a71cb7d.
a71cb7d
to
f1765ad
Compare
I've updated this PR but also posted an alternative in #765. Both follow @QWp6t's suggestion:
Both PRs expect that users have added these lines to
This PR retains the regular This PR added a default |
@@ -1,6 +1,6 @@ | |||
--- | |||
- name: WordPress Installed? | |||
command: wp core is-installed {{ project.multisite.enabled | default(false) | ternary('--network', '') }} | |||
shell: MULTISITE=false SUBDOMAIN_INSTALL=false wp core is-installed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is shell
needed for ENV vars?
Ansible does support environment
: http://docs.ansible.com/ansible/playbooks_environment.html
I do believe so as `command` is not run in a shell environment. You have to
pass them into the task itself
…On Feb 19, 2017 9:44 AM, "Scott Walkinshaw" ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In roles/deploy/hooks/finalize-after.yml
<#754 (comment)>:
> @@ -1,6 +1,6 @@
---
- name: WordPress Installed?
- command: wp core is-installed {{ project.multisite.enabled | default(false) | ternary('--network', '') }}
+ shell: MULTISITE=false SUBDOMAIN_INSTALL=false wp core is-installed
is shell needed for ENV vars?
Ansible does support environment: http://docs.ansible.com/
ansible/playbooks_environment.html
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#754 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AATKmRan542vQrmd3yqz-iiGnXq6yRpnks5reH-ZgaJpZM4L_CLS>
.
|
This reverts commit f1765ad.
Avoids `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
Thank you @swalkinshaw and others for the review, and @swalkinshaw for the idea that wp-cli could I've reverted again 😅 and added a commit with just this I added |
@@ -1,6 +1,11 @@ | |||
--- | |||
- name: Create file with multisite constants defined as false | |||
template: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just be a plain file with a copy
right?
Latest edits submitted in fresh uncluttered PR: #766 |
Fixes #554:
WordPress database error Table 'name' doesn't exist
The error happens on a first deploy of multisite -- before multisite is installed.
The
mysql_db
module doesn't allow checking presence of tables as far as I could tell. I didn't manage to come up with any satisfactory CLI commands to inline a mysql query or php command to check the DB tables. Suggestions welcome.This PR dynamically comments out the
MULTISITE
andSUBDOMAIN_INSTALL
constants, allows WP-CLI to checkwp core is-installed
, then immediately re-enables the constants.I removed the
--network
option from theis-installed
command because it yieldsRC: 1
when the multisite constants are absent. (This PR makes the constants absent during theis-installed
check.)This PR assumes the location of multisite constants in
config/application.php
, a bedrock directory structure. If that is not a safe assumption, I suppose we could add a task that checks whether the file exists then make conditional the tasks that disable the multisite constants.