Skip to content

Commit 569ed56

Browse files
committed
Clean up wildcard files upfront to handle site type changes
Always remove _wildcard.site_url htpasswd and whitelist files at the start of regeneration. This ensures orphan wildcard files are cleaned up when a site changes from subdomain multisite to regular site type. Signed-off-by: Riddhesh Sanghvi <riddhesh237@gmail.com>
1 parent 63ac4fa commit 569ed56

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/Auth_Command.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,10 @@ private function generate_global_auth_files() {
300300
* @throws Exception
301301
*/
302302
private function generate_site_auth_files( string $site_url, $site_data = null ) {
303+
// Always clean up wildcard file first (handles site type changes from subdom to regular)
304+
$wildcard_file = EE_ROOT_DIR . '/services/nginx-proxy/htpasswd/_wildcard.' . $site_url;
305+
$this->fs->remove( $wildcard_file );
306+
303307
// Collect all domains to generate htpasswd files for
304308
$domains = [ $site_url ];
305309

@@ -401,6 +405,10 @@ private function generate_global_whitelist() {
401405
* @throws Exception
402406
*/
403407
private function generate_site_whitelist( string $site_url, $site_data = null ) {
408+
// Always clean up wildcard file first (handles site type changes from subdom to regular)
409+
$wildcard_file = EE_ROOT_DIR . '/services/nginx-proxy/vhost.d/_wildcard.' . $site_url . '_acl';
410+
$this->fs->remove( $wildcard_file );
411+
404412
// Collect all domains to generate whitelist files for
405413
$domains = [ $site_url ];
406414

0 commit comments

Comments
 (0)