Skip to content

Commit

Permalink
Merge branch 'develop' for v1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mrrobot47 committed Jun 22, 2022
2 parents 25b401f + 6543fe2 commit 70c69bb
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
33 changes: 19 additions & 14 deletions src/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public function create( $args, $assoc_args ) {
if ( ! empty( $alias_domains ) ) {
$comma_seprated_domains = explode( ',', $alias_domains );
foreach ( $comma_seprated_domains as $domain ) {
$trimmed_domain = trim( $domain );
$trimmed_domain = trim( $domain );
$this->site_data['alias_domains'] .= $trimmed_domain . ',';
}
}
Expand All @@ -234,10 +234,10 @@ public function create( $args, $assoc_args ) {
$this->site_data['php_version'] = 5.6;
} elseif ( 7 === $floor ) {
$this->site_data['php_version'] = 7.4;
$old_version .= ' yet';
$old_version .= ' yet';
} elseif ( 8 === $floor ) {
$this->site_data['php_version'] = 8.0;
$old_version .= ' yet';
$old_version .= ' yet';
} else {
EE::error( 'Unsupported PHP version: ' . $this->site_data['php_version'] );
}
Expand All @@ -254,12 +254,15 @@ public function create( $args, $assoc_args ) {

$this->site_data['db_host'] = '';
if ( ! empty( $assoc_args['with-db'] ) ) {
$this->site_data['app_sub_type'] = 'mysql';
$this->site_data['db_name'] = \EE\Utils\get_flag_value( $assoc_args, 'dbname', str_replace( [ '.', '-' ], '_', $this->site_data['site_url'] ) );
$this->site_data['db_host'] = \EE\Utils\get_flag_value( $assoc_args, 'dbhost', GLOBAL_DB );
$this->site_data['db_port'] = '3306';
$this->site_data['db_user'] = \EE\Utils\get_flag_value( $assoc_args, 'dbuser', $this->create_site_db_user( $this->site_data['site_url'] ) );
$this->site_data['db_password'] = \EE\Utils\get_flag_value( $assoc_args, 'dbpass', \EE\Utils\random_password() );
$this->site_data['app_sub_type'] = 'mysql';
$this->site_data['db_name'] = \EE\Utils\get_flag_value( $assoc_args, 'dbname', str_replace( [
'.',
'-'
], '_', $this->site_data['site_url'] ) );
$this->site_data['db_host'] = \EE\Utils\get_flag_value( $assoc_args, 'dbhost', GLOBAL_DB );
$this->site_data['db_port'] = '3306';
$this->site_data['db_user'] = \EE\Utils\get_flag_value( $assoc_args, 'dbuser', $this->create_site_db_user( $this->site_data['site_url'] ) );
$this->site_data['db_password'] = \EE\Utils\get_flag_value( $assoc_args, 'dbpass', \EE\Utils\random_password() );

if ( $this->cache_type && ! $local_cache ) {
\EE\Service\Utils\init_global_container( GLOBAL_REDIS );
Expand Down Expand Up @@ -356,6 +359,7 @@ public function info( $args, $assoc_args ) {
$site = (array) Site::find( $this->site_data['site_url'] );
$site = reset( $site );
EE::log( json_encode( $site ) );

return;
}

Expand Down Expand Up @@ -419,8 +423,8 @@ private function configure_site_files() {
];

if ( 'mysql' === $this->site_data['app_sub_type'] ) {
$local = ( 'db' === $this->site_data['db_host'] ) ? true : false;
$db_host = $local ? $this->site_data['db_host'] : $this->site_data['db_host'] . ':' . $this->site_data['db_port'];
$local = ( 'db' === $this->site_data['db_host'] ) ? true : false;
$db_host = $local ? $this->site_data['db_host'] : $this->site_data['db_host'] . ':' . $this->site_data['db_port'];

$env_data['local'] = $local;
$env_data['root_password'] = $this->site_data['db_root_password'];
Expand All @@ -429,8 +433,8 @@ private function configure_site_files() {
$env_data['user_password'] = $this->site_data['db_password'];
}

$server_name = implode( ' ', explode( ',', $this->site_data['alias_domains'] ) );
$default_conf_content = $this->generate_default_conf( $this->cache_type, $server_name );
$server_name = implode( ' ', explode( ',', $this->site_data['alias_domains'] ) );
$default_conf_content = $this->generate_default_conf( $this->cache_type, $server_name );

$custom_ini = '5.6' === (string) $this->site_data['php_version'] ? 'php.ini-56.mustache' : 'php.ini.mustache';
$env_content = \EE\Utils\mustache_render( SITE_WP_TEMPLATE_ROOT . '/config/.env.mustache', $env_data );
Expand Down Expand Up @@ -482,6 +486,7 @@ private function configure_site_files() {
* Generate and place docker-compose.yml file.
*
* @param array $additional_filters Filters to alter docker-compose file.
*
* @ignorecommand
*/
public function dump_docker_compose_yml( $additional_filters = [] ) {
Expand Down Expand Up @@ -790,7 +795,7 @@ private function maybe_verify_remote_db_connection() {
*/
private function create_site( $assoc_args ) {

$this->level = 1;
$this->level = 1;
try {
if ( 'inherit' === $this->site_data['site_ssl'] ) {
$this->check_parent_site_certs( $this->site_data['site_url'] );
Expand Down
10 changes: 8 additions & 2 deletions src/Site_PHP_Docker.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ public function generate_docker_compose_yml( array $filters = [], $volumes ) {
$postfix['image'] = [ 'name' => 'easyengine/postfix:' . $img_versions['easyengine/postfix'] ];
$postfix['hostname'] = [ 'name' => '${VIRTUAL_HOST}' ];
$postfix['restart'] = $restart_default;
$postfix['environment'] = [
'env' => [
[ 'name' => 'RELAY_HOST' ],
[ 'name' => 'REPLY_EMAIL' ],
],
];
$postfix['labels'] = [
'label' => [
'name' => 'io.easyengine.site=${VIRTUAL_HOST}',
Expand Down Expand Up @@ -252,8 +258,8 @@ public function generate_docker_compose_yml( array $filters = [], $volumes ) {
}

$binding = [
'services' => $base,
'network' => $network,
'services' => $base,
'network' => $network,
];

if ( ! IS_DARWIN ) {
Expand Down
2 changes: 2 additions & 0 deletions templates/config/.env.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ VIRTUAL_HOST_EMAIL=example@{{virtual_host}}
USER_ID={{user_id}}
GROUP_ID={{group_id}}
NEWRELIC_LICENSE_KEY=
RELAY_HOST=
REPLY_EMAIL=
2 changes: 1 addition & 1 deletion templates/config/php-fpm/php.ini-56.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 [email protected]
sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]

0 comments on commit 70c69bb

Please sign in to comment.