Skip to content
This repository has been archived by the owner on Oct 11, 2018. It is now read-only.

when enabling sql extensions, enable their pdo counterparts #116

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 38 additions & 14 deletions manifests/extension.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# == Class: php::extension
# == Define php::extension
#
# Install a PHP extension package
#
Expand Down Expand Up @@ -58,30 +58,54 @@
# Copyright 2012-2015 Christian "Jippi" Winther, unless otherwise noted.
#
define php::extension(
$ensure,
$package,
$ensure = 'present',
$package = undef,
$provider = undef,
$pipe = undef,
$source = undef
$source = undef,
$extension = $title,
$priority = 20,
) {

if $provider == 'pecl' {
validate_re($ensure, '^(present|installed|absent)$')
$command = $ensure ? {
'absent' => '/usr/sbin/php5dismod',
default => '/usr/sbin/php5enmod',
}
$unless = $ensure ? {
'absent' => '/usr/bin/test ! -e',
default => '/usr/bin/test -e',
}

if $package {
package { $package:
ensure => $ensure,
provider => $provider,
source => $source,
pipe => $pipe;
}
} elsif $provider == 'dpkg' {
package { $package:
ensure => $ensure,
provider => $provider,
source => $source;
}

Exec {
require => Package['php5-common'],
path => '/bin:/usr/bin:/usr/local/bin',
}

exec { "${command} -s cli ${extension}":
unless => "${unless} /etc/php5/cli/conf.d/${priority}-${extension}.ini",
}

if $::php::params::service_name and defined(Service[$php::fpm::params::service_name]) {
exec { "${command} -s fpm ${extension}":
unless => "${unless} /etc/php5/fpm/conf.d/${priority}-${extension}.ini",
notify => Service[$php::fpm::params::service_name],
}
} else {
package { $package:
ensure => $ensure,
provider => $provider;
}

if $::php::apache::params::package and defined(Package[$php::apache::params::package]) {
exec { "${command} -s apache2 ${extension}":
unless => "${unless} /etc/php5/apache2/conf.d/${priority}-${extension}.ini",
notify => Service[$php::apache::params::service_name],
}
}

Expand Down
29 changes: 24 additions & 5 deletions manifests/extension/mysql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@
# [*inifile*]
# The path to the extension ini file
#
# [*pdo_inifile*]
# The path to the pdo extension ini file
#
# [*settings*]
# Hash with 'set' nested hash of key => value
# set changes to agues when applied to *inifile*
#
# [*pdo_settings*]
# Hash with 'set' nested hash of key => value
# set changes to agues when applied to *pdo_inifile*
#
# === Variables
#
# No variables
Expand All @@ -39,11 +46,15 @@
# Copyright 2012-2015 Christian "Jippi" Winther, unless otherwise noted.
#
class php::extension::mysql(
$ensure = $php::extension::mysql::params::ensure,
$package = $php::extension::mysql::params::package,
$provider = $php::extension::mysql::params::provider,
$inifile = $php::extension::mysql::params::inifile,
$settings = $php::extension::mysql::params::settings,
$ensure = $php::extension::mysql::params::ensure,
$package = $php::extension::mysql::params::package,
$provider = $php::extension::mysql::params::provider,
$inifile = $php::extension::mysql::params::inifile,
$pdo_inifile = $php::extension::mysql::params::pdo_inifile,
$settings = $php::extension::mysql::params::settings,
$pdo_settings = $php::extension::mysql::params::pdo_settings,
$mysqli_settings = $php::extension::mysql::params::settings,
$mysqli_settings = $php::extension::mysql::params::mysqli_inifile,
) inherits php::extension::mysql::params {

php::extension { 'mysql':
Expand All @@ -56,5 +67,13 @@
file => $inifile,
config => $settings
}
php::config { 'php-extension-pdo_mysql':
file => $pdo_inifile,
config => $pdo_settings
}
php::config { 'php-extension-mysqli':
file => $mysqli_inifile,
config => $mysqli_settings
}

}
22 changes: 17 additions & 5 deletions manifests/extension/mysql/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@
# [*inifile*]
# The path to the extension ini file
#
# [*pdo_inifile*]
# The path to the pdo extension ini file
#
# [*settings*]
# Hash with 'set' nested hash of key => value
# set changes to agues when applied to *inifile*
#
# [*pdo_settings*]
# Hash with 'set' nested hash of key => value
# set changes to agues when applied to *pod_inifile*
#
# === Examples
#
# No examples
Expand All @@ -40,10 +47,15 @@
#
class php::extension::mysql::params {

$ensure = $php::params::ensure
$package = 'php5-mysql'
$provider = undef
$inifile = "${php::params::config_root_ini}/mysql.ini"
$settings = [ ]
$ensure = $php::params::ensure
$package = 'php5-mysql'
$provider = undef
$inifile = "${php::params::config_root_ini}/mysql.ini"
# these files the same for all mysql providers!
$pdo_inifile = "${php::params::config_root_ini}/pdo_mysql.ini"
$mysqli_inifile = "${php::params::config_root_ini}/mysqli.ini"
$settings = [ ]
$pdo_settings = [ ]
$mysqli_settings = [ ]

}
29 changes: 22 additions & 7 deletions manifests/extension/mysqlnd.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@
# [*inifile*]
# The path to the extension ini file
#
# [*pdo_inifile*]
# The path to the pdo extension ini file
#
# [*settings*]
# Hash with 'set' nested hash of key => value
# set changes to agues when applied to *inifile*
#
# [*pdo_settings*]
# Hash with 'set' nested hash of key => value
# set changes to agues when applied to *pdo_inifile*
#
# === Variables
#
# No variables
Expand All @@ -39,22 +46,30 @@
# Copyright 2012-2015 Christian "Jippi" Winther, unless otherwise noted.
#
class php::extension::mysqlnd(
$ensure = $php::extension::mysqlnd::params::ensure,
$package = $php::extension::mysqlnd::params::package,
$provider = $php::extension::mysqlnd::params::provider,
$inifile = $php::extension::mysqlnd::params::inifile,
$settings = $php::extension::mysqlnd::params::settings,
$ensure = $php::extension::mysqlnd::params::ensure,
$package = $php::extension::mysqlnd::params::package,
$provider = $php::extension::mysqlnd::params::provider,
$inifile = $php::extension::mysqlnd::params::inifile,
$pdo_inifile = $php::extension::mysqlnd::params::pdo_inifile,
$settings = $php::extension::mysqlnd::params::settings,
$pdo_settings = $php::extension::mysqlnd::params::pdo_settings,
$mysqli_settings = $php::extension::mysqlnd::params::settings,
$mysqli_settings = $php::extension::mysqlnd::params::mysqli_inifile,
) inherits php::extension::mysqlnd::params {

php::extension { 'mysqlnd':
ensure => $ensure,
package => $package,
provider => $provider
provider => $provider,
priority => 10,
}

php::config { 'php-extension-mysqlnd':
file => $inifile,
config => $settings
}

php::config { 'php-extension-pdo_mysql':
file => $pdo_inifile,
config => $pdo_settings
}
}
22 changes: 17 additions & 5 deletions manifests/extension/mysqlnd/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@
# [*inifile*]
# The path to the extension ini file
#
# [*pdo_inifile*]
# The path to the pdo extension ini file
#
# [*settings*]
# Hash with 'set' nested hash of key => value
# set changes to agues when applied to *inifile*
#
# [*pdo_settings*]
# Hash with 'set' nested hash of key => value
# set changes to agues when applied to *pod_inifile*
#
# === Examples
#
# No examples
Expand All @@ -40,10 +47,15 @@
#
class php::extension::mysqlnd::params {

$ensure = $php::params::ensure
$package = 'php5-mysqlnd'
$provider = undef
$inifile = "${php::params::config_root_ini}/mysqlnd.ini"
$settings = [ ]
$ensure = $php::params::ensure
$package = 'php5-mysqlnd'
$provider = undef
$inifile = "${php::params::config_root_ini}/mysqlnd.ini"
# these files the same for all mysql providers!
$pdo_inifile = "${php::params::config_root_ini}/pdo_mysql.ini"
$mysqli_inifile = "${php::params::config_root_ini}/mysqli.ini"
$settings = [ ]
$pdo_settings = [ ]
$mysqli_settings = [ ]

}
23 changes: 18 additions & 5 deletions manifests/extension/pgsql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@
# [*inifile*]
# The path to the extension ini file
#
# [*pdo_inifile*]
# The path to the pdo extension ini file
#
# [*settings*]
# Hash with 'set' nested hash of key => value
# set changes to agues when applied to *inifile*
#
# [*pdo_settings*]
# Hash with 'set' nested hash of key => value
# set changes to agues when applied to *pdo_inifile*
#
# === Variables
#
# No variables
Expand All @@ -39,11 +46,13 @@
# Copyright 2012-2015 Nodes, unless otherwise noted.
#
class php::extension::pgsql(
$ensure = $php::extension::pgsql::params::ensure,
$package = $php::extension::pgsql::params::package,
$provider = $php::extension::pgsql::params::provider,
$inifile = $php::extension::pgsql::params::inifile,
$settings = $php::extension::pgsql::params::settings,
$ensure = $php::extension::pgsql::params::ensure,
$package = $php::extension::pgsql::params::package,
$provider = $php::extension::pgsql::params::provider,
$inifile = $php::extension::pgsql::params::inifile,
$pdo_inifile = $php::extension::pgsql::params::pdo_inifile,
$settings = $php::extension::pgsql::params::settings,
$pdo_settings = $php::extension::pgsql::params::pdo_settings,
) inherits php::extension::pgsql::params {

php::extension { 'pgsql':
Expand All @@ -56,4 +65,8 @@
file => $inifile,
config => $settings
}
php::config { 'php-extension-pdo_pgsql':
file => $pdo_inifile,
config => $pdo_settings
}
}
19 changes: 14 additions & 5 deletions manifests/extension/pgsql/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@
# [*inifile*]
# The path to the extension ini file
#
# [*pdo_inifile*]
# The path to the pdo extension ini file
#
# [*settings*]
# Hash with 'set' nested hash of key => value
# set changes to agues when applied to *inifile*
#
# [*pdo_settings*]
# Hash with 'set' nested hash of key => value
# set changes to agues when applied to *pod_inifile*
#
# === Examples
#
# No examples
Expand All @@ -40,9 +47,11 @@
#
class php::extension::pgsql::params {

$ensure = $php::params::ensure
$package = 'php5-pgsql'
$provider = undef
$inifile = "${php::params::config_root_ini}/pgsql.ini"
$settings = [ ]
$ensure = $php::params::ensure
$package = 'php5-pgsql'
$provider = undef
$inifile = "${php::params::config_root_ini}/pgsql.ini"
$pdo_inifile = "${php::params::config_root_ini}/pdo_pgsql.ini"
$settings = [ ]
$pdo_settings = [ ]
}
23 changes: 18 additions & 5 deletions manifests/extension/sqlite.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@
# [*inifile*]
# The path to the extension ini file
#
# [*pdo_inifile*]
# The path to the pdo extension ini file
#
# [*settings*]
# Hash with 'set' nested hash of key => value
# set changes to agues when applied to *inifile*
#
# [*pdo_settings*]
# Hash with 'set' nested hash of key => value
# set changes to agues when applied to *pdo_inifile*
#
# === Variables
#
# No variables
Expand All @@ -43,11 +50,13 @@
# Copyright 2012-2015 Christian "Jippi" Winther, unless otherwise noted.
#
class php::extension::sqlite(
$ensure = $php::extension::sqlite::params::ensure,
$package = $php::extension::sqlite::params::package,
$provider = $php::extension::sqlite::params::provider,
$inifile = $php::extension::sqlite::params::inifile,
$settings = $php::extension::sqlite::params::settings
$ensure = $php::extension::sqlite::params::ensure,
$package = $php::extension::sqlite::params::package,
$provider = $php::extension::sqlite::params::provider,
$inifile = $php::extension::sqlite::params::inifile,
$pdo_inifile = $php::extension::sqlite::params::pdo_inifile,
$settings = $php::extension::sqlite::params::settings,
$pdo_settings = $php::extension::sqlite::params::pdo_settings
) inherits php::extension::sqlite::params {

php::extension { 'sqlite':
Expand All @@ -60,4 +69,8 @@
file => $inifile,
config => $settings
}
php::config { 'php-extension-pdo_sqlite':
file => $pdo_inifile,
config => $pdo_settings
}
}
Loading