Fix: prevent parent theme removal on child theme delete --all#308
Fix: prevent parent theme removal on child theme delete --all#308ovidiul wants to merge 5 commits intowp-cli:masterfrom
Conversation
|
Thanks for the PR, @ovidiul ! |
Yes, happy to add a Behat test once I figure that one out. I saw some PHPCS issues and a commented line which should not have been disabled, so I've updated the PR with those changes. Thanks! |
|
@schlessera I've added 2 Behat tests for when the child theme is activated. Let me know if you see further changes needed. Thanks |
Sidsector9
left a comment
There was a problem hiding this comment.
@ovidiul Thanks for the PR!
I've tested the PR and I've encountered the following scenario:
When a child theme is active, WordPress doesn't allow deletion of the parent theme unless the theme is switched.
But WP-CLI at the moment allows deletion of the parent theme even when the child theme is active. Can you make that change? The rest looks good!
|
👋 @Sidsector9 change is now in place. Thank you. |
This PR will try and add a fix for the issue mentioned here #325
Basically, it will first loop through the list of fetched themes and check if the actual active theme has a parent theme(is child theme) and if so, it will prevent the parent theme from being deleted unintentionally, this. unless
--forceis supplied.The case when the user specifically deletes the parent theme folder with
wp theme delete parent-themeis omitted since that could be intentional.Happy to add a Behat test if this is considered. Thanks