Skip to content

Commit 9e9b17c

Browse files
committed
Use app_sub_type instead of db_host for db checks
1 parent 523cebb commit 9e9b17c

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.DS_Store
2-
wp-cli.local.yml
2+
ee-cli.local.yml
33
node_modules/
44
vendor/
55
*.zip

src/PHP.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ public function create( $args, $assoc_args ) {
137137
$this->cache_type = \EE\Utils\get_flag_value( $assoc_args, 'cache' );
138138
$this->site_data['site_ssl'] = \EE\Utils\get_flag_value( $assoc_args, 'ssl' );
139139
$this->site_data['site_ssl_wildcard'] = \EE\Utils\get_flag_value( $assoc_args, 'wildcard' );
140+
$this->site_data['app_sub_type'] = 'php';
140141

141142
if ( ! empty( $assoc_args['with-db'] ) ) {
143+
$this->site_data['app_sub_type'] = 'mysql';
142144
$this->site_data['db_name'] = str_replace( [ '.', '-' ], '_', $this->site_data['site_url'] );
143145
$this->site_data['db_host'] = \EE\Utils\get_flag_value( $assoc_args, 'dbhost', 'db' );
144146
$this->site_data['db_port'] = '3306';
@@ -204,7 +206,7 @@ public function info( $args, $assoc_args ) {
204206
$info[] = [ 'Access admin-tools', $prefix . $this->site_data['site_url'] . '/ee-admin/' ];
205207
}
206208

207-
if ( ! empty( $this->site_data['db_host'] ) ) {
209+
if ( 'mysql' === $this->site_data['app_sub_type'] ) {
208210
$info[] = [ 'DB Root Password', $this->site_data['db_root_password'] ];
209211
$info[] = [ 'DB Name', $this->site_data['db_name'] ];
210212
$info[] = [ 'DB User', $this->site_data['db_user'] ];
@@ -250,7 +252,7 @@ private function configure_site_files() {
250252
'group_id' => $process_user['gid'],
251253
];
252254

253-
if ( ! empty( $this->site_data['db_host'] ) ) {
255+
if ( 'mysql' === $this->site_data['app_sub_type'] ) {
254256
$filter[] = $this->site_data['db_host'];
255257
$local = ( 'db' === $this->site_data['db_host'] ) ? true : false;
256258
$db_host = $local ? $this->site_data['db_host'] : $this->site_data['db_host'] . ':' . $this->site_data['db_port'];
@@ -413,9 +415,10 @@ private function create_site_db_entry() {
413415
'site_ssl_wildcard' => $this->site_data['site_ssl_wildcard'] ? 1 : 0,
414416
'php_version' => '7.2',
415417
'created_on' => date( 'Y-m-d H:i:s', time() ),
418+
'app_sub_type' => $this->site_data['app_sub_type'],
416419
];
417420

418-
if ( ! empty( $this->site_data['db_host'] ) ) {
421+
if ( 'mysql' === $this->site_data['app_sub_type'] ) {
419422
$data['db_name'] = $this->site_data['db_name'];
420423
$data['db_user'] = $this->site_data['db_user'];
421424
$data['db_host'] = $this->site_data['db_host'];
@@ -461,7 +464,7 @@ public function restart( $args, $assoc_args, $whitelisted_containers = [] ) {
461464

462465
$whitelisted_containers = [ 'nginx', 'php' ];
463466

464-
if ( ! empty( $this->site_data['db_host'] ) ) {
467+
if ( 'mysql' === $this->site_data['app_sub_type'] ) {
465468
$whitelisted_containers[] = 'db';
466469
}
467470
parent::restart( $args, $assoc_args, $whitelisted_containers );

0 commit comments

Comments
 (0)