X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/a08c8d97d5cd3666799fb3bef14618d4c7c23398..d18cd92a98384aebf371376383a4408485f12374:/cookbooks/wordpress/resources/plugin.rb?ds=inline diff --git a/cookbooks/wordpress/resources/plugin.rb b/cookbooks/wordpress/resources/plugin.rb index 82c7ae5e2..078b926f5 100644 --- a/cookbooks/wordpress/resources/plugin.rb +++ b/cookbooks/wordpress/resources/plugin.rb @@ -49,7 +49,6 @@ action :create do action :sync repository plugin_repository revision new_resource.revision - depth 1 user node[:wordpress][:user] group node[:wordpress][:group] end @@ -63,9 +62,24 @@ action :create do end end end + + execute "wp-cli plugin activate #{new_resource.plugin}" do + command "/opt/wp-cli/wp --path='#{site_directory}' plugin activate '#{new_resource.plugin}'" + user "www-data" + group "www-data" + not_if "/opt/wp-cli/wp --path='#{site_directory}' plugin is-active '#{new_resource.plugin}'" + ignore_failure plugin_repository.start_with?("https://plugins.svn.wordpress.org/") + end end action :delete do + execute "wp-cli plugin deactivate #{new_resource.plugin}" do + command "/opt/wp-cli/wp --path='#{site_directory}' plugin deactivate '#{new_resource.plugin}'" + user "www-data" + group "www-data" + only_if "/opt/wp-cli/wp --path='#{site_directory}' plugin is-active '#{new_resource.plugin}'" + end + directory plugin_directory do action :delete recursive true