Deploys: Update WP theme paths for multisite subsites #854
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is the final piece of the former #848 and addresses https://discourse.roots.io/t/multisite-subsite-using-twentyfifteen-theme/9871/5. This PR enables Trellis deploys to update
template_root
andstylesheet_root
WP options also for multisite subsites, not just the primary site.To disable: Multisite operators who wish to avoid the processing time may define
update_wp_theme_paths: false
in a group_vars file or on the fly:Implementation notes
xargs
for multisite. See also https://danielbachhuber.com/tip/run-wp-cli-command-wordpress-multisite/bool
filter is necessary for proper interpretation of cli-e update_wp_theme_paths=false
(otherwise the var remains a string "false" interpreted as boolean true).select
statement inwith_subelements
limits the items executed instead of via thewhen
condition. This preventsskipped
output, which could otherwise be very lengthy if an installation has many subsites. Consider a multisite installation with only two sites. When one site ischanged
and one isskipped
, this PR's output contains only this:Compare output from using a
when
condition instead of theselect
statement inwith_subelements
:The above is for two sites only. Imagine output above for a multisite installation with 50+ subsites.