2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 61
61
* type of CMS is being used.
62
62
* (Default: NULL)
63
63
* - env: string|NULL. The environment variable which may contain the path to
64
- * civicrm.settings.php. Set NULL to disable.
64
+ * civicrm.settings.php (or the token "Auto") . Set NULL to disable environment-checking .
65
65
* (Default: CIVICRM_SETTINGS)
66
66
* - httpHost: string|NULL. For multisite, the HTTP hostname.
67
67
* - prefetch: bool. Whether to load various caches.
@@ -324,7 +324,7 @@ public function getCivicrmSettingsPhp($options) {
324
324
if (defined ('CIVICRM_CONFDIR ' ) && file_exists (CIVICRM_CONFDIR . '/civicrm.settings.php ' )) {
325
325
$ settings = CIVICRM_CONFDIR . '/civicrm.settings.php ' ;
326
326
}
327
- elseif (!empty ($ options ['env ' ]) && getenv ($ options ['env ' ]) && file_exists (getenv ($ options ['env ' ]))) {
327
+ elseif (!empty ($ options ['env ' ]) && getenv ($ options ['env ' ]) && getenv ( $ options [ ' env ' ]) !== ' Auto ' && file_exists (getenv ($ options ['env ' ]))) {
328
328
$ settings = getenv ($ options ['env ' ]);
329
329
}
330
330
elseif (!empty ($ options ['settingsFile ' ]) && file_exists ($ options ['settingsFile ' ])) {
Original file line number Diff line number Diff line change @@ -111,6 +111,10 @@ public function bootCms() {
111
111
'path ' => '/ ' . parse_url ($ cmsExpr , PHP_URL_HOST ) . parse_url ($ cmsExpr , PHP_URL_PATH ),
112
112
);
113
113
$ cms ['path ' ] = preg_replace (';^//+; ' , '/ ' , $ cms ['path ' ]);
114
+ if ($ cms ['type ' ] === 'Auto ' ) {
115
+ $ isAutoPath = (trim ($ cms ['path ' ], '/ ' ) === '. ' );
116
+ $ cms = $ this ->findCmsRoot ($ isAutoPath ? $ this ->getSearchDir () : $ cms ['path ' ]);
117
+ }
114
118
if (!isset ($ this ->options ['user ' ]) && parse_url ($ cmsExpr , PHP_URL_USER )) {
115
119
$ this ->options ['user ' ] = parse_url ($ cmsExpr , PHP_URL_USER );
116
120
}
@@ -126,7 +130,7 @@ public function bootCms() {
126
130
$ cms = $ this ->findCmsRoot ($ this ->getSearchDir ());
127
131
}
128
132
129
- $ this ->writeln ("CMS: " . json_encode ($ this -> options , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ), OutputInterface::VERBOSITY_DEBUG );
133
+ $ this ->writeln ("CMS: " . json_encode ($ cms , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ), OutputInterface::VERBOSITY_DEBUG );
130
134
if (empty ($ cms ['path ' ]) || empty ($ cms ['type ' ]) || !file_exists ($ cms ['path ' ])) {
131
135
$ cmsJson = json_encode ($ cms , JSON_UNESCAPED_SLASHES );
132
136
throw new \Exception ("Failed to parse or find a CMS $ cmsJson " );
0 commit comments