Skip to content

Commit 009e64f

Browse files
committed
Merge branch 'develop' for v1.6.2
2 parents e5067c5 + c703981 commit 009e64f

File tree

1 file changed

+30
-20
lines changed

1 file changed

+30
-20
lines changed

src/WordPress.php

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,14 @@ public function __construct() {
111111
* [--admin-user=<admin-user>]
112112
* : Username of the administrator.
113113
*
114+
* [--admin-email=<admin-email>]
115+
* : E-Mail of the administrator.
116+
*
114117
* [--admin-pass=<admin-pass>]
115118
* : Password for the the administrator.
116119
*
117-
* [--admin-email=<admin-email>]
118-
* : E-Mail of the administrator.
120+
* [--allow-insecure-pass]
121+
* : Allow insecure password for the the administrator.
119122
*
120123
* [--local-db]
121124
* : Create separate db container instead of using global db.
@@ -292,23 +295,24 @@ public function create( $args, $assoc_args ) {
292295
$alias_domain_to_check[] = $this->site_data['site_url'];
293296
check_alias_in_db( $alias_domain_to_check );
294297

295-
$this->site_data['site_fs_path'] = WEBROOT . $this->site_data['site_url'];
296-
$this->cache_type = \EE\Utils\get_flag_value( $assoc_args, 'cache' );
297-
$wildcard_flag = \EE\Utils\get_flag_value( $assoc_args, 'wildcard' );
298-
$this->site_data['site_ssl_wildcard'] = 'subdom' === $this->site_data['app_sub_type'] || $wildcard_flag ? true : false;
299-
$this->site_data['php_version'] = \EE\Utils\get_flag_value( $assoc_args, 'php', 'latest' );
300-
$this->site_data['app_admin_url'] = \EE\Utils\get_flag_value( $assoc_args, 'title', $this->site_data['site_url'] );
301-
$this->site_data['app_admin_username'] = \EE\Utils\get_flag_value( $assoc_args, 'admin-user', \EE\Utils\random_name_generator() );
302-
$this->site_data['app_admin_password'] = \EE\Utils\get_flag_value( $assoc_args, 'admin-pass', '' );
303-
$this->site_data['db_name'] = \EE\Utils\get_flag_value( $assoc_args, 'dbname', str_replace( [ '.', '-' ], '_', $this->site_data['site_url'] ) );
304-
$this->site_data['db_host'] = \EE\Utils\get_flag_value( $assoc_args, 'dbhost', GLOBAL_DB );
305-
$this->site_data['db_port'] = '3306';
306-
$this->site_data['db_user'] = \EE\Utils\get_flag_value( $assoc_args, 'dbuser', $this->create_site_db_user( $this->site_data['site_url'] ) );
307-
$this->site_data['db_password'] = \EE\Utils\get_flag_value( $assoc_args, 'dbpass', \EE\Utils\random_password() );
308-
$this->site_data['proxy_cache'] = \EE\Utils\get_flag_value( $assoc_args, 'proxy-cache' );
309-
$this->locale = \EE\Utils\get_flag_value( $assoc_args, 'locale', \EE::get_config( 'locale' ) );
310-
$local_cache = \EE\Utils\get_flag_value( $assoc_args, 'with-local-redis' );
311-
$this->site_data['cache_host'] = '';
298+
$this->site_data['site_fs_path'] = WEBROOT . $this->site_data['site_url'];
299+
$this->cache_type = \EE\Utils\get_flag_value( $assoc_args, 'cache' );
300+
$wildcard_flag = \EE\Utils\get_flag_value( $assoc_args, 'wildcard' );
301+
$this->site_data['site_ssl_wildcard'] = 'subdom' === $this->site_data['app_sub_type'] || $wildcard_flag ? true : false;
302+
$this->site_data['php_version'] = \EE\Utils\get_flag_value( $assoc_args, 'php', 'latest' );
303+
$this->site_data['app_admin_url'] = \EE\Utils\get_flag_value( $assoc_args, 'title', $this->site_data['site_url'] );
304+
$this->site_data['app_admin_username'] = \EE\Utils\get_flag_value( $assoc_args, 'admin-user', \EE\Utils\random_name_generator() );
305+
$this->site_data['app_admin_password'] = \EE\Utils\get_flag_value( $assoc_args, 'admin-pass', '' );
306+
$this->site_data['allow_insecure_pass'] = \EE\Utils\get_flag_value( $assoc_args, 'allow-insecure-pass', false );
307+
$this->site_data['db_name'] = \EE\Utils\get_flag_value( $assoc_args, 'dbname', str_replace( [ '.', '-' ], '_', $this->site_data['site_url'] ) );
308+
$this->site_data['db_host'] = \EE\Utils\get_flag_value( $assoc_args, 'dbhost', GLOBAL_DB );
309+
$this->site_data['db_port'] = '3306';
310+
$this->site_data['db_user'] = \EE\Utils\get_flag_value( $assoc_args, 'dbuser', $this->create_site_db_user( $this->site_data['site_url'] ) );
311+
$this->site_data['db_password'] = \EE\Utils\get_flag_value( $assoc_args, 'dbpass', \EE\Utils\random_password() );
312+
$this->site_data['proxy_cache'] = \EE\Utils\get_flag_value( $assoc_args, 'proxy-cache' );
313+
$this->locale = \EE\Utils\get_flag_value( $assoc_args, 'locale', \EE::get_config( 'locale' ) );
314+
$local_cache = \EE\Utils\get_flag_value( $assoc_args, 'with-local-redis' );
315+
$this->site_data['cache_host'] = '';
312316
if ( 'on' === $this->site_data['proxy_cache'] ) {
313317
$this->cache_type = true;
314318
}
@@ -318,7 +322,7 @@ public function create( $args, $assoc_args ) {
318322

319323
if ( empty( $this->site_data['app_admin_password'] ) ) {
320324
$this->site_data['app_admin_password'] = \EE\Utils\random_password( 18 );
321-
} else {
325+
} elseif ( ! $this->site_data['allow_insecure_pass'] ) {
322326
$pass_error_msg = [];
323327
if ( strlen( $this->site_data['app_admin_password'] ) < 8 ) {
324328
$pass_error_msg[] = "Password too short! Must be at least 8 characters long.";
@@ -1206,6 +1210,12 @@ private function install_wp() {
12061210
throw new \Exception( 'WordPress install failed. Please check logs.' );
12071211
}
12081212

1213+
$env_type = \EE::get_runner()->config['env'];
1214+
$env_type = in_array( $env_type, [ 'production', 'staging', 'development', 'local' ] ) ? $env_type : '';
1215+
if ( ! empty( $env_type ) ) {
1216+
EE::exec( 'docker-compose exec --user=\'www-data\' php wp config set --type=constant WP_ENVIRONMENT_TYPE \'' . $env_type . '\' ' );
1217+
}
1218+
12091219
\EE::success( $prefix . $this->site_data['site_url'] . ' has been created successfully!' );
12101220
}
12111221

0 commit comments

Comments
 (0)