Skip to content

Commit 18db931

Browse files
authored
[#2440] Namespaced variable names in settings files. (#2442)
1 parent fd0f825 commit 18db931

13 files changed

Lines changed: 79 additions & 72 deletions

File tree

.vortex/CLAUDE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ When updating template scripts:
7373
4. Update BATS tests in `.vortex/tests/bats/`
7474
5. Run `ahoy update-snapshots` (requires permission)
7575

76+
When updating template files (settings, configs, etc.):
77+
78+
1. Make and commit code changes first
79+
2. Then run `ahoy update-snapshots` (requires permission) — snapshots
80+
compare against the committed baseline, so uncommitted changes will
81+
not be picked up correctly
82+
7683
## Environment Variables
7784

7885
| Variable | Purpose |

.vortex/installer/tests/Fixtures/handler_process/_baseline/web/sites/default/includes/modules/settings.shield.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
// Allow ACME challenge path for Let's Encrypt certificate generation.
5050
if (!empty(getenv('DRUPAL_SHIELD_ALLOW_ACME_CHALLENGE'))) {
5151
$config['shield.settings']['method'] = 0;
52-
$acme_path = '/.well-known/acme-challenge/*';
53-
$existing = $config['shield.settings']['paths'] ?? '';
54-
$config['shield.settings']['paths'] = str_contains($existing, $acme_path) ? $existing : trim($existing . "\n" . $acme_path);
52+
$shield_acme_path = '/.well-known/acme-challenge/*';
53+
$shield_existing_paths = $config['shield.settings']['paths'] ?? '';
54+
$config['shield.settings']['paths'] = str_contains($shield_existing_paths, $shield_acme_path) ? $shield_existing_paths : trim($shield_existing_paths . "\n" . $shield_acme_path);
5555
}

.vortex/installer/tests/Fixtures/handler_process/_baseline/web/sites/default/includes/modules/settings.stage_file_proxy.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
declare(strict_types=1);
99

10-
$origin = getenv('DRUPAL_STAGE_FILE_PROXY_ORIGIN');
11-
if (!empty($origin) && $settings['environment'] !== ENVIRONMENT_PROD) {
12-
$user = getenv('DRUPAL_SHIELD_USER');
13-
$pass = getenv('DRUPAL_SHIELD_PASS');
14-
if (!empty($user) && !empty($pass)) {
15-
$origin = str_replace('https://', sprintf('https://%s:%s@', $user, $pass), $origin);
10+
$stage_file_proxy_origin = getenv('DRUPAL_STAGE_FILE_PROXY_ORIGIN');
11+
if (!empty($stage_file_proxy_origin) && $settings['environment'] !== ENVIRONMENT_PROD) {
12+
$stage_file_proxy_user = getenv('DRUPAL_SHIELD_USER');
13+
$stage_file_proxy_pass = getenv('DRUPAL_SHIELD_PASS');
14+
if (!empty($stage_file_proxy_user) && !empty($stage_file_proxy_pass)) {
15+
$stage_file_proxy_origin = str_replace('https://', sprintf('https://%s:%s@', $stage_file_proxy_user, $stage_file_proxy_pass), $stage_file_proxy_origin);
1616
}
1717

18-
$config['stage_file_proxy.settings']['origin'] = $origin;
18+
$config['stage_file_proxy.settings']['origin'] = $stage_file_proxy_origin;
1919
$config['stage_file_proxy.settings']['hotlink'] = FALSE;
2020
}

.vortex/installer/tests/Fixtures/handler_process/_baseline/web/sites/default/includes/modules/settings.trusted_hosts.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
declare(strict_types=1);
1212

1313
// Add custom domains to trusted host patterns if specified.
14-
$trusted_hosts = getenv('DRUPAL_TRUSTED_HOSTS');
15-
if (!empty($trusted_hosts)) {
16-
$domains = array_map(trim(...), explode(',', $trusted_hosts));
17-
foreach ($domains as $domain) {
18-
if (!empty($domain)) {
19-
$domain = strtolower($domain);
20-
$escaped_domain = preg_quote($domain, '/');
21-
$settings['trusted_host_patterns'][] = '^' . $escaped_domain . '$';
14+
$trusted_hosts_value = getenv('DRUPAL_TRUSTED_HOSTS');
15+
if (!empty($trusted_hosts_value)) {
16+
$trusted_hosts_domains = array_map(trim(...), explode(',', $trusted_hosts_value));
17+
foreach ($trusted_hosts_domains as $trusted_host_domain) {
18+
if (!empty($trusted_host_domain)) {
19+
$trusted_host_domain = strtolower($trusted_host_domain);
20+
$trusted_hosts_escaped = preg_quote($trusted_host_domain, '/');
21+
$settings['trusted_host_patterns'][] = '^' . $trusted_hosts_escaped . '$';
2222
}
2323
}
2424
}

.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/docroot/sites/default/includes/modules/settings.shield.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
// Allow ACME challenge path for Let's Encrypt certificate generation.
5050
if (!empty(getenv('DRUPAL_SHIELD_ALLOW_ACME_CHALLENGE'))) {
5151
$config['shield.settings']['method'] = 0;
52-
$acme_path = '/.well-known/acme-challenge/*';
53-
$existing = $config['shield.settings']['paths'] ?? '';
54-
$config['shield.settings']['paths'] = str_contains($existing, $acme_path) ? $existing : trim($existing . "\n" . $acme_path);
52+
$shield_acme_path = '/.well-known/acme-challenge/*';
53+
$shield_existing_paths = $config['shield.settings']['paths'] ?? '';
54+
$config['shield.settings']['paths'] = str_contains($shield_existing_paths, $shield_acme_path) ? $shield_existing_paths : trim($shield_existing_paths . "\n" . $shield_acme_path);
5555
}

.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/docroot/sites/default/includes/modules/settings.stage_file_proxy.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
declare(strict_types=1);
99

10-
$origin = getenv('DRUPAL_STAGE_FILE_PROXY_ORIGIN');
11-
if (!empty($origin) && $settings['environment'] !== ENVIRONMENT_PROD) {
12-
$user = getenv('DRUPAL_SHIELD_USER');
13-
$pass = getenv('DRUPAL_SHIELD_PASS');
14-
if (!empty($user) && !empty($pass)) {
15-
$origin = str_replace('https://', sprintf('https://%s:%s@', $user, $pass), $origin);
10+
$stage_file_proxy_origin = getenv('DRUPAL_STAGE_FILE_PROXY_ORIGIN');
11+
if (!empty($stage_file_proxy_origin) && $settings['environment'] !== ENVIRONMENT_PROD) {
12+
$stage_file_proxy_user = getenv('DRUPAL_SHIELD_USER');
13+
$stage_file_proxy_pass = getenv('DRUPAL_SHIELD_PASS');
14+
if (!empty($stage_file_proxy_user) && !empty($stage_file_proxy_pass)) {
15+
$stage_file_proxy_origin = str_replace('https://', sprintf('https://%s:%s@', $stage_file_proxy_user, $stage_file_proxy_pass), $stage_file_proxy_origin);
1616
}
1717

18-
$config['stage_file_proxy.settings']['origin'] = $origin;
18+
$config['stage_file_proxy.settings']['origin'] = $stage_file_proxy_origin;
1919
$config['stage_file_proxy.settings']['hotlink'] = FALSE;
2020
}

.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/docroot/sites/default/includes/modules/settings.trusted_hosts.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
declare(strict_types=1);
1212

1313
// Add custom domains to trusted host patterns if specified.
14-
$trusted_hosts = getenv('DRUPAL_TRUSTED_HOSTS');
15-
if (!empty($trusted_hosts)) {
16-
$domains = array_map(trim(...), explode(',', $trusted_hosts));
17-
foreach ($domains as $domain) {
18-
if (!empty($domain)) {
19-
$domain = strtolower($domain);
20-
$escaped_domain = preg_quote($domain, '/');
21-
$settings['trusted_host_patterns'][] = '^' . $escaped_domain . '$';
14+
$trusted_hosts_value = getenv('DRUPAL_TRUSTED_HOSTS');
15+
if (!empty($trusted_hosts_value)) {
16+
$trusted_hosts_domains = array_map(trim(...), explode(',', $trusted_hosts_value));
17+
foreach ($trusted_hosts_domains as $trusted_host_domain) {
18+
if (!empty($trusted_host_domain)) {
19+
$trusted_host_domain = strtolower($trusted_host_domain);
20+
$trusted_hosts_escaped = preg_quote($trusted_host_domain, '/');
21+
$settings['trusted_host_patterns'][] = '^' . $trusted_hosts_escaped . '$';
2222
}
2323
}
2424
}

.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/docroot/sites/default/includes/modules/settings.shield.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
// Allow ACME challenge path for Let's Encrypt certificate generation.
5050
if (!empty(getenv('DRUPAL_SHIELD_ALLOW_ACME_CHALLENGE'))) {
5151
$config['shield.settings']['method'] = 0;
52-
$acme_path = '/.well-known/acme-challenge/*';
53-
$existing = $config['shield.settings']['paths'] ?? '';
54-
$config['shield.settings']['paths'] = str_contains($existing, $acme_path) ? $existing : trim($existing . "\n" . $acme_path);
52+
$shield_acme_path = '/.well-known/acme-challenge/*';
53+
$shield_existing_paths = $config['shield.settings']['paths'] ?? '';
54+
$config['shield.settings']['paths'] = str_contains($shield_existing_paths, $shield_acme_path) ? $shield_existing_paths : trim($shield_existing_paths . "\n" . $shield_acme_path);
5555
}

.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/docroot/sites/default/includes/modules/settings.stage_file_proxy.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
declare(strict_types=1);
99

10-
$origin = getenv('DRUPAL_STAGE_FILE_PROXY_ORIGIN');
11-
if (!empty($origin) && $settings['environment'] !== ENVIRONMENT_PROD) {
12-
$user = getenv('DRUPAL_SHIELD_USER');
13-
$pass = getenv('DRUPAL_SHIELD_PASS');
14-
if (!empty($user) && !empty($pass)) {
15-
$origin = str_replace('https://', sprintf('https://%s:%s@', $user, $pass), $origin);
10+
$stage_file_proxy_origin = getenv('DRUPAL_STAGE_FILE_PROXY_ORIGIN');
11+
if (!empty($stage_file_proxy_origin) && $settings['environment'] !== ENVIRONMENT_PROD) {
12+
$stage_file_proxy_user = getenv('DRUPAL_SHIELD_USER');
13+
$stage_file_proxy_pass = getenv('DRUPAL_SHIELD_PASS');
14+
if (!empty($stage_file_proxy_user) && !empty($stage_file_proxy_pass)) {
15+
$stage_file_proxy_origin = str_replace('https://', sprintf('https://%s:%s@', $stage_file_proxy_user, $stage_file_proxy_pass), $stage_file_proxy_origin);
1616
}
1717

18-
$config['stage_file_proxy.settings']['origin'] = $origin;
18+
$config['stage_file_proxy.settings']['origin'] = $stage_file_proxy_origin;
1919
$config['stage_file_proxy.settings']['hotlink'] = FALSE;
2020
}

.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/docroot/sites/default/includes/modules/settings.trusted_hosts.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
declare(strict_types=1);
1212

1313
// Add custom domains to trusted host patterns if specified.
14-
$trusted_hosts = getenv('DRUPAL_TRUSTED_HOSTS');
15-
if (!empty($trusted_hosts)) {
16-
$domains = array_map(trim(...), explode(',', $trusted_hosts));
17-
foreach ($domains as $domain) {
18-
if (!empty($domain)) {
19-
$domain = strtolower($domain);
20-
$escaped_domain = preg_quote($domain, '/');
21-
$settings['trusted_host_patterns'][] = '^' . $escaped_domain . '$';
14+
$trusted_hosts_value = getenv('DRUPAL_TRUSTED_HOSTS');
15+
if (!empty($trusted_hosts_value)) {
16+
$trusted_hosts_domains = array_map(trim(...), explode(',', $trusted_hosts_value));
17+
foreach ($trusted_hosts_domains as $trusted_host_domain) {
18+
if (!empty($trusted_host_domain)) {
19+
$trusted_host_domain = strtolower($trusted_host_domain);
20+
$trusted_hosts_escaped = preg_quote($trusted_host_domain, '/');
21+
$settings['trusted_host_patterns'][] = '^' . $trusted_hosts_escaped . '$';
2222
}
2323
}
2424
}

0 commit comments

Comments
 (0)