Skip to content

Commit

Permalink
Merge pull request #333 from spacepants/extension-ini-name
Browse files Browse the repository at this point in the history
Add optional param to prefix the extension ini filename
  • Loading branch information
hunner committed Aug 2, 2017
2 parents 7429e50 + bbee264 commit 09e5b0d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
5 changes: 5 additions & 0 deletions manifests/extension.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion manifests/extension/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 = {},
Expand Down Expand Up @@ -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,
}

Expand Down
21 changes: 21 additions & 0 deletions spec/defines/extension_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 09e5b0d

Please sign in to comment.