X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/c29faeee61f4bed41701f6cc46b6fac5c3cc7b71..77c76717bfc26fe7ba1641244164bc1cb5c38429:/cookbooks/mediawiki/providers/site.rb diff --git a/cookbooks/mediawiki/providers/site.rb b/cookbooks/mediawiki/providers/site.rb index c422b9c2f..f637271ca 100644 --- a/cookbooks/mediawiki/providers/site.rb +++ b/cookbooks/mediawiki/providers/site.rb @@ -28,12 +28,12 @@ end use_inline_resources action :create do - node.set_unless[:mediawiki][:sites][new_resource.name] = {} + node.normal_unless[:mediawiki][:sites][new_resource.name] = {} - node.set[:mediawiki][:sites][new_resource.name][:directory] = site_directory - node.set[:mediawiki][:sites][new_resource.name][:version] = new_resource.version + node.normal[:mediawiki][:sites][new_resource.name][:directory] = site_directory + node.normal[:mediawiki][:sites][new_resource.name][:version] = new_resource.version - node.set_unless[:mediawiki][:sites][new_resource.name][:wgSecretKey] = SecureRandom.base64(48) + node.normal_unless[:mediawiki][:sites][new_resource.name][:wgSecretKey] = SecureRandom.base64(48) mysql_user "#{new_resource.database_user}@localhost" do password new_resource.database_password @@ -62,7 +62,7 @@ action :create do not_if do ::File.exist?("#{mediawiki_directory}/LocalSettings-install.php") end - notifies :create, "ruby_block[rename-installer-localsettings]", :immediately + notifies :run, "ruby_block[rename-installer-localsettings]", :immediately end execute "#{mediawiki_directory}/maintenance/update.php" do @@ -76,13 +76,13 @@ action :create do directory site_directory do owner node[:mediawiki][:user] group node[:mediawiki][:group] - mode 0775 + mode 0o775 end directory mediawiki_directory do owner node[:mediawiki][:user] group node[:mediawiki][:group] - mode 0775 + mode 0o775 end mediawiki_reference = "REL#{new_resource.version}".tr(".", "_") @@ -108,7 +108,7 @@ action :create do # Safety catch if git doesn't update but install.php hasn't run ruby_block "catch-installer-localsettings-run" do - action :create + action :run block do # end @@ -121,19 +121,19 @@ action :create do directory "#{mediawiki_directory}/images" do owner "www-data" group node[:mediawiki][:group] - mode 0775 + mode 0o775 end directory "#{mediawiki_directory}/cache" do owner "www-data" group node[:mediawiki][:group] - mode 0775 + mode 0o775 end directory "#{mediawiki_directory}/LocalSettings.d" do user node[:mediawiki][:user] group node[:mediawiki][:group] - mode 0775 + mode 0o775 end template "#{mediawiki_directory}/LocalSettings.php" do @@ -141,7 +141,7 @@ action :create do source "LocalSettings.php.erb" owner node[:mediawiki][:user] group node[:mediawiki][:group] - mode 0664 + mode 0o664 variables :name => new_resource.name, :directory => mediawiki_directory, :database_params => new_resource.database_params, @@ -154,7 +154,7 @@ action :create do source "mediawiki.cron.erb" owner "root" group "root" - mode 0644 + mode 0o644 variables :name => new_resource.name, :directory => site_directory, :user => node[:mediawiki][:user] end @@ -164,7 +164,7 @@ action :create do source "mediawiki-backup.cron.erb" owner "root" group "root" - mode 0700 + mode 0o700 variables :name => new_resource.name, :directory => site_directory, :database_params => new_resource.database_params end @@ -199,12 +199,20 @@ action :create do update_site false end - mediawiki_extension "ConfirmEdit" do - site new_resource.name - template "mw-ext-ConfirmEdit.inc.php.erb" - variables :public_key => new_resource.recaptcha_public_key, - :private_key => new_resource.recaptcha_private_key - update_site false + if new_resource.private_accounts || new_resource.private + mediawiki_extension "ConfirmEdit" do + site new_resource.name + update_site false + action :delete + end + else + mediawiki_extension "ConfirmEdit" do + site new_resource.name + template "mw-ext-ConfirmEdit.inc.php.erb" + variables :public_key => new_resource.recaptcha_public_key, + :private_key => new_resource.recaptcha_private_key + update_site false + end end mediawiki_extension "Gadgets" do @@ -268,6 +276,7 @@ action :create do mediawiki_extension "SyntaxHighlight_GeSHi" do site new_resource.name + template "mw-ext-SyntaxHighlight.inc.php.erb" update_site false end @@ -284,11 +293,12 @@ action :create do # MediaWiki Language Extension Bundle # FIXME: should automatically resolve tag - mw_lang_ext_bundle_tag = "2015.10" + mw_lang_ext_bundle_tag = "2017.01" mediawiki_extension "Babel" do site new_resource.name template "mw-ext-Babel.inc.php.erb" + # tag mw_lang_ext_bundle_tag tag mw_lang_ext_bundle_tag update_site false end @@ -423,7 +433,7 @@ action :create do cookbook "mediawiki" owner node[:mediawiki][:user] group node[:mediawiki][:group] - mode 0644 + mode 0o644 backup false end @@ -431,7 +441,7 @@ action :create do cookbook "mediawiki" owner node[:mediawiki][:user] group node[:mediawiki][:group] - mode 0644 + mode 0o644 backup false end @@ -439,21 +449,25 @@ action :create do cookbook "mediawiki" owner node[:mediawiki][:user] group node[:mediawiki][:group] - mode 0644 + mode 0o644 backup false end ports = new_resource.ssl_enabled ? [80, 443] : [80] + ssl_certificate new_resource.name do + domains [new_resource.name] + Array(new_resource.aliases) + only_if { new_resource.ssl_enabled } + end + apache_site new_resource.name do cookbook "mediawiki" template "apache.erb" directory site_directory variables :aliases => Array(new_resource.aliases), :private => new_resource.private, - :ports => ports, - :ssl_certificate => new_resource.ssl_certificate, - :ssl_certificate_chain => new_resource.ssl_certificate_chain + :ssl_enabled => new_resource.ssl_enabled, + :ports => ports reload_apache false end @@ -475,7 +489,7 @@ action :update do source "LocalSettings.php.erb" owner node[:mediawiki][:user] group node[:mediawiki][:group] - mode 0664 + mode 0o664 variables :name => new_resource.name, :directory => mediawiki_directory, :database_params => new_resource.database_params,