28
|
1 |
class apache::mod::php ( |
|
2 |
$package_name = undef, |
|
3 |
$package_ensure = 'present', |
|
4 |
$path = undef, |
|
5 |
$extensions = ['.php'], |
|
6 |
$content = undef, |
|
7 |
$template = 'apache/mod/php5.conf.erb', |
|
8 |
$source = undef, |
|
9 |
$root_group = $::apache::params::root_group, |
|
10 |
) inherits apache::params { |
|
11 |
|
|
12 |
if defined(Class['::apache::mod::prefork']) { |
|
13 |
Class['::apache::mod::prefork']->File['php5.conf'] |
|
14 |
} |
|
15 |
elsif defined(Class['::apache::mod::itk']) { |
|
16 |
Class['::apache::mod::itk']->File['php5.conf'] |
|
17 |
} |
|
18 |
else { |
|
19 |
fail('apache::mod::php requires apache::mod::prefork or apache::mod::itk; please enable mpm_module => \'prefork\' or mpm_module => \'itk\' on Class[\'apache\']') |
|
20 |
} |
|
21 |
validate_array($extensions) |
|
22 |
|
|
23 |
if $source and ($content or $template != 'apache/mod/php5.conf.erb') { |
|
24 |
warning('source and content or template parameters are provided. source parameter will be used') |
|
25 |
} elsif $content and $template != 'apache/mod/php5.conf.erb' { |
|
26 |
warning('content and template parameters are provided. content parameter will be used') |
|
27 |
} |
|
28 |
|
|
29 |
$manage_content = $source ? { |
|
30 |
undef => $content ? { |
|
31 |
undef => template($template), |
|
32 |
default => $content, |
|
33 |
}, |
|
34 |
default => undef, |
|
35 |
} |
|
36 |
|
|
37 |
::apache::mod { 'php5': |
|
38 |
package => $package_name, |
|
39 |
package_ensure => $package_ensure, |
|
40 |
path => $path, |
|
41 |
} |
|
42 |
|
|
43 |
include ::apache::mod::mime |
|
44 |
include ::apache::mod::dir |
|
45 |
Class['::apache::mod::mime'] -> Class['::apache::mod::dir'] -> Class['::apache::mod::php'] |
|
46 |
|
|
47 |
# Template uses $extensions |
|
48 |
file { 'php5.conf': |
|
49 |
ensure => file, |
|
50 |
path => "${::apache::mod_dir}/php5.conf", |
|
51 |
owner => 'root', |
|
52 |
group => $root_group, |
|
53 |
mode => '0644', |
|
54 |
content => $manage_content, |
|
55 |
source => $source, |
|
56 |
require => [ |
|
57 |
Exec["mkdir ${::apache::mod_dir}"], |
|
58 |
], |
|
59 |
before => File[$::apache::mod_dir], |
|
60 |
notify => Class['apache::service'], |
|
61 |
} |
|
62 |
} |