]> git.openstreetmap.org Git - chef.git/blob - cookbooks/mediawiki/recipes/default.rb
Use PHP 7.2 for mediawiki on Ubuntu 18.04
[chef.git] / cookbooks / mediawiki / recipes / default.rb
1 #
2 # Cookbook Name:: mediawiki
3 # Recipe:: default
4 #
5 # Copyright 2013, 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 #     https://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 include_recipe "memcached"
21 include_recipe "apache"
22 include_recipe "mysql"
23 include_recipe "git"
24
25 # Mediawiki Base Requirements
26 package %w[
27   php
28   php-cli
29   php-curl
30   php-gd
31   php-intl
32   php-mbstring
33   php-mysql
34   php-xml
35 ]
36
37 # Mediawiki enhanced difference engine
38 package "php-wikidiff2"
39
40 # Mediawiki Image + SVG support
41 package %w[
42   imagemagick
43   librsvg2-bin
44 ]
45
46 # Mediawiki PDF support via Extension:PdfHandler
47 package %w[
48   ghostscript
49   poppler-utils
50 ]
51
52 # Mediawiki backup
53 package %w[
54   xz-utils
55   liblz4-tool
56 ]
57
58 # Mediawiki packages for VisualEditor support
59 package %w[
60   curl
61   parsoid
62 ]
63
64 # Mediawiki packages for SyntaxHighight support
65 package "python-pygments"
66
67 file "/etc/mediawiki/parsoid/settings.js" do
68   action :delete
69 end
70
71 template "/etc/mediawiki/parsoid/config.yaml" do
72   source "parsoid-config.yaml.erb"
73   owner "root"
74   group "root"
75   mode 0o644
76 end
77
78 service "parsoid" do
79   action [:enable]
80   supports :status => false, :restart => true, :reload => false
81   subscribes :restart, "file[/etc/mediawiki/parsoid/settings.js]"
82   subscribes :restart, "template[/etc/mediawiki/parsoid/config.yaml]"
83 end
84
85 php_version = if node[:lsb][:release].to_f >= 18.04
86                 "7.2"
87               else
88                 "7.0"
89               end
90
91 apache_module "php#{php_version}"
92
93 link "/etc/php/#{php_version}/apache2/conf.d/20-wikidiff2.ini" do
94   to "../../mods-available/wikidiff2.ini"
95 end
96
97 apache_module "rewrite"