]> git.openstreetmap.org Git - chef.git/commitdiff
Add new skin to OSMF mediawiki instance
authorMichael Glanznig <nebulon42@mailbox.org>
Sun, 14 Jan 2018 09:03:24 +0000 (10:03 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 15 Jan 2018 19:30:58 +0000 (19:30 +0000)
Closes #141

cookbooks/foundation/recipes/wiki.rb
cookbooks/mediawiki/resources/skin.rb

index 2baa6c7f73247ec5417c3563c7dd768f91d51ec2..bb86254f11a4d9e4cff50b181d875585335b6a82 100644 (file)
@@ -48,6 +48,13 @@ mediawiki_skin "osmf" do
   revision "master"
 end
 
+mediawiki_skin "OSMFoundation" do
+  site "wiki.osmfoundation.org"
+  repository "git://github.com/osmfoundation/osmf-mediawiki-skin.git"
+  revision "master"
+  legacy false
+end
+
 cookbook_file "/srv/wiki.osmfoundation.org/Wiki.png" do
   owner node[:mediawiki][:user]
   group node[:mediawiki][:group]
index 1f897c53b0d95f0dc0a480cebc25348c8b6842bb..9b13248955950431b3fc9fe49c6680603c460f0d 100644 (file)
@@ -28,6 +28,7 @@ property :version, :kind_of => String
 property :repository, :kind_of => String
 property :revision, :kind_of => String
 property :update_site, :kind_of => [TrueClass, FalseClass], :default => true
+property :legacy, :kind_of => [TrueClass, FalseClass], :default => true
 
 action :create do
   if new_resource.source
@@ -66,14 +67,20 @@ action :create do
       variables new_resource.variables
     end
   else
-    skin_script = "#{skin_directory}/#{new_resource.skin}.php"
+    if new_resource.legacy
+      file_content = "<?php require_once('#{skin_directory}/#{new_resource.skin}.php');\n"
+      skin_file = "#{skin_directory}/#{new_resource.skin}.php"
+    else
+      file_content = "<?php wfLoadSkin('#{new_resource.skin}');\n"
+      skin_file = "#{skin_directory}/skin.json"
+    end
 
     file "#{mediawiki_directory}/LocalSettings.d/Skin-#{new_resource.skin}.inc.php" do
-      content "<?php require_once('#{skin_script}');\n"
+      content file_content
       user node[:mediawiki][:user]
       group node[:mediawiki][:group]
       mode 0o664
-      only_if { ::File.exist?(skin_script) }
+      only_if { ::File.exist?(skin_file) }
     end
   end
 end