File tree Expand file tree Collapse file tree
tests/Fixtures/handler_process
hosting_acquia/docroot/sites/default/includes/providers
hosting_project_name___acquia/docroot/sites/default/includes/providers
web/sites/default/includes/providers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,7 +70,10 @@ public function discover(): null|string|bool|array {
7070 return $ v ;
7171 }
7272
73- // Try to discover from settings.acquia.php.
73+ // @deprecated Discovery from hardcoded path in settings.acquia.php. The
74+ // new settings.acquia.php uses AH_SITE_GROUP environment variable instead
75+ // of a hardcoded project name. Kept for backward compatibility with older
76+ // installations.
7477 $ acquia_settings_file = $ this ->dstDir . sprintf ('/%s/sites/default/includes/providers/settings.acquia.php ' , $ this ->webroot );
7578 if (file_exists ($ acquia_settings_file )) {
7679 $ content = file_get_contents ($ acquia_settings_file );
@@ -125,6 +128,10 @@ public function process(): void {
125128 $ w = $ this ->webroot ;
126129
127130 Env::writeValueDotenv ('VORTEX_ACQUIA_APP_NAME ' , $ v , $ t . '/.env ' );
131+ // @deprecated The settings.acquia.php no longer uses hardcoded project
132+ // names - it uses AH_SITE_GROUP environment variable instead. This
133+ // replacement is kept for backward compatibility with older installations
134+ // that may still use the hardcoded path pattern.
128135 File::replaceContentInFile ($ t . '/ ' . $ w . '/sites/default/includes/providers/settings.acquia.php ' , 'your_site ' , $ v );
129136
130137 Env::writeValueDotenv ('LAGOON_PROJECT ' , $ v , $ t . '/.env ' );
Original file line number Diff line number Diff line change 1919 $ config ['acquia_hosting_settings_autoconnect ' ] = FALSE ;
2020
2121 // Include Acquia environment settings.
22- if (file_exists ('/var/www/site-php/star_wars/star_wars-settings.inc ' )) {
23- // @codeCoverageIgnoreStart
22+ // The path is built dynamically from the AH_SITE_GROUP environment variable
23+ // provided by Acquia Cloud.
24+ // @codeCoverageIgnoreStart
25+ $ ah_site_group = getenv ('AH_SITE_GROUP ' );
26+ if (!empty ($ ah_site_group )) {
27+ $ ah_settings_file = sprintf ('/var/www/site-php/%s/%s-settings.inc ' , $ ah_site_group , $ ah_site_group );
28+ if (!file_exists ($ ah_settings_file )) {
29+ throw new \RuntimeException (sprintf ('Acquia settings file "%s" not found. Check Acquia Cloud environment configuration. ' , $ ah_settings_file ));
30+ }
2431 // @phpstan-ignore-next-line
25- require '/var/www/site-php/star_wars/star_wars-settings.inc ' ;
26- // @codeCoverageIgnoreEnd
32+ require $ ah_settings_file ;
2733 }
34+ // @codeCoverageIgnoreEnd
2835
2936 // Set the config sync directory to a `config_vcs_directory`, but still
3037 // allow overriding it with the DRUPAL_CONFIG_PATH environment variable.
Original file line number Diff line number Diff line change 1919 $ config ['acquia_hosting_settings_autoconnect ' ] = FALSE ;
2020
2121 // Include Acquia environment settings.
22- if (file_exists ('/var/www/site-php/my_custom_acquia-project/my_custom_acquia-project-settings.inc ' )) {
23- // @codeCoverageIgnoreStart
22+ // The path is built dynamically from the AH_SITE_GROUP environment variable
23+ // provided by Acquia Cloud.
24+ // @codeCoverageIgnoreStart
25+ $ ah_site_group = getenv ('AH_SITE_GROUP ' );
26+ if (!empty ($ ah_site_group )) {
27+ $ ah_settings_file = sprintf ('/var/www/site-php/%s/%s-settings.inc ' , $ ah_site_group , $ ah_site_group );
28+ if (!file_exists ($ ah_settings_file )) {
29+ throw new \RuntimeException (sprintf ('Acquia settings file "%s" not found. Check Acquia Cloud environment configuration. ' , $ ah_settings_file ));
30+ }
2431 // @phpstan-ignore-next-line
25- require '/var/www/site-php/my_custom_acquia-project/my_custom_acquia-project-settings.inc ' ;
26- // @codeCoverageIgnoreEnd
32+ require $ ah_settings_file ;
2733 }
34+ // @codeCoverageIgnoreEnd
2835
2936 // Set the config sync directory to a `config_vcs_directory`, but still
3037 // allow overriding it with the DRUPAL_CONFIG_PATH environment variable.
Original file line number Diff line number Diff line change 1919 $ config ['acquia_hosting_settings_autoconnect ' ] = FALSE ;
2020
2121 // Include Acquia environment settings.
22- if (file_exists ('/var/www/site-php/your_site/your_site-settings.inc ' )) {
23- // @codeCoverageIgnoreStart
22+ // The path is built dynamically from the AH_SITE_GROUP environment variable
23+ // provided by Acquia Cloud.
24+ // @codeCoverageIgnoreStart
25+ $ ah_site_group = getenv ('AH_SITE_GROUP ' );
26+ if (!empty ($ ah_site_group )) {
27+ $ ah_settings_file = sprintf ('/var/www/site-php/%s/%s-settings.inc ' , $ ah_site_group , $ ah_site_group );
28+ if (!file_exists ($ ah_settings_file )) {
29+ throw new \RuntimeException (sprintf ('Acquia settings file "%s" not found. Check Acquia Cloud environment configuration. ' , $ ah_settings_file ));
30+ }
2431 // @phpstan-ignore-next-line
25- require '/var/www/site-php/your_site/your_site-settings.inc ' ;
26- // @codeCoverageIgnoreEnd
32+ require $ ah_settings_file ;
2733 }
34+ // @codeCoverageIgnoreEnd
2835
2936 // Set the config sync directory to a `config_vcs_directory`, but still
3037 // allow overriding it with the DRUPAL_CONFIG_PATH environment variable.
You can’t perform that action at this time.
0 commit comments