]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/wordpress/resources/plugin.rb
wordpress: ignore failure to activate SVN plugins. Pin wp-fail2ban release
[chef.git] / cookbooks / wordpress / resources / plugin.rb
index ccc8010d5d2dfaae52ce22d8ef064df0d55d6dac..078b926f5d2675f1e9b95d25664f456158fbfdcf 100644 (file)
@@ -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