diff --git a/manifests/composer/auto_update.pp b/manifests/composer/auto_update.pp index 2a924c9..2a58c6a 100644 --- a/manifests/composer/auto_update.pp +++ b/manifests/composer/auto_update.pp @@ -1,55 +1,55 @@ # Install composer package manager # # === Parameters # # [*max_age*] # Defines number of days after which Composer should be updated # # [*source*] # Holds URL to the Composer source file # # [*path*] # Holds path to the Composer executable # # [*channel*] # Holds the Update channel (stable|preview|snapshot|1|2) # # [*proxy_type*] # proxy server type (none|http|https|ftp) # # [*proxy_server*] # specify a proxy server, with port number if needed. ie: https://example.com:8080. # # # === Examples # # include php::composer::auto_update # class { "php::composer::auto_update": # "max_age" => 90 # } # class php::composer::auto_update ( $max_age, $source, $path, Php::ComposerChannel $channel = 'stable', $proxy_type = undef, $proxy_server = undef, ) { assert_private() if $proxy_type and $proxy_server { $env = ['HOME=/root', "${proxy_type}_proxy=${proxy_server}"] } else { $env = ['HOME=/root'] } exec { 'update composer': # touch binary when an update is attempted to update its mtime for idempotency when no update is available command => "${path} --no-interaction --quiet self-update --${channel}; touch ${path}", environment => $env, onlyif => "test `find '${path}' -mtime +${max_age}`", path => ['/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', '/usr/local/bin', '/usr/local/sbin'], - require => [File[$path], Class['::php::cli']], + require => [File[$path], Class['php::cli']], } } diff --git a/manifests/dev.pp b/manifests/dev.pp index 3beb3f8..383a9b8 100644 --- a/manifests/dev.pp +++ b/manifests/dev.pp @@ -1,42 +1,42 @@ # Install the development package with headers for PHP # # === Parameters # # [*ensure*] # The PHP ensure of PHP dev to install # # [*package*] # The package name for the PHP development files # class php::dev ( String $ensure = $php::ensure, String $package = "${php::package_prefix}${php::params::dev_package_suffix}", Boolean $manage_repos = $php::manage_repos, ) inherits php::params { assert_private() # On FreeBSD there is no 'devel' package. $real_package = $facts['os']['family'] ? { 'FreeBSD' => [], default => $package, } if $facts['os']['family'] == 'Debian' { # we can set the dependency only if we manage repos $require = $manage_repos ? { - true => Class['::apt::update'], + true => Class['apt::update'], false => undef, } } else { $require = undef } # Default PHP come with xml module and no seperate package for it if $facts['os']['name'] == 'Ubuntu' { ensure_packages(["${php::package_prefix}xml"], { ensure => present, require => $require, }) } package { $real_package: ensure => $ensure, require => Class['php::packages'], } } diff --git a/manifests/extension/install.pp b/manifests/extension/install.pp index d7ddba0..9f8f8ae 100644 --- a/manifests/extension/install.pp +++ b/manifests/extension/install.pp @@ -1,99 +1,99 @@ # Install a PHP extension package # # === Parameters # # [*ensure*] # The ensure of the package to install # Could be "latest", "installed" or a pinned version # # [*package_prefix*] # Prefix to prepend to the package name for the package provider # # [*package_name*] # Full package name for the package provider (e.g. php7.2-xml for # simlexml extension) # # [*provider*] # The provider used to install the package # Could be "pecl", "apt", "dpkg" or any other OS package provider # If set to "none", no package will be installed # # [*source*] # The source to install the extension from. Possible values # depend on the *provider* used # # [*header_packages*] # System packages dependencies to install for extensions (e.g. for # memcached libmemcached-dev on Debian) # # [*compiler_packages*] # System packages dependencies to install for compiling extensions # (e.g. build-essential on Debian) # # [*responsefile*] # File containing answers for interactive extension setup. Supported # *providers*: pear, pecl. # # [*install_options*] # Array of String or Hash options to pass to the provider. # define php::extension::install ( String $ensure = 'installed', Optional[Php::Provider] $provider = undef, Optional[String] $source = undef, String $package_prefix = $php::package_prefix, Optional[String[1]] $package_name = undef, Optional[Stdlib::AbsolutePath] $responsefile = undef, Variant[String, Array[String]] $header_packages = [], Variant[String, Array[String]] $compiler_packages = $php::params::compiler_packages, Php::InstallOptions $install_options = undef, ) { if ! defined(Class['php']) { warning('php::extension::install is private') } case $provider { /pecl|pear/: { $real_package = $title unless empty($header_packages) { ensure_resource('package', $header_packages) Package[$header_packages] -> Package[$real_package] } unless empty($compiler_packages) { ensure_resource('package', $compiler_packages) Package[$compiler_packages] -> Package[$real_package] } $package_require = [ - Class['::php::pear'], - Class['::php::dev'], + Class['php::pear'], + Class['php::dev'], ] } 'none' : { debug("No package installed for php::extension: `${title}`.") } default: { $real_package = $package_name ? { undef => "${package_prefix}${title}", default => $package_name, } $package_require = undef } } unless $provider == 'none' { if ! defined(Package[$real_package]) { package { $real_package: ensure => $ensure, provider => $provider, source => $source, responsefile => $responsefile, install_options => $install_options, require => $package_require, } } } } diff --git a/manifests/fpm/pool.pp b/manifests/fpm/pool.pp index d97337c..67ac575 100644 --- a/manifests/fpm/pool.pp +++ b/manifests/fpm/pool.pp @@ -1,206 +1,206 @@ # Configure fpm pools # # === Parameters # # See the official php-fpm documentation for parameters that are not # documented here: http://php.net/manual/en/install.fpm.configuration.php. # # [*ensure*] # Remove pool if set to `'absent'`, add otherwise # # [*listen*] # On what socket to listen for FastCGI connections, i.e. # `'127.0.0.1:9000'' or `'/var/run/php5-fpm.sock'` # # [*listen_backlog*] # # [*listen_allowed_clients*] # # [*listen_owner*] # Set owner of the Unix socket # # [*listen_group*] # Set the group of the Unix socket # # [*listen_mode*] # # [*user*] # The user that php-fpm should run as # # [*group*] # The group that php-fpm should run as # # [*apparmor_hat*] # The Apparmor hat to use # # [*pm*] # # [*pm_max_children*] # # [*pm_start_servers*] # # [*pm_min_spare_servers*] # # [*pm_max_spare_servers*] # # [*pm_max_requests*] # # [*pm_process_idle_timeout*] # # [*pm_status_path*] # # [*ping_path*] # # [*ping_response*] # # [*access_log*] # The path to the file to write access log requests to # # [*access_log_format*] # The format to save the access log entries as # # [*request_terminate_timeout*] # # [*request_slowlog_timeout*] # # [*security_limit_extensions*] # # [*slowlog*] # # [*template*] # The template to use for the pool # # [*rlimit_files*] # # [*rlimit_core*] # # [*chroot*] # # [*chdir*] # # [*catch_workers_output*] # # [*include*] # Other configuration files to include on this pool # # [*env*] # List of environment variables that are passed to the php-fpm from the # outside and will be available to php scripts in this pool # # [*env_value*] # Hash of environment variables and values as strings to use in php # scripts in this pool # # [*clear_env*] # Whether the environment should be cleared. # # [*options*] # An optional hash for any other data. # # [*php_value*] # Hash of php_value directives # # [*php_flag*] # Hash of php_flag directives # # [*php_admin_value*] # Hash of php_admin_value directives # # [*php_admin_flag*] # Hash of php_admin_flag directives # # [*php_directives*] # List of custom directives that are appended to the pool config # # [*root_group*] # UNIX group of the root user # # [*base_dir*] # The folder that contains the php-fpm pool configs. This defaults to a # sensible default depending on your operating system, like # '/etc/php5/fpm/pool.d' or '/etc/php-fpm.d' # define php::fpm::pool ( $ensure = 'present', $listen = '127.0.0.1:9000', $listen_backlog = '-1', $listen_allowed_clients = undef, $listen_owner = undef, $listen_group = undef, $listen_mode = undef, $user = $php::fpm::config::user, $group = $php::fpm::config::group, Optional[String[1]] $apparmor_hat = undef, $pm = 'dynamic', $pm_max_children = '50', $pm_start_servers = '5', $pm_min_spare_servers = '5', $pm_max_spare_servers = '35', $pm_max_requests = '0', $pm_process_idle_timeout = '10s', $pm_status_path = undef, $ping_path = undef, $ping_response = 'pong', $access_log = undef, $access_log_format = '"%R - %u %t \"%m %r\" %s"', $request_terminate_timeout = '0', $request_slowlog_timeout = '0', $security_limit_extensions = undef, $slowlog = "/var/log/php-fpm/${name}-slow.log", $template = 'php/fpm/pool.conf.erb', $rlimit_files = undef, $rlimit_core = undef, $chroot = undef, $chdir = undef, $catch_workers_output = 'no', $include = undef, $env = [], $env_value = {}, $clear_env = true, $options = {}, $php_value = {}, $php_flag = {}, $php_admin_value = {}, $php_admin_flag = {}, $php_directives = [], $root_group = $php::params::root_group, Optional[Stdlib::Absolutepath] $base_dir = undef, ) { # The base class must be included first because it is used by parameter defaults if ! defined(Class['php']) { warning('You must include the php base class before using any php defined resources') } $pool = $title # Hack-ish to default to user for group too $group_final = $group ? { undef => $user, default => $group } # On FreeBSD fpm is not a separate package, but included in the 'php' package. # Implies that the option SET+=FPM was set when building the port. $real_package = $facts['os']['name'] ? { 'FreeBSD' => [], default => $php::fpm::package, } $pool_base_dir = pick_default($base_dir, $php::fpm::config::pool_base_dir, $php::params::fpm_pool_dir) if ($ensure == 'absent') { file { "${pool_base_dir}/${pool}.conf": ensure => absent, - notify => Class['::php::fpm::service'], + notify => Class['php::fpm::service'], } } else { file { "${pool_base_dir}/${pool}.conf": ensure => file, - notify => Class['::php::fpm::service'], + notify => Class['php::fpm::service'], require => Package[$real_package], content => template($template), owner => root, group => $root_group, mode => '0640', } } } diff --git a/manifests/global.pp b/manifests/global.pp index 5ccdbde..41d27db 100644 --- a/manifests/global.pp +++ b/manifests/global.pp @@ -1,27 +1,27 @@ # Install and configure mod_php for fpm # # === Parameters # # [*inifile*] # Absolute path to the global php.ini file. Defaults # to the OS specific default location as defined in params. # [*settings*] # Hash of settings to apply to the global php.ini file. # Defaults to OS specific defaults (i.e. add nothing) # # class php::global ( Stdlib::Absolutepath $inifile = $php::config_root_inifile, Hash $settings = {} -) inherits ::php { +) inherits php { assert_private() # No deep merging required since the settings we have are the global settings. $real_settings = $settings php::config { 'global': file => $inifile, config => $real_settings, } } diff --git a/manifests/packages.pp b/manifests/packages.pp index 86bcafa..2cc0f2e 100644 --- a/manifests/packages.pp +++ b/manifests/packages.pp @@ -1,37 +1,37 @@ # Install common PHP packages # # === Parameters # # [*ensure*] # Specify which version of PHP packages to install # # [*names*] # List of the names of the package to install # # [*names_to_prefix*] # List of packages names that should be prefixed with the common # package prefix `$php::package_prefix` # class php::packages ( String $ensure = $php::ensure, Boolean $manage_repos = $php::manage_repos, Array $names_to_prefix = prefix($php::params::common_package_suffixes, $php::package_prefix), Array $names = $php::params::common_package_names, ) inherits php::params { assert_private() $real_names = union($names, $names_to_prefix) if $facts['os']['family'] == 'Debian' { if $manage_repos { include apt - Class['::apt::update'] -> Package[$real_names] + Class['apt::update'] -> Package[$real_names] } package { $real_names: ensure => $ensure, } } else { package { $real_names: ensure => $ensure, } } } diff --git a/manifests/pear.pp b/manifests/pear.pp index 556ac5c..45f03d4 100644 --- a/manifests/pear.pp +++ b/manifests/pear.pp @@ -1,62 +1,62 @@ # Install PEAR package manager # # === Parameters # # [*ensure*] # The package ensure of PHP pear to install and run pear auto_discover # # [*package*] # The package name for PHP pear # class php::pear ( String $ensure = $php::pear_ensure, Optional[String] $package = undef, Boolean $manage_repos = $php::manage_repos, ) inherits php::params { assert_private() # Defaults for the pear package name if $package { $package_name = $package } else { if $facts['os']['name'] == 'Amazon' { # On Amazon Linux the package name is also just 'php-pear'. # This would normally not be problematic but if you specify a # package_prefix other than 'php' then it will fail. $package_name = "php-${php::params::pear_package_suffix}" } else { case $facts['os']['family'] { 'Debian': { # Debian is a litte stupid: The pear package is called 'php-pear' # even though others are called 'php5-fpm' or 'php5-dev' $package_name = "php-${php::params::pear_package_suffix}" } default: { # This is the default for all other architectures $package_name = "${php::package_prefix}${php::params::pear_package_suffix}" } } } } # the apt module provides apt::update. apt is only included if we manage any repos $require = $manage_repos ? { - true => Class['::apt::update'], + true => Class['apt::update'], false => undef, } # Default PHP come with xml module and no seperate package for it if $facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['full'], '16.04') >= 0 { ensure_packages(["${php::package_prefix}xml"], { ensure => present, require => $require, }) package { $package_name: ensure => $ensure, require => [$require,Class['php::cli'],Package["${php::package_prefix}xml"]], } } else { package { $package_name: ensure => $ensure, require => Class['php::cli'], } } }