-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathini.pp
More file actions
67 lines (61 loc) · 1.69 KB
/
ini.pp
File metadata and controls
67 lines (61 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Define: php::module::ini
#
# Configuration for optional PHP modules which are separately packaged.
# See also php::module for package installation.
#
# Sample Usage :
# php::module::ini { 'xmlreader': pkgname => 'xml' }
# php::module::ini { 'pecl-apc':
# settings => {
# 'apc.enabled' => '1',
# 'apc.shm_segments' => '1',
# 'apc.shm_size' => '64',
# }
# }
# php::module::ini { 'xmlwriter': ensure => absent }
#
define php::module::ini (
$ensure = undef,
$pkgname = false,
$prefix = undef,
$settings = {},
$zend = false,
$priority = '20',
) {
include '::php::params'
# Strip 'pecl-*' prefix is present, since .ini files don't have it
$modname = regsubst($title , '^pecl-', '', 'G')
# Handle naming issue of php-apc package on Debian
if ($modname == 'apc' and $pkgname == false) {
# Package name
$ospkgname = $::php::params::php_apc_package_name
} else {
# Package name
$ospkgname = $pkgname ? {
/^php/ => $pkgname,
false => "${::php::params::php_package_name}-${title}",
default => "${::php::params::php_package_name}-${pkgname}",
}
}
# INI configuration file
if $prefix {
$inifile = "${::php::params::php_conf_dir}/${prefix}-${modname}.ini"
} else {
$inifile = "${::php::params::php_conf_dir}/${modname}.ini"
}
if $ensure == 'absent' {
file { $inifile:
ensure => absent,
}
} else {
file { $inifile:
ensure => $ensure,
require => Package[$ospkgname],
content => template('php/module.ini.erb'),
}
}
# Reload FPM if present
if defined(Class['::php::fpm::daemon']) {
File[$inifile] ~> Service[$php::params::fpm_service_name]
}
}