Skip to content

Commit

Permalink
Merge pull request #69 from mrrobot47/update/php
Browse files Browse the repository at this point in the history
Update php version support
  • Loading branch information
mrrobot47 committed Dec 17, 2019
2 parents 320c764 + 95467dc commit 7eddef1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
15 changes: 6 additions & 9 deletions src/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,15 @@ public function __construct() {
* : Create separate db container instead of using global db.
*
* [--php=<php-version>]
* : PHP version for site. Currently only supports PHP 5.6 and latest.
* : PHP version for site. Currently only supports PHP 5.6, 7.0, 7.2, 7.3, 7.4 and latest.
* ---
* default: latest
* options:
* - 5.6
* - 7.0
* - 7.2
* - 7.3
* - 7.4
* - latest
* ---
*
Expand Down Expand Up @@ -201,22 +202,22 @@ public function create( $args, $assoc_args ) {
}
}

$supported_php_versions = [ 5.6, 7.0, 7.2, 7.3, 'latest' ];
$supported_php_versions = [ 5.6, 7.0, 7.2, 7.3, 7.4, 'latest' ];
if ( ! in_array( $this->site_data['php_version'], $supported_php_versions ) ) {
$old_version = $this->site_data['php_version'];
$floor = (int) floor( $this->site_data['php_version'] );
if ( 5 === $floor ) {
$this->site_data['php_version'] = 5.6;
} elseif ( 7 === $floor ) {
$this->site_data['php_version'] = 7.2;
$this->site_data['php_version'] = 7.3;
$old_version .= ' yet';
} else {
EE::error( 'Unsupported PHP version: ' . $this->site_data['php_version'] );
}
\EE::confirm( sprintf( 'EEv4 does not support PHP %s. Continue with PHP %s?', $old_version, $this->site_data['php_version'] ) );
}

$this->site_data['php_version'] = ( 7.2 === (double) $this->site_data['php_version'] ) ? 'latest' : $this->site_data['php_version'];
$this->site_data['php_version'] = ( 7.3 === (double) $this->site_data['php_version'] ) ? 'latest' : $this->site_data['php_version'];

if ( $this->cache_type && ! $local_cache ) {
\EE\Service\Utils\init_global_container( GLOBAL_REDIS );
Expand Down Expand Up @@ -378,12 +379,8 @@ private function configure_site_files() {

$default_conf_content = $this->generate_default_conf( $this->cache_type, $server_name );

$php_ini_data = [
'admin_email' => $this->site_data['app_admin_email'],
];

$env_content = \EE\Utils\mustache_render( SITE_PHP_TEMPLATE_ROOT . '/config/.env.mustache', $env_data );
$php_ini_content = \EE\Utils\mustache_render( SITE_PHP_TEMPLATE_ROOT . '/config/php-fpm/php.ini.mustache', $php_ini_data );
$php_ini_content = file_get_contents( SITE_WP_TEMPLATE_ROOT . '/config/php-fpm/php.ini.mustache' );

try {
$this->dump_docker_compose_yml( [ 'nohttps' => true ] );
Expand Down
2 changes: 1 addition & 1 deletion templates/config/php-fpm/php.ini.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ upload_max_filesize = 100M
post_max_size = 100M

[mail function]
sendmail_path = /usr/sbin/sendmail -t -i -f {{admin_email}}
sendmail_path = /usr/bin/msmtp -t

0 comments on commit 7eddef1

Please sign in to comment.