# limitations under the License.
#
-define :mediawiki_site, :action => [ :create, :enable ] do
+define :mediawiki_site, :action => [:create, :enable] do
name = params[:name]
- #/etc/cron.d names cannot contain a dot
+ # /etc/cron.d names cannot contain a dot
cron_name = name.tr(".", "_")
aliases = Array(params[:aliases])
:recaptcha_private => params[:recaptcha_private_key]
}
-#----------------
+ #----------------
node.set_unless[:mediawiki][:sites][name] = {}
node.set[:mediawiki][:sites][name][:site_directory] = site_directory
node.set[:mediawiki][:sites][name][:version] = mediawiki_version
node.set_unless[:mediawiki][:sites][name][:wgSecretKey] = random_password(64)
-#----------------
+ #----------------
mysql_user "#{database_params[:username]}@localhost" do
password database_params[:password]
execute "#{mediawiki[:directory]}/maintenance/install.php" do
action :nothing
- #Use metanamespace as Site Name to ensure correct set namespace
+ # Use metanamespace as Site Name to ensure correct set namespace
command "php maintenance/install.php --server '#{name}' --dbtype 'mysql' --dbname '#{database_params[:name]}' --dbuser '#{database_params[:username]}' --dbpass '#{database_params[:password]}' --dbserver '#{database_params[:host]}' --scriptpath /w --pass '#{mediawiki[:site_admin_pw]}' '#{mediawiki[:metanamespace]}' '#{mediawiki[:site_admin_user]}'"
cwd mediawiki[:directory]
user node[:mediawiki][:user]
not_if do
File.exist?("#{mediawiki[:directory]}/LocalSettings-install.php")
end
- notifies :create, 'ruby_block[rename-installer-localsettings]', :immediately
+ notifies :create, "ruby_block[rename-installer-localsettings]", :immediately
end
execute "#{mediawiki[:directory]}/maintenance/update.php" do
group node[:mediawiki][:group]
end
- directory "#{site_directory}" do
+ directory site_directory do
owner node[:mediawiki][:user]
group node[:mediawiki][:group]
mode 0775
end
- directory "#{mediawiki[:directory]}" do
+ directory mediawiki[:directory] do
owner node[:mediawiki][:user]
group node[:mediawiki][:group]
mode 0775
end
- git "#{mediawiki[:directory]}" do
+ git mediawiki[:directory] do
action :sync
repository mediawiki_repository
reference mediawiki_reference
- #depth 1
+ # depth 1
user node[:mediawiki][:user]
group node[:mediawiki][:group]
- notifies :run, resources(:execute => "#{mediawiki[:directory]}/maintenance/install.php"), :immediately
- notifies :run, resources(:execute => "#{mediawiki[:directory]}/maintenance/update.php")
+ notifies :run, "execute[#{mediawiki[:directory]}/maintenance/install.php]", :immediately
+ notifies :run, "execute[#{mediawiki[:directory]}/maintenance/update.php]"
end
- #Safety catch if git doesn't update but install.php hasn't run
+ # Safety catch if git doesn't update but install.php hasn't run
ruby_block "catch-installer-localsettings-run" do
block do
#
not_if do
File.exist?("#{mediawiki[:directory]}/LocalSettings-install.php")
end
- notifies :run, resources(:execute => "#{mediawiki[:directory]}/maintenance/install.php"), :immediately
+ notifies :run, "execute[#{mediawiki[:directory]}/maintenance/install.php]", :immediately
action :create
end
owner node[:mediawiki][:user]
group node[:mediawiki][:group]
mode 0664
- variables({
- :name => name,
- :database_params => database_params,
- :mediawiki => mediawiki
- })
- notifies :run, resources(:execute => "#{mediawiki[:directory]}/maintenance/update.php")
+ variables :name => name, :database_params => database_params, :mediawiki => mediawiki
+ notifies :run, "execute[#{mediawiki[:directory]}/maintenance/update.php]"
end
template "/etc/cron.d/mediawiki-#{cron_name}" do
owner "root"
group "root"
mode 0644
- variables({
- :name => name,
- :directory => site_directory,
- :user => node[:mediawiki][:user]
- })
+ variables :name => name, :directory => site_directory, :user => node[:mediawiki][:user]
end
template "/etc/cron.daily/mediawiki-#{cron_name}-backup" do
owner "root"
group "root"
mode 0700
- variables({
- :name => name,
- :directory => site_directory,
- :database_params => database_params
- })
+ variables :name => name, :directory => site_directory, :database_params => database_params
end
- #MediaWiki Default Extension
+ # MediaWiki Default Extension
mediawiki_extension "Cite" do
site name
end
# MediaWiki Language Extension Bundle
- #fixme should automatically resolve tag
+ # FIXME: should automatically resolve tag
mw_lang_ext_bundle_tag = "2014.09"
mediawiki_extension "Babel" do
tag mw_lang_ext_bundle_tag
end
- #LocalisationUpdate Update Cron
- #template "/etc/cron.d/mediawiki-#{name}-LocalisationUpdate" do
- # cookbook "mediawiki"
- # source "mediawiki-LocalisationUpdate.cron.erb"
- # owner "root"
- # group "root"
- # mode 0755
- # variables({
- # :name => name,
- # :directory => site_directory,
- # :user => node[:mediawiki][:user]
- # })
- #end
-
- #mediawiki_extension "Translate" do
- # site name
- # template "mw-ext-Translate.inc.php.erb"
- # tag mw_lang_ext_bundle_tag
- #end
+ # LocalisationUpdate Update Cron
+ # template "/etc/cron.d/mediawiki-#{name}-LocalisationUpdate" do
+ # cookbook "mediawiki"
+ # source "mediawiki-LocalisationUpdate.cron.erb"
+ # owner "root"
+ # group "root"
+ # mode 0755
+ # variables :name => name, :directory => site_directory, :user => node[:mediawiki][:user]
+ # end
+
+ # mediawiki_extension "Translate" do
+ # site name
+ # template "mw-ext-Translate.inc.php.erb"
+ # tag mw_lang_ext_bundle_tag
+ # end
mediawiki_extension "UniversalLanguageSelector" do
site name
template "mw-ext-CirrusSearch.inc.php.erb"
end
- #OSM specifc extensions
+ # OSM specifc extensions
mediawiki_extension "osmtaginfo" do
site name
cookbook "mediawiki"
template "apache.erb"
directory site_directory
- variables({
- :aliases => aliases,
- :mediawiki => mediawiki
- })
+ variables :aliases => aliases, :mediawiki => mediawiki
notifies :reload, "service[apache2]"
end
- #Fixme - Needs to run once
+ # FIXME: needs to run once
execute "#{mediawiki[:directory]}/extensions/CirrusSearch/maintenance/updateSearchIndexConfig.php" do
action :nothing
command "php extensions/CirrusSearch/maintenance/updateSearchIndexConfig.php"
user node[:mediawiki][:user]
group node[:mediawiki][:group]
end
-
end