Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/helper/class-ee-site.php
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ protected function www_ssl_wrapper( $containers_to_start = [], $site_enable = fa
*
* @throws \Exception
*/
protected function inherit_certs( $site_url ) {
protected function check_parent_site_certs( $site_url ) {

$parent_site_name = implode( '.', array_slice( explode( '.', $site_url ), 1 ) );
$parent_site = Site::find( $parent_site_name, [ 'site_ssl', 'site_ssl_wildcard' ] );
Expand All @@ -744,9 +744,6 @@ protected function inherit_certs( $site_url ) {
if ( ! $parent_site->site_ssl_wildcard ) {
throw new \Exception( "Cannot inherit from $parent_site_name as site does not have wildcard SSL cert" );
}

// We don't have to do anything now as nginx-proxy handles everything for us.
\EE::success( 'Inherited certs from parent' );
}

/**
Expand All @@ -771,8 +768,8 @@ protected function init_ssl( $site_url, $site_fs_path, $ssl_type, $wildcard = fa
if ( $wildcard ) {
throw new \Exception( 'Cannot use --wildcard with --ssl=inherit', false );
}
\EE::debug( 'Inheriting certs' );
$this->inherit_certs( $site_url );
// We don't have to do anything now as nginx-proxy handles everything for us.
EE::success( 'Inherited certs from parent' );
} elseif ( 'self' === $ssl_type ) {
$client = new Site_Self_signed();
$client->create_certificate( $site_url );
Expand Down
4 changes: 4 additions & 0 deletions src/site-type/html.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ private function create_site() {
$this->site_data['site_fs_path'] = WEBROOT . $this->site_data['site_url'];
$this->level = 1;
try {
if ( 'inherit' === $this->site_data['site_ssl'] ) {
$this->check_parent_site_certs( $this->site_data['site_url'] );
}

\EE\Site\Utils\create_site_root( $this->site_data['site_fs_path'], $this->site_data['site_url'] );
$this->level = 3;
$this->configure_site_files();
Expand Down