Update WP theme paths only when template_root in releases_path #840
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.
The update to WP theme paths is needed only if the WP
template_root
falls in thereleases
subdirectory. The problem to solve — originally addressed by #275 then 632bbe8 — is that on deploy, thetemplate_root
will sometimes retain the old releases path value, such as/srv/www/example.com/releases/20170614235048/web/wp/wp-content/themes
, when in fact it needs to be assigned the new release path, such as/srv/www/example.com/releases/20170614235217
(the newer date).This PR uses a safer condition in evaluating whether to update the theme paths. It performs the update only if the
releases_path
(/srv/www/example.com/releases
) appears in the retrievedtemplate_root
value. This revised condition avoids overwriting less commontemplate_root
values such as subdirectories of plugins. Such paths were not accounted for prior to this PR and would have been reset inappropriately, unintentionally deactivating such themes.