X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/d1b835abf6c54e768ead54dd0056011554ba0b71..0a6889527f95e185d70a5f3a8fc916114b1a109c:/cookbooks/wordpress/resources/plugin.rb?ds=sidebyside diff --git a/cookbooks/wordpress/resources/plugin.rb b/cookbooks/wordpress/resources/plugin.rb index ccc8010d5..078b926f5 100644 --- a/cookbooks/wordpress/resources/plugin.rb +++ b/cookbooks/wordpress/resources/plugin.rb @@ -17,6 +17,8 @@ # limitations under the License. # +unified_mode true + default_action :create property :plugin, :kind_of => String, :name_property => true @@ -47,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 @@ -61,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