diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c3d962..69fa3f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +## 2.1.0 ## + +This release may contain breaking changes. + +* Specify cache directory for Image Magick extension (@jenslind) +* php.ini adjustments (@jenslind, @typhonius) +* Use Homebrew OpenSSL and curl (@jenslind, @alexmace, @olofjohansson) +* Remove SNMP from compile flags (@jenslind) +* Fix usage of libssh2 for ssh2 extension (@rolfvandekrol) +* Composer updated to 1.2.1 (@alexmace) +* Add MongoDB extension (@alexmace) +* Use `ensure_resource` when adding resources (@alexmace) +* Update brews to use sha256 (@convenient) +* PHP7/MySQL compatibility (@typhonius) +* ZLib fixes (@nei, @typhonius) +* Deprecating ruby 1.8.7 per boxen/boxen#204 (@typhonius) +* Improve secure version selection (@sambauers) +* Update PHP secure versions (@sambauers) +* When no PHP version is specified, default to latest (@sambauers) + ## 2.0.1 ## * Composer updated to 1.0.0-alpha10 (@alexmace) diff --git a/README.md b/README.md index 11056f9..5c220f5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# PHP Puppet Module for Boxen +PHP Puppet Module for Boxen +=========================== [![Build Status](https://travis-ci.org/boxen/puppet-php.png?branch=master)](https://travis-ci.org/boxen/puppet-php) @@ -24,7 +25,8 @@ The following boxen modules are required if optional PHP extensions are used: * `openssl` - Mongodb extension `php::extension::mongodb` * `redis` - Redis extension `php::extension::redis` -## Usage +Usage +----- ```puppet # Install php 5.4 @@ -49,6 +51,7 @@ php::local { '/path/to/my/awesome/project': # Ensure an extension is installed for a certain php version # note, you can't have duplicate resource names so you have to name like so +$version = '5.4.10' php::extension::apc { "apc for ${version}": php => $version, version => '3.1.13', # Optionally specify the extension version @@ -66,8 +69,8 @@ php::fpm { '5.3.23': } # * the version of PHP is installed # * a PHP-FPM service is configured for this PHP version # * a FPM pool is listening on a per project nginx socket -$name = "project-name" -$version = "5.4.10" +$name = 'project-name' +$version = '5.4.10' php::fpm::pool { "${name}-${version}": version => $version, socket_path => "${boxen::config::socketdir}/${name}", @@ -76,7 +79,8 @@ php::fpm::pool { "${name}-${version}": ``` -## PHP Project Usage ## +PHP Project Usage +----------------- A sample PHP project manifest is provided in `manifests/project.pp` which will run a PHP project using PHP-FPM under Nginx. This can be used directly, but may require tweaking for your own purposes. @@ -86,7 +90,6 @@ A simple project manifest example: # your-boxen/modules/projects/manifests/trollin.pp class projects::trollin { - php::project { 'trollin': source => 'boxen/trollin', elasticsearch => true, @@ -104,7 +107,8 @@ In the background this is installing PHP 5.3.23, creating a PHP-FPM service for The example nginx host template at `templates/nginx/nginx.conf.erb` is also a sample configuration which can be copied to your main boxen module and the nginx template path above altered to match this. This is set up with a basic PHP structure, and Fastcgi params to pass the expected variables from Nginx to PHP-FPM. -## Upgrading to version 2.X.X from version 1.X.X +Upgrading to version 2.X.X from version 1.X.X +--------------------------------------------- The old PHP version classes are removed completely in version 2. diff --git a/data/common.yaml b/data/common.yaml index bf5e326..054ab34 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -13,7 +13,8 @@ php::config::composer: php::config::phpenv: revision: '6499bb6c7b645af3f4e67f7e17708d5ee208453f' php::config::secure_versions: - '5.6': '5.6.9' - '5.5': '5.5.25' - '5.4': '5.4.41' + '7.1': '7.1.3' + '7.0': '7.0.17' + '5.6': '5.6.30' + '5.5': '5.5.38' php::config::secure_warning: true diff --git a/lib/puppet/parser/functions/php_get_patch_version.rb b/lib/puppet/parser/functions/php_get_patch_version.rb new file mode 100644 index 0000000..3bfafd6 --- /dev/null +++ b/lib/puppet/parser/functions/php_get_patch_version.rb @@ -0,0 +1,53 @@ +module Puppet::Parser::Functions + newfunction(:php_get_patch_version, :type => :rvalue) do |args| + version = args[0] + + # Get secure version data + Puppet::Parser::Functions.function('hiera') + secure_versions = function_hiera( [ 'php::config::secure_versions' ] ) + + # Specify secure version if no minor point specified + patch_version = case version.to_s + when '', '7', '7.1' + secure_versions['7.1'] + when '7.0' + secure_versions['7.0'] + when '5', '5.6' + secure_versions['5.6'] + when '5.5' + secure_versions['5.5'] + else + version.to_s + end + + # Warn on insecure versions + display_secure_warning_local = args[1] + display_secure_warning_hiera = function_hiera( [ 'php::config::secure_warning' ] ) + if display_secure_warning_local && display_secure_warning_hiera + Puppet::Parser::Functions.function('versioncmp') + warning = nil + + # Version is greater than or equal to 7.1.0 and less than the 7.1 secure version + if function_versioncmp( [ patch_version, '7.1' ] ) >= 0 && function_versioncmp( [ patch_version, secure_versions['7.1'] ] ) < 0 + warning = ['7.1.X', secure_versions['7.1']] + # Version is greater than or equal to 7.0.0 and less than the 7.0 secure version + elsif function_versioncmp( [ patch_version, '7.0' ] ) >= 0 && function_versioncmp( [ patch_version, secure_versions['7.0'] ] ) < 0 + warning = ['7.0.X', secure_versions['7.0']] + # Version is greater than or equal to 5.6.0 and less than the 5.6 secure version + elsif function_versioncmp( [ patch_version, '5.6' ] ) >= 0 && function_versioncmp( [ patch_version, secure_versions['5.6'] ] ) < 0 + warning = ['5.6.X', secure_versions['5.6']] + # Version is less than the minimum secure version + elsif function_versioncmp( [ patch_version, secure_versions['5.5'] ] ) < 0 + warning = ['5.5.X', secure_versions['5.5']] + end + + unless warning.nil? + Puppet::Parser::Functions.function('warning') + statement = 'You are installing PHP %s which is known to be insecure. The current secure %s version is %s' + function_warning( [ sprintf( statement, patch_version, warning[0], warning[1] ) ] ) + end + end + + return patch_version + end +end diff --git a/manifests/extension/apc.pp b/manifests/extension/apc.pp index 90776e6..1a3efc8 100644 --- a/manifests/extension/apc.pp +++ b/manifests/extension/apc.pp @@ -12,16 +12,20 @@ $version = '3.1.13' ) { require php::config + + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'apc' $package_name = "APC-${version}" $url = "http://pecl.php.net/get/APC-${version}.tgz" # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" php_extension { $name: extension => $extension, @@ -30,13 +34,13 @@ package_url => $url, homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, cache_dir => $php::config::extensioncachedir, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template("php/extensions/${extension}.ini.erb"), require => Php_extension[$name], } diff --git a/manifests/extension/couchbase.pp b/manifests/extension/couchbase.pp index 455ee2d..db2f97b 100644 --- a/manifests/extension/couchbase.pp +++ b/manifests/extension/couchbase.pp @@ -14,14 +14,18 @@ require couchbase::lib require php::config + + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'couchbase' # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" # Clone the source repository # Use ensure_resource, because if you directly use the repository type, it @@ -47,7 +51,7 @@ homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, cache_dir => $php::config::extensioncachedir, require => Repository["${php::config::extensioncachedir}/couchbase"], @@ -57,7 +61,7 @@ # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/imagick.pp b/manifests/extension/imagick.pp index 9f30020..da36b17 100644 --- a/manifests/extension/imagick.pp +++ b/manifests/extension/imagick.pp @@ -14,16 +14,19 @@ require php::config require imagemagick + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'imagick' $package_name = "imagick-${version}" $url = "http://pecl.php.net/get/imagick-${version}.tgz" # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" # Additional options $configure_params = "--with-imagick=${boxen::config::homebrewdir}/opt/imagemagick" @@ -35,14 +38,14 @@ package_url => $url, homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, configure_params => $configure_params, cache_dir => $php::config::extensioncachedir, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/intl.pp b/manifests/extension/intl.pp index d6e41f2..742d846 100644 --- a/manifests/extension/intl.pp +++ b/manifests/extension/intl.pp @@ -13,16 +13,19 @@ ) { require php::config + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'intl' $package_name = "intl-${version}" $url = "http://pecl.php.net/get/intl-${version}.tgz" # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" # Additional options $configure_params = "--with-icu-dir=${boxen::config::homebrewdir}/opt/icu4c" @@ -34,14 +37,14 @@ package_url => $url, homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, cache_dir => $php::config::extensioncachedir, configure_params => $configure_params, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/mcrypt.pp b/manifests/extension/mcrypt.pp index ab40e3f..5a63089 100644 --- a/manifests/extension/mcrypt.pp +++ b/manifests/extension/mcrypt.pp @@ -11,14 +11,17 @@ ) { require php::config + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'mcrypt' # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" # Additional options $configure_params = "--with-mcrypt=${boxen::config::homebrewdir}/opt/mcrypt" @@ -30,14 +33,14 @@ homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, configure_params => $configure_params, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/memcache.pp b/manifests/extension/memcache.pp index 3cdbf67..2dc650c 100644 --- a/manifests/extension/memcache.pp +++ b/manifests/extension/memcache.pp @@ -14,9 +14,13 @@ include boxen::config require php::config + + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'memcache' @@ -24,7 +28,7 @@ $url = "http://pecl.php.net/get/memcache-${version}.tgz" # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" php_extension { $name: extension => $extension, @@ -33,13 +37,13 @@ package_url => $url, homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, cache_dir => $php::config::extensioncachedir, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/memcached.pp b/manifests/extension/memcached.pp index edd1046..288054e 100644 --- a/manifests/extension/memcached.pp +++ b/manifests/extension/memcached.pp @@ -15,9 +15,13 @@ require memcached::lib require php::config + + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'memcached' @@ -25,7 +29,7 @@ $url = "http://pecl.php.net/get/memcached-${version}.tgz" # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" # Additional options $configure_params = "--with-libmemcached-dir=${boxen::config::homebrewdir}/opt/libmemcached" @@ -37,14 +41,14 @@ package_url => $url, homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, cache_dir => $php::config::extensioncachedir, configure_params => $configure_params, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/mongo.pp b/manifests/extension/mongo.pp index d9c7035..9cde698 100644 --- a/manifests/extension/mongo.pp +++ b/manifests/extension/mongo.pp @@ -12,16 +12,20 @@ $version = '1.4.5' ) { require php::config + + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'mongo' $package_name = "mongo-${version}" $url = "http://pecl.php.net/get/mongo-${version}.tgz" # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" php_extension { $name: extension => $extension, @@ -30,13 +34,13 @@ package_url => $url, homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, cache_dir => $php::config::extensioncachedir, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/mongodb.pp b/manifests/extension/mongodb.pp index e197225..9974dfe 100644 --- a/manifests/extension/mongodb.pp +++ b/manifests/extension/mongodb.pp @@ -14,16 +14,19 @@ require php::config require openssl + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'mongodb' $package_name = "mongodb-${version}" $url = "https://pecl.php.net/get/mongodb-${version}.tgz" # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" # Additional options $configure_params = "--with-openssl-dir=${boxen::config::homebrewdir}/opt/openssl" @@ -35,13 +38,13 @@ package_url => $url, homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, cache_dir => $php::config::extensioncachedir, configure_params => $configure_params, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/mssql.pp b/manifests/extension/mssql.pp index e27ad5c..a5e8c27 100644 --- a/manifests/extension/mssql.pp +++ b/manifests/extension/mssql.pp @@ -12,14 +12,17 @@ require php::dependencies::freetds require php::config + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'mssql' # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" # Additional options $configure_params = "--with-mssql=${boxen::config::homebrewdir}/opt/freetds" @@ -31,7 +34,7 @@ homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, configure_params => $configure_params, require => Package['freetds'], @@ -39,7 +42,7 @@ # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/oauth.pp b/manifests/extension/oauth.pp index d8c84e8..132c298 100644 --- a/manifests/extension/oauth.pp +++ b/manifests/extension/oauth.pp @@ -12,16 +12,20 @@ $version = '1.2.3' ) { require php::config + + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'oauth' $package_name = "oauth-${version}" $url = "http://pecl.php.net/get/oauth-${version}.tgz" # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" php_extension { $name: extension => $extension, @@ -30,13 +34,13 @@ package_url => $url, homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, cache_dir => $php::config::extensioncachedir, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/pdo_dblib.pp b/manifests/extension/pdo_dblib.pp index 0b70a2b..3c22651 100644 --- a/manifests/extension/pdo_dblib.pp +++ b/manifests/extension/pdo_dblib.pp @@ -12,14 +12,17 @@ require php::dependencies::freetds require php::config + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'pdo_dblib' # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" # Additional options $configure_params = "--with-pdo_dblib=${boxen::config::homebrewdir}/opt/freetds" @@ -31,7 +34,7 @@ homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, configure_params => $configure_params, require => Package['freetds'], @@ -39,7 +42,7 @@ # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/pdo_pgsql.pp b/manifests/extension/pdo_pgsql.pp index 8592065..c479a0a 100644 --- a/manifests/extension/pdo_pgsql.pp +++ b/manifests/extension/pdo_pgsql.pp @@ -11,14 +11,17 @@ ) { require php::config + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'pdo_pgsql' # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" # Additional options $configure_params = "--with-pdo-pgsql=${boxen::config::homebrewdir}/opt/postgresql" @@ -30,14 +33,14 @@ homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, configure_params => $configure_params, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/pecl_http.pp b/manifests/extension/pecl_http.pp index c563cac..57f4ecc 100644 --- a/manifests/extension/pecl_http.pp +++ b/manifests/extension/pecl_http.pp @@ -14,9 +14,13 @@ include boxen::config require php::config + + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'pecl_http' $package_name = "pecl_http-${version}" @@ -24,7 +28,7 @@ # Final module name & install path $compiled_name = 'http.so' - $module_path = "${php::config::root}/versions/${php}/modules/${compiled_name}" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${compiled_name}" php_extension { $name: extension => $extension, @@ -33,14 +37,14 @@ package_url => $url, homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, cache_dir => $php::config::extensioncachedir, compiled_name => $compiled_name, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/pgsql.pp b/manifests/extension/pgsql.pp index 4e5c7eb..f80efca 100644 --- a/manifests/extension/pgsql.pp +++ b/manifests/extension/pgsql.pp @@ -11,14 +11,17 @@ ) { require php::config + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'pgsql' # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" # Additional options $configure_params = "--with-pgsql=${boxen::config::homebrewdir}/opt/postgresql" @@ -30,14 +33,14 @@ homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, configure_params => $configure_params, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/pspell.pp b/manifests/extension/pspell.pp index c1f8830..e14f547 100644 --- a/manifests/extension/pspell.pp +++ b/manifests/extension/pspell.pp @@ -12,13 +12,16 @@ require php::config require aspell + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Ensure that the specified version of PHP is installed. - php_require($php) + php_require($patch_php_version) $extension = 'pspell' # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" # Additional options $configure_params = "--with-pspell=${boxen::config::homebrewdir}/opt/aspell" @@ -30,14 +33,14 @@ homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, configure_params => $configure_params, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/pthreads.pp b/manifests/extension/pthreads.pp index 4184919..c052004 100644 --- a/manifests/extension/pthreads.pp +++ b/manifests/extension/pthreads.pp @@ -20,16 +20,19 @@ ) { require php::config + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'pthreads' $package_name = "pthreads-${version}" $url = "http://pecl.php.net/get/pthreads-${version}.tgz" # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" php_extension { $name: extension => $extension, @@ -38,13 +41,13 @@ package_url => $url, homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, provider => pecl, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/redis.pp b/manifests/extension/redis.pp index 8a9baa3..6066cb9 100644 --- a/manifests/extension/redis.pp +++ b/manifests/extension/redis.pp @@ -14,14 +14,18 @@ require redis require php::config + + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'redis' # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" # Clone the source repository # Use ensure_resource, because if you directly use the repository type, it @@ -44,7 +48,7 @@ homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, cache_dir => $php::config::extensioncachedir, require => Repository["${php::config::extensioncachedir}/redis"], @@ -52,7 +56,7 @@ # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/ssh2.pp b/manifests/extension/ssh2.pp index b6f0549..d6eb989 100644 --- a/manifests/extension/ssh2.pp +++ b/manifests/extension/ssh2.pp @@ -12,9 +12,13 @@ $version = '0.12' ) { require php::config + + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) package { 'libssh2': } @@ -23,7 +27,7 @@ $url = "http://pecl.php.net/get/ssh2-${version}.tgz" # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" # Additional options $configure_params = "--with-ssh2=${boxen::config::homebrewdir}/opt/libssh2" @@ -35,7 +39,7 @@ package_url => $url, homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, cache_dir => $php::config::extensioncachedir, provider => pecl, configure_params => $configure_params, @@ -44,7 +48,7 @@ # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/stats.pp b/manifests/extension/stats.pp index 5af61a9..c30efc1 100644 --- a/manifests/extension/stats.pp +++ b/manifests/extension/stats.pp @@ -12,16 +12,20 @@ $version = '1.0.3' ) { require php::config + + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'stats' $package_name = "stats-${version}" $url = "http://pecl.php.net/get/stats-${version}.tgz" # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" php_extension { $name: extension => $extension, @@ -30,13 +34,13 @@ package_url => $url, homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, cache_dir => $php::config::extensioncachedir, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/xdebug.pp b/manifests/extension/xdebug.pp index d9ffe1b..476cb7e 100644 --- a/manifests/extension/xdebug.pp +++ b/manifests/extension/xdebug.pp @@ -12,16 +12,20 @@ $version = '2.2.1' ) { require php::config + + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'xdebug' $package_name = "xdebug-${version}" $url = "http://xdebug.org/files/xdebug-${version}.tgz" # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" php_extension { $name: extension => $extension, @@ -30,13 +34,13 @@ package_url => $url, homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, cache_dir => $php::config::extensioncachedir, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template("php/extensions/${extension}.ini.erb"), require => Php_extension[$name], } diff --git a/manifests/extension/xhprof.pp b/manifests/extension/xhprof.pp index 7ed7846..58bdb9f 100644 --- a/manifests/extension/xhprof.pp +++ b/manifests/extension/xhprof.pp @@ -13,16 +13,20 @@ $config_template = 'php/extensions/xhprof.ini.erb' ) { require php::config + + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'xhprof' $package_name = "xhprof-${version}" $url = "http://pecl.php.net/get/xhprof-${version}.tgz" # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" php_extension { $name: extension => $extension, @@ -31,14 +35,14 @@ package_url => $url, homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, cache_dir => $php::config::extensioncachedir, extension_dir => 'extension' } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template($config_template), require => Php_extension[$name], } diff --git a/manifests/extension/zmq.pp b/manifests/extension/zmq.pp index 4ab227d..32a7b3f 100644 --- a/manifests/extension/zmq.pp +++ b/manifests/extension/zmq.pp @@ -14,14 +14,18 @@ require zeromq require php::config + + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'zmq' # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" # Clone the source repository # Use ensure_resource, because if you directly use the repository type, it @@ -44,7 +48,7 @@ homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, cache_dir => $php::config::extensioncachedir, require => Repository["${php::config::extensioncachedir}/zmq"], @@ -52,7 +56,7 @@ # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/extension/zookeeper.pp b/manifests/extension/zookeeper.pp index 236943d..41973ab 100644 --- a/manifests/extension/zookeeper.pp +++ b/manifests/extension/zookeeper.pp @@ -15,16 +15,20 @@ require zookeeper require php::config + + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Require php version eg. php::5_4_10 # This will compile, install and set up config dirs if not present - php_require($php) + php_require($patch_php_version) $extension = 'zookeeper' $package_name = "zookeeper-${version}" $url = "http://pecl.php.net/get/zookeeper-${version}.tgz" # Final module install path - $module_path = "${php::config::root}/versions/${php}/modules/${extension}.so" + $module_path = "${php::config::root}/versions/${patch_php_version}/modules/${extension}.so" # Additional options $configure_params = "--with-libzookeeper-dir=${boxen::config::homebrewdir}/opt/zookeeper" @@ -36,14 +40,14 @@ package_url => $url, homebrew_path => $boxen::config::homebrewdir, phpenv_root => $php::config::root, - php_version => $php, + php_version => $patch_php_version, cache_dir => $php::config::extensioncachedir, configure_params => $configure_params, } # Add config file once extension is installed - file { "${php::config::configdir}/${php}/conf.d/${extension}.ini": + file { "${php::config::configdir}/${patch_php_version}/conf.d/${extension}.ini": content => template('php/extensions/generic.ini.erb'), require => Php_extension[$name], } diff --git a/manifests/fpm.pp b/manifests/fpm.pp index 6d5ae6d..348c0d6 100644 --- a/manifests/fpm.pp +++ b/manifests/fpm.pp @@ -10,45 +10,30 @@ ){ require php::config - # Current supported and secure versions - $secure_5_6 = $php::config::secure_versions['5.6'] - $secure_5_5 = $php::config::secure_versions['5.5'] - $secure_5_4 = $php::config::secure_versions['5.4'] - - # Specify secure version if no minor point specified - if $version == '5' { - $patch_version = $secure_5_6 - } elsif $version == '5.6' { - $patch_version = $secure_5_6 - } elsif $version == '5.5' { - $patch_version = $secure_5_5 - } elsif $version == '5.4' { - $patch_version = $secure_5_4 - } else { - $patch_version = $version - } + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($version) # Config file locations - $version_config_root = "${php::config::configdir}/${patch_version}" + $version_config_root = "${php::config::configdir}/${patch_php_version}" $fpm_config = "${version_config_root}/php-fpm.conf" $fpm_pool_config_dir = "${version_config_root}/pool.d" - $pid_file = "${php::config::datadir}/${patch_version}.pid" + $pid_file = "${php::config::datadir}/${patch_php_version}.pid" # Log files - $error_log = "${php::config::logdir}/${patch_version}.fpm.error.log" + $error_log = "${php::config::logdir}/${patch_php_version}.fpm.error.log" if $ensure == present { # Require php version eg. php::version { '5_4_10': } # This will compile, install and set up config dirs if not present - php_require($patch_version) + php_require($patch_php_version) # FPM Binary - $bin = "${php::config::root}/versions/${patch_version}/sbin/php-fpm" + $bin = "${php::config::root}/versions/${patch_php_version}/sbin/php-fpm" # Set up FPM config file { $fpm_config: content => template('php/php-fpm.conf.erb'), - notify => Php::Fpm::Service[$patch_version], + notify => Php::Fpm::Service[$patch_php_version], } # Set up FPM Pool config directory @@ -62,8 +47,8 @@ # Create a default pool, as FPM won't start without one # Listen on a fake socket for now - $pool_name = $patch_version - $socket_path = "${boxen::config::socketdir}/${patch_version}" + $pool_name = $patch_php_version + $socket_path = "${boxen::config::socketdir}/${patch_php_version}" $pm = 'static' $max_children = 1 @@ -72,15 +57,15 @@ $min_spare_servers = 1 $max_spare_servers = 1 - file { "${fpm_pool_config_dir}/${patch_version}.conf": + file { "${fpm_pool_config_dir}/${patch_php_version}.conf": content => template('php/php-fpm-pool.conf.erb'), } # Launch our FPM Service - php::fpm::service{ $patch_version: + php::fpm::service{ $patch_php_version: ensure => running, - subscribe => File["${fpm_pool_config_dir}/${patch_version}.conf"], + subscribe => File["${fpm_pool_config_dir}/${patch_php_version}.conf"], } } else { @@ -93,10 +78,10 @@ $fpm_pool_config_dir, ]: ensure => absent, - require => Php::Fpm::Service[$patch_version], + require => Php::Fpm::Service[$patch_php_version], } - php::fpm::service{ $patch_version: + php::fpm::service{ $patch_php_version: ensure => absent, } } diff --git a/manifests/global.pp b/manifests/global.pp index 32b9b31..57f16c9 100644 --- a/manifests/global.pp +++ b/manifests/global.pp @@ -7,20 +7,17 @@ class php::global($version = undef) { include php::config - # Default to latest version of PHP 5 if not specified - $php_version = $version ? { - undef => 5, - default => $version - } + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($version) - if $version != 'system' { - php_require($version) + if $patch_php_version != 'system' { + php_require($patch_php_version) } file { "${php::config::root}/version": ensure => present, owner => $::boxen_user, mode => '0644', - content => "${version}\n", + content => "${patch_php_version}\n", } } diff --git a/manifests/local.pp b/manifests/local.pp index 12ec33c..c79bbbc 100644 --- a/manifests/local.pp +++ b/manifests/local.pp @@ -8,14 +8,17 @@ define php::local($version = undef, $ensure = present) { include php::config - if $version != 'system' and $ensure == present { + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($version) + + if $patch_php_version != 'system' and $ensure == present { # Requires php version eg. php::5_4_10 - php_require($version) + php_require($patch_php_version) } file { "${name}/.php-version": ensure => $ensure, - content => "${version}\n", + content => "${patch_php_version}\n", replace => true } } diff --git a/manifests/project.pp b/manifests/project.pp index 70d90a0..0c088c8 100644 --- a/manifests/project.pp +++ b/manifests/project.pp @@ -195,22 +195,25 @@ } if $php { + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($php) + # Set the local version of PHP php::local { $repo_dir: - version => $php, + version => $patch_php_version, require => Repository[$repo_dir], } # Spin up a PHP-FPM pool for this project, listening on an Nginx socket - php::fpm::pool { "${name}-${php}": - version => $php, + php::fpm::pool { "${name}-${patch_php_version}": + version => $patch_php_version, socket_path => "${boxen::config::socketdir}/${name}", require => File["${nginx::config::sitesdir}/${name}.conf"], max_children => 10, } if $fpm_pool { - Php::Fpm::Pool["${name}-${php}"] { + Php::Fpm::Pool["${name}-${patch_php_version}"] { fpm_pool => $fpm_pool } } diff --git a/manifests/version.pp b/manifests/version.pp index 9c8a9a7..6775cb2 100644 --- a/manifests/version.pp +++ b/manifests/version.pp @@ -11,47 +11,17 @@ require php include mysql::config - # Current supported and secure versions - $secure_5_6 = $php::config::secure_versions['5.6'] - $secure_5_5 = $php::config::secure_versions['5.5'] - $secure_5_4 = $php::config::secure_versions['5.4'] - - # Specify secure version if no minor point specified - if $version == '5' { - $patch_version = $secure_5_6 - } elsif $version == '5.6' { - $patch_version = $secure_5_6 - } elsif $version == '5.5' { - $patch_version = $secure_5_5 - } elsif $version == '5.4' { - $patch_version = $secure_5_4 - } else { - $patch_version = $version - } - - # Version is greater than or equal to 5.6.0 and less than the 5.6 secure version - if $php::config::secure_warning and versioncmp($patch_version, '5.6') >= 0 and versioncmp($patch_version, $secure_5_6) < 0 { - warning("You are installing PHP ${patch_version} which is known to be insecure. The current secure 5.6.X version is ${secure_5_6}") - } - - # Version is greater than or equal to 5.5.0 and less than the 5.5 secure version - if $php::config::secure_warning and versioncmp($patch_version, '5.5') >= 0 and versioncmp($patch_version, $secure_5_5) < 0 { - warning("You are installing PHP ${patch_version} which is known to be insecure. The current secure 5.5.X version is ${secure_5_5}") - } - - # Version is less than the minimum secure version - if $php::config::secure_warning and versioncmp($patch_version, $secure_5_4) < 0 { - warning("You are installing PHP ${patch_version} which is known to be insecure. The current secure 5.4.X version is ${secure_5_4}") - } + # Get full patch version of PHP + $patch_php_version = php_get_patch_version($version, true) # Install location - $dest = "${php::config::root}/versions/${patch_version}" + $dest = "${php::config::root}/versions/${patch_php_version}" # Log locations - $error_log = "${php::config::logdir}/${patch_version}.error.log" + $error_log = "${php::config::logdir}/${patch_php_version}.error.log" # Config locations - $version_config_root = "${php::config::configdir}/${patch_version}" + $version_config_root = "${php::config::configdir}/${patch_php_version}" $php_ini = "${version_config_root}/php.ini" $conf_d = "${version_config_root}/conf.d" @@ -59,14 +29,14 @@ $module_dir = "${dest}/modules" # Data directory for this version - $version_data_root = "${php::config::datadir}/${patch_version}" + $version_data_root = "${php::config::datadir}/${patch_php_version}" if $ensure == 'absent' { # If we're nuking a version of PHP also ensure we shut down # and get rid of the PHP FPM Service & config - php::fpm { $patch_version: + php::fpm { $patch_php_version: ensure => 'absent' } @@ -102,7 +72,7 @@ # Ensure module dir is created for extensions AFTER php is installed file { $module_dir: ensure => directory, - require => Php_version[$patch_version], + require => Php_version[$patch_php_version], } # Set up config files @@ -121,15 +91,15 @@ # Get any additional configure params $test_params = $php::config::configure_params - if is_hash($test_params) and has_key($test_params, $patch_version) { - $configure_params = $test_params[$patch_version] + if is_hash($test_params) and has_key($test_params, $patch_php_version) { + $configure_params = $test_params[$patch_php_version] } - php_version { $patch_version: + php_version { $patch_php_version: user => $::boxen_user, user_home => "/Users/${::boxen_user}", phpenv_root => $php::config::root, - version => $patch_version, + version => $patch_php_version, homebrew_path => $boxen::config::homebrewdir, require => [ Repository["${php::config::root}/php-src"], @@ -146,7 +116,7 @@ Package['openssl'], Package['curl'], ], - notify => Exec["phpenv-rehash-post-install-${patch_version}"], + notify => Exec["phpenv-rehash-post-install-${patch_php_version}"], configure_params => $configure_params, } @@ -156,13 +126,13 @@ owner => $::boxen_user, group => 'staff', recurse => true, - require => Php_version[$patch_version], + require => Php_version[$patch_php_version], } # Rehash phpenv shims when a new version is installed - exec { "phpenv-rehash-post-install-${patch_version}": + exec { "phpenv-rehash-post-install-${patch_php_version}": command => "/bin/rm -rf ${php::config::root}/shims && PHPENV_ROOT=${php::config::root} ${php::config::root}/bin/phpenv rehash", - require => Php_version[$patch_version], + require => Php_version[$patch_php_version], refreshonly => true, } @@ -175,31 +145,31 @@ } # Set cache_dir for PEAR - exec { "pear-${patch_version}-cache_dir": + exec { "pear-${patch_php_version}-cache_dir": command => "${dest}/bin/pear config-set cache_dir ${php::config::datadir}/pear", unless => "${dest}/bin/pear config-get cache_dir | grep -i ${php::config::datadir}/pear", require => [ - Php_version[$patch_version], + Php_version[$patch_php_version], File["${php::config::datadir}/pear"], ], } # Set download_dir for PEAR - exec { "pear-${patch_version}-download_dir": + exec { "pear-${patch_php_version}-download_dir": command => "${dest}/bin/pear config-set download_dir ${php::config::datadir}/pear", unless => "${dest}/bin/pear config-get download_dir | grep -i ${php::config::datadir}/pear", require => [ - Php_version[$patch_version], + Php_version[$patch_php_version], File["${php::config::datadir}/pear"], ], } # Set temp_dir for PEAR - exec { "pear-${patch_version}-temp_dir": + exec { "pear-${patch_php_version}-temp_dir": command => "${dest}/bin/pear config-set temp_dir ${php::config::datadir}/pear", unless => "${dest}/bin/pear config-get temp_dir | grep -i ${php::config::datadir}/pear", require => [ - Php_version[$patch_version], + Php_version[$patch_php_version], File["${php::config::datadir}/pear"], ], } diff --git a/spec/classes/php_composer_spec.rb b/spec/classes/php_composer_spec.rb index edb4729..945a050 100644 --- a/spec/classes/php_composer_spec.rb +++ b/spec/classes/php_composer_spec.rb @@ -7,8 +7,8 @@ should contain_class("php") should contain_exec("download-php-composer").with({ - :command => "curl -sS -o /test/boxen/phpenv/bin/composer https://getcomposer.org/download/1.0.0-alpha9/composer.phar", - :unless => "[ -f /test/boxen/phpenv/bin/composer ] && [ \"`md5 -q /test/boxen/phpenv/bin/composer`\" = \"05df355b5277c8c9012470e699fa5494\" ]", + :command => "curl -sS -o /test/boxen/phpenv/bin/composer https://getcomposer.org/download/1.2.1/composer.phar", + :unless => "[ -f /test/boxen/phpenv/bin/composer ] && [ \"`md5 -q /test/boxen/phpenv/bin/composer`\" = \"2e232b14055952d1c4e026fdec5ed882\" ]", :cwd => "/test/boxen/phpenv", :require => "Exec[phpenv-setup-root-repo]" }) diff --git a/spec/fixtures/hiera/test.yaml b/spec/fixtures/hiera/test.yaml index 4cff9a1..bfa6490 100644 --- a/spec/fixtures/hiera/test.yaml +++ b/spec/fixtures/hiera/test.yaml @@ -8,12 +8,13 @@ php::config::cachedir: "/test/boxen/data/php/cache" php::config::extensioncachedir: "/test/boxen/data/php/cache/extensions" php::config::configure_params: {} php::config::composer: - version: '1.0.0-alpha9' - checksum: '05df355b5277c8c9012470e699fa5494' + version: '1.2.1' + checksum: '2e232b14055952d1c4e026fdec5ed882' php::config::phpenv: revision: '6499bb6c7b645af3f4e67f7e17708d5ee208453f' php::config::secure_versions: - '5.6': '5.6.9' - '5.5': '5.5.25' - '5.4': '5.4.41' + '7.1': '7.1.3' + '7.0': '7.0.17' + '5.6': '5.6.30' + '5.5': '5.5.38' php::config::secure_warning: true diff --git a/spec/lib/puppet/parser/functions/php_fpm_require_spec.rb b/spec/lib/puppet/parser/functions/php_fpm_require_spec.rb index f861b8b..1a3fad5 100644 --- a/spec/lib/puppet/parser/functions/php_fpm_require_spec.rb +++ b/spec/lib/puppet/parser/functions/php_fpm_require_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "the php_fpm_require function" do +describe 'php_fpm_require', :type => :puppet_function do before :all do Puppet::Parser::Functions.autoloader.loadall end @@ -8,4 +8,8 @@ it "should exist" do Puppet::Parser::Functions.function("php_fpm_require").should == "function_php_fpm_require" end + + it do + should run.with_params('5.6.15') + end end diff --git a/spec/lib/puppet/parser/functions/php_get_patch_version_spec.rb b/spec/lib/puppet/parser/functions/php_get_patch_version_spec.rb new file mode 100644 index 0000000..f7fb2db --- /dev/null +++ b/spec/lib/puppet/parser/functions/php_get_patch_version_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe 'php_get_patch_version', :type => :puppet_function do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end + + it "should exist" do + Puppet::Parser::Functions.function("php_get_patch_version").should == "function_php_get_patch_version" + end + + it do + should run.with_params('7').and_return('7.1.3') + should run.with_params('7.1').and_return('7.1.3') + should run.with_params('7.0').and_return('7.0.17') + should run.with_params('7.0.2').and_return('7.0.2') + should run.with_params('5').and_return('5.6.30') + should run.with_params('5.6').and_return('5.6.30') + should run.with_params('5.6.15').and_return('5.6.15') + should run.with_params('5.5').and_return('5.5.38') + should run.with_params('5.5.2').and_return('5.5.2') + should run.with_params('system').and_return('system') + end +end diff --git a/spec/lib/puppet/parser/functions/php_require_spec.rb b/spec/lib/puppet/parser/functions/php_require_spec.rb index 6145659..b3a9f7a 100644 --- a/spec/lib/puppet/parser/functions/php_require_spec.rb +++ b/spec/lib/puppet/parser/functions/php_require_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "the php_require function" do +describe 'php_require', :type => :puppet_function do before :all do Puppet::Parser::Functions.autoloader.loadall end @@ -8,4 +8,8 @@ it "should exist" do Puppet::Parser::Functions.function("php_require").should == "function_php_require" end + + it do + should run.with_params('5.6.15') + end end