Skip to content

Commit 43a3006

Browse files
committed
Allow civicrm extensions to be installed from a downloaded zip
1 parent f62e7bd commit 43a3006

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

cookbooks/civicrm/attributes/default.rb

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
default[:civicrm][:extensions][:emailapi][:revision] = "2.9"
1212

1313
# fancy email templates
14-
# Do not update from git! See https://civicrm.stackexchange.com/questions/25763/mosaico-packages-are-missing-beta-4
15-
# default[:civicrm][:extensions][:mosaico][:name] = "uk.co.vedaconsulting.mosaico"
16-
# default[:civicrm][:extensions][:mosaico][:repository] = "https://github.com/veda-consulting-company/uk.co.vedaconsulting.mosaico.git"
17-
# default[:civicrm][:extensions][:mosaico][:revision] = "3.2"
14+
default[:civicrm][:extensions][:mosaico][:name] = "uk.co.vedaconsulting.mosaico"
15+
default[:civicrm][:extensions][:mosaico][:zip] = "https://download.civicrm.org/extension/uk.co.vedaconsulting.mosaico/3.2.1691060437/uk.co.vedaconsulting.mosaico-3.2.1691060437.zip"
1816

1917
# validate that osm username exists, simple check
2018
default[:civicrm][:extensions][:username][:name] = "org.openstreetmap.username"

cookbooks/civicrm/recipes/default.rb

+26-6
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,32 @@
161161
end
162162

163163
node[:civicrm][:extensions].each_value do |details|
164-
git "#{extensions_directory}/#{details[:name]}" do
165-
action :sync
166-
repository details[:repository]
167-
revision details[:revision]
168-
user "wordpress"
169-
group "wordpress"
164+
if details[:repository]
165+
git "#{extensions_directory}/#{details[:name]}" do
166+
action :sync
167+
repository details[:repository]
168+
revision details[:revision]
169+
user "wordpress"
170+
group "wordpress"
171+
end
172+
elsif details[:zip]
173+
remote_file "#{cache_dir}/#{details[:name]}.zip" do
174+
source details[:zip]
175+
owner "root"
176+
group "root"
177+
mode "644"
178+
backup false
179+
end
180+
181+
archive_file "#{cache_dir}/#{details[:name]}.zip" do
182+
action :nothing
183+
destination "#{extensions_directory}/#{details[:name]}"
184+
strip_components 1
185+
owner "wordpress"
186+
group "wordpress"
187+
overwrite true
188+
subscribes :extract, "remote_file[#{cache_dir}/#{details[:name]}.zip]", :immediately
189+
end
170190
end
171191
end
172192

0 commit comments

Comments
 (0)