]> git.openstreetmap.org Git - chef.git/blob - cookbooks/mediawiki/resources/site.rb
Fix mediawiki site_notice/site_readonly attributes
[chef.git] / cookbooks / mediawiki / resources / site.rb
1 #
2 # Cookbook Name:: mediawiki
3 # Resource:: mediawiki_site
4 #
5 # Copyright 2015, OpenStreetMap Foundation
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 # http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19
20 actions :create, :update, :delete
21 default_action :create
22
23 attribute :name, :kind_of => String, :name_attribute => true
24 attribute :aliases, :kind_of => [String, Array]
25 attribute :directory, :kind_of => String
26 attribute :version, :kind_of => String, :default => "1.26"
27 attribute :database_name, :kind_of => String, :required => true
28 attribute :database_user, :kind_of => String, :required => true
29 attribute :database_password, :kind_of => String, :required => true
30 attribute :sitename, :kind_of => String, :default => "OpenStreetMap Wiki"
31 attribute :metanamespace, :kind_of => String, :default => "OpenStreetMap"
32 attribute :logo, :kind_of => String, :default => "$wgStylePath/common/images/wiki.png"
33 attribute :email_contact, :kind_of => String, :default => ""
34 attribute :email_sender, :kind_of => String, :default => ""
35 attribute :email_sender_name, :kind_of => String, :default => "MediaWiki Mail"
36 attribute :commons, :kind_of => [TrueClass, FalseClass], :default => true
37 attribute :skin, :kind_of => String, :default => "vector"
38 attribute :site_notice, :kind_of => [String, TrueClass, FalseClass], :default => false
39 attribute :site_readonly, :kind_of => [String, TrueClass, FalseClass], :default => false
40 attribute :admin_user, :kind_of => String, :default => "Admin"
41 attribute :admin_password, :kind_of => String, :required => true
42 attribute :ssl_enabled, :kind_of => [TrueClass, FalseClass], :default => false
43 attribute :ssl_certificate, :kind_of => String
44 attribute :ssl_certificate_chain, :kind_of => String
45 attribute :private_accounts, :kind_of => [TrueClass, FalseClass], :default => false
46 attribute :private, :kind_of => [TrueClass, FalseClass], :default => false
47 attribute :recaptcha_public_key, :kind_of => String
48 attribute :recaptcha_private_key, :kind_of => String
49 attribute :extra_file_extensions, :kind_of => [String, Array], :default => []
50 attribute :reload_apache, :kind_of => [TrueClass, FalseClass], :default => true
51
52 def after_created
53   notifies :reload, "service[apache2]" if reload_apache
54 end
55
56 def database_params
57   {
58     :host => "localhost",
59     :name => database_name,
60     :username => database_user,
61     :password => database_password
62   }
63 end
64
65 def mediawiki_params
66   {
67     :sitename => sitename,
68     :metanamespace => metanamespace,
69     :logo => logo,
70     :email_contact => email_contact,
71     :email_sender => email_sender,
72     :email_sender_name => email_sender_name,
73     :commons => commons,
74     :skin => skin,
75     :site_notice => site_notice,
76     :site_readonly => site_readonly,
77     :ssl_enabled => ssl_enabled,
78     :extra_file_extensions => extra_file_extensions,
79     :private_accounts => private_accounts,
80     :private => private
81   }
82 end