diff --git a/manifests/extension.pp b/manifests/extension.pp index 1a902b31..313054ac 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -21,6 +21,9 @@ # [*so_name*] # The DSO name of the package (e.g. opcache for zendopcache) # +# [*ini_prefix*] +# An optional filename prefix for the settings file of the extension +# # [*php_api_version*] # This parameter is used to build the full path to the extension # directory for zend_extension in PHP < 5.5 (e.g. 20100525) @@ -60,6 +63,7 @@ Optional[Php::Provider] $provider = undef, Optional[String] $source = undef, Optional[String] $so_name = downcase($name), + Optional[String] $ini_prefix = undef, Optional[String] $php_api_version = undef, String $package_prefix = $::php::package_prefix, Boolean $zend = false, @@ -93,6 +97,7 @@ ensure => $ensure, provider => $provider, so_name => $so_name, + ini_prefix => $ini_prefix, php_api_version => $php_api_version, zend => $zend, settings => $settings, diff --git a/manifests/extension/config.pp b/manifests/extension/config.pp index 1b1271e9..13854ad0 100644 --- a/manifests/extension/config.pp +++ b/manifests/extension/config.pp @@ -14,6 +14,9 @@ # [*so_name*] # The DSO name of the package (e.g. opcache for zendopcache) # +# [*ini_prefix*] +# An optional filename prefix for the settings file of the extension +# # [*php_api_version*] # This parameter is used to build the full path to the extension # directory for zend_extension in PHP < 5.5 (e.g. 20100525) @@ -45,6 +48,7 @@ String $ensure = 'installed', Optional[Php::Provider] $provider = undef, Optional[String] $so_name = downcase($name), + Optional[String] $ini_prefix = undef, Optional[String] $php_api_version = undef, Boolean $zend = false, Hash $settings = {}, @@ -83,7 +87,7 @@ $config_root_ini = pick_default($::php::config_root_ini, $::php::params::config_root_ini) ::php::config { $title: - file => "${config_root_ini}/${ini_name}.ini", + file => "${config_root_ini}/${ini_prefix}${ini_name}.ini", config => $final_settings, } diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index e7164259..f4cc42c7 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -140,6 +140,27 @@ end end + context 'add ini file prefix if requested' do + let(:title) { 'zendopcache' } + let(:params) do + { + provider: 'pecl', + zend: true, + ini_prefix: '10-', + so_name: 'opcache' + } + end + + it do + is_expected.to contain_php__config('zendopcache').with( + file: "#{etcdir}/10-opcache.ini", + config: { + 'zend_extension' => 'opcache.so' + } + ) + end + end + context 'pecl extensions support php_api_version' do let(:title) { 'xdebug' } let(:params) do