+action :create do
+ if new_resource.source
+ remote_directory extension_directory do
+ cookbook "mediawiki"
+ source new_resource.source
+ owner node[:mediawiki][:user]
+ group node[:mediawiki][:group]
+ mode "755"
+ files_owner node[:mediawiki][:user]
+ files_group node[:mediawiki][:group]
+ files_mode "755"
+ end
+ else
+ extension_repository = new_resource.repository || default_repository
+ extension_reference = if new_resource.reference
+ new_resource.reference
+ elsif new_resource.tag
+ "refs/tags/#{new_resource.tag}"
+ else
+ "REL#{extension_version}".tr(".", "_")
+ end
+
+ git extension_directory do
+ action :sync
+ repository extension_repository
+ reference extension_reference
+ depth 1
+ enable_submodules true
+ user node[:mediawiki][:user]
+ group node[:mediawiki][:group]
+ ignore_failure extension_repository.start_with?("https://github.com/wikimedia/mediawiki-extensions")
+ end
+ end
+
+ if new_resource.template
+ declare_resource :template, "#{mediawiki_directory}/LocalSettings.d/Ext-#{new_resource.extension}.inc.php" do
+ cookbook new_resource.template_cookbook
+ source new_resource.template
+ user node[:mediawiki][:user]
+ group node[:mediawiki][:group]
+ mode "664"
+ variables new_resource.variables
+ end