Skip to content

Commit 7b6943f

Browse files
committed
BootTrait - Change default boot mode. Prefer CmsBootstrap.
Most cv subcommands have the default bootstrap flag `--level=full|cms-full`, which automatically decides whether to use the older `full` (`Bootstrap.php`) or newer `cms-full` (`CmsBootstrap.php`). This commit changes the preference. Before: * Default to the older `full` * The env-var `CIVIRM_BOOT` implies a preference for `cms-full`. After: * Default to the newer `cms-full` * The env-vars `CIVIRM_BOOT`, `CIVICRM_SETTINGS`, and `CIVICRM_UF` imply a preference for `cms-full`, `full`, and `full` (respectively). Comment: All three of these variables already exist. What changes here is that they influence whether `full|cms-full` is interpreted as `full` or `cms-full`.
1 parent a7d1718 commit 7b6943f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Util/BootTrait.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,18 @@ public function boot(InputInterface $input, OutputInterface $output) {
3333
}
3434

3535
if ($input->getOption('level') === 'full|cms-full') {
36-
$input->setOption('level', getenv('CIVICRM_BOOT') ? 'cms-full' : 'full');
36+
if (getenv('CIVICRM_UF') === 'UnitTests') {
37+
$input->setOption('level', 'full');
38+
}
39+
elseif (getenv('CIVICRM_BOOT')) {
40+
$input->setOption('level', 'cms-full');
41+
}
42+
elseif (getenv('CIVICRM_SETTINGS')) {
43+
$input->setOption('level', 'full');
44+
}
45+
else {
46+
$input->setOption('level', 'cms-full');
47+
}
3748
}
3849

3950
if (getenv('CIVICRM_UF') === 'UnitTests' && preg_match('/^cms-/', $input->getOption('level'))) {

0 commit comments

Comments
 (0)