]> git.openstreetmap.org Git - chef.git/commitdiff
Allow wordpress themes to be installed from zip
authorGuillaume Rischard <git@stereo.lu>
Mon, 22 Apr 2024 22:09:42 +0000 (18:09 -0400)
committerGitHub <noreply@github.com>
Mon, 22 Apr 2024 22:09:42 +0000 (18:09 -0400)
cookbooks/wordpress/resources/theme.rb

index 5a402f6d170bf26e0848d7a363477d5c783f1e31..e42b8b0d43da7b4a906d0e1eb80dfb4d274374ef 100644 (file)
@@ -52,6 +52,21 @@ action :create do
         user node[:wordpress][:user]
         group node[:wordpress][:group]
       end
+    elsif theme_repository.end_with?(".zip")
+      zip_path = "#{Chef::Config[:file_cache_path]}/#{new_resource.theme}.zip"
+
+      remote_file zip_path do
+        source theme_repository
+        action :create
+      end
+
+      archive_file zip_path do
+        destination theme_directory
+        action :extract
+        overwrite true
+        group node[:wordpress][:group]
+        owner node[:wordpress][:user]
+      end
     else
       subversion theme_directory do
         action :sync