X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/29915ddbd1d3c94d5bde9a43af009606f1294ceb..f4b962486aa3a7a8afd89ca9596cda30446ce74f:/cookbooks/mediawiki/providers/site.rb diff --git a/cookbooks/mediawiki/providers/site.rb b/cookbooks/mediawiki/providers/site.rb index f175dbd5c..a3278cc0d 100644 --- a/cookbooks/mediawiki/providers/site.rb +++ b/cookbooks/mediawiki/providers/site.rb @@ -76,24 +76,32 @@ 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(".", "_") - git site_directory do + git "#{mediawiki_directory}/vendor" do + action :nothing + repository "https://gerrit.wikimedia.org/r/p/mediawiki/vendor.git" + revision mediawiki_reference + user node[:mediawiki][:user] + group node[:mediawiki][:group] + end + + git mediawiki_directory do action :sync - repository "git://github.com/wikimedia/mediawiki-core" - reference mediawiki_reference - # depth 1 + repository "https://gerrit.wikimedia.org/r/p/mediawiki/core.git" + revision mediawiki_reference user node[:mediawiki][:user] group node[:mediawiki][:group] + notifies :sync, "git[#{mediawiki_directory}/vendor]", :immediately notifies :run, "execute[#{mediawiki_directory}/maintenance/install.php]", :immediately notifies :run, "execute[#{mediawiki_directory}/maintenance/update.php]" end @@ -113,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 @@ -133,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, @@ -146,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 @@ -156,25 +164,57 @@ 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 + mediawiki_skin "CologneBlue" do # ~FC005 + site new_resource.name + update_site false + end + + mediawiki_skin "Modern" do + site new_resource.name + update_site false + end + + mediawiki_skin "MonoBook" do + site new_resource.name + update_site false + end + + mediawiki_skin "Vector" do + site new_resource.name + update_site false + end + mediawiki_extension "Cite" do site new_resource.name - template "mw-ext-Cite.inc.php.erb" update_site false end - mediawiki_extension "ConfirmEdit" do + mediawiki_extension "CiteThisPage" 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 + 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 site new_resource.name update_site false @@ -225,6 +265,7 @@ action :create do mediawiki_extension "SimpleAntiSpam" do site new_resource.name update_site false + action :delete end mediawiki_extension "SpamBlacklist" do @@ -251,7 +292,7 @@ action :create do # MediaWiki Language Extension Bundle # FIXME: should automatically resolve tag - mw_lang_ext_bundle_tag = "2015.03" + mw_lang_ext_bundle_tag = "2015.10" mediawiki_extension "Babel" do site new_resource.name @@ -262,6 +303,7 @@ action :create do mediawiki_extension "cldr" do site new_resource.name + template "mw-ext-cldr.inc.php.erb" tag mw_lang_ext_bundle_tag update_site false end @@ -305,6 +347,7 @@ action :create do mediawiki_extension "AntiSpoof" do site new_resource.name + template "mw-ext-AntiSpoof.inc.php.erb" update_site false end @@ -338,6 +381,7 @@ action :create do mediawiki_extension "osmtaginfo" do site new_resource.name + template "mw-ext-osmtaginfo.inc.php.erb" repository "git://github.com/Firefishy/osmtaginfo.git" tag "live" update_site false @@ -345,6 +389,7 @@ action :create do mediawiki_extension "SimpleMap" do site new_resource.name + template "mw-ext-SimpleMap.inc.php.erb" repository "git://github.com/Firefishy/SimpleMap.git" tag "live" update_site false @@ -352,16 +397,41 @@ action :create do mediawiki_extension "SlippyMap" do site new_resource.name + template "mw-ext-SlippyMap.inc.php.erb" repository "git://github.com/Firefishy/SlippyMap.git" tag "live" update_site false end + mediawiki_extension "Mantle" do + site new_resource.name + update_site false + action :delete + end + + mediawiki_extension "MobileFrontend" do + site new_resource.name + template "mw-ext-MobileFrontend.inc.php.erb" + update_site false + end + + mediawiki_extension "DisableAccount" do + site new_resource.name + template "mw-ext-DisableAccount.inc.php.erb" + update_site false + end + + mediawiki_extension "VisualEditor" do + site new_resource.name + template "mw-ext-VisualEditor.inc.php.erb" + update_site false + end + cookbook_file "#{site_directory}/cc-wiki.png" do cookbook "mediawiki" owner node[:mediawiki][:user] group node[:mediawiki][:group] - mode 0644 + mode 0o644 backup false end @@ -369,7 +439,7 @@ action :create do cookbook "mediawiki" owner node[:mediawiki][:user] group node[:mediawiki][:group] - mode 0644 + mode 0o644 backup false end @@ -377,17 +447,19 @@ 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] + apache_site new_resource.name do cookbook "mediawiki" template "apache.erb" directory site_directory variables :aliases => Array(new_resource.aliases), :private => new_resource.private, - :ssl_enabled => new_resource.ssl_enabled, + :ports => ports, :ssl_certificate => new_resource.ssl_certificate, :ssl_certificate_chain => new_resource.ssl_certificate_chain reload_apache false @@ -403,6 +475,31 @@ action :create do end end +action :update do + mediawiki_directory = "#{site_directory}/w" + + template "#{mediawiki_directory}/LocalSettings.php" do + cookbook "mediawiki" + source "LocalSettings.php.erb" + owner node[:mediawiki][:user] + group node[:mediawiki][:group] + mode 0o664 + variables :name => new_resource.name, + :directory => mediawiki_directory, + :database_params => new_resource.database_params, + :mediawiki => new_resource.mediawiki_params + notifies :run, "execute[#{mediawiki_directory}/maintenance/update.php]" + end + + execute "#{mediawiki_directory}/maintenance/update.php" do + action :run + command "php maintenance/update.php --quick" + cwd mediawiki_directory + user node[:mediawiki][:user] + group node[:mediawiki][:group] + end +end + action :delete do apache_site new_resource.name do action :delete