Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/drupal#137 - Alternate PR - On drupal status report need different check when civi is already installed #18581

Merged
merged 1 commit into from
Oct 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions setup/plugins/installFiles/InstallSettingsFile.civi-setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,30 @@
$e->addInfo('system', 'settingsPath', sprintf('The settingsPath is defined.'));
}

// If Civi is already installed, Drupal 8's status report page also calls us
// and so we need to modify the check slightly since we want the reverse
// conditions.
$installed = \Civi\Setup::instance()->checkInstalled();
$alreadyInstalled = $installed->isSettingInstalled() || $installed->isDatabaseInstalled();

if (!\Civi\Setup\FileUtil::isCreateable($m->settingsPath)) {
$e->addError('system', 'settingsWritable', sprintf('The settings file "%s" cannot be created. Ensure the parent folder is writable.', $m->settingsPath));
if ($alreadyInstalled) {
$e->addInfo('system', 'settingsWritable', sprintf('The settings file "%s" is protected from writing.', $m->settingsPath));
}
else {
$e->addError('system', 'settingsWritable', sprintf('The settings file "%s" cannot be created. Ensure the parent folder is writable.', $m->settingsPath));
}
}
else {
$e->addInfo('system', 'settingsWritable', sprintf('The settings file "%s" can be created.', $m->settingsPath));
if ($alreadyInstalled) {
// Note if we were to output an error, we wouldn't be able to use
// `cv core:install` to do an in-place reinstall since it would fail
// requirements checks.
$e->addWarning('system', 'settingsWritable', sprintf('The settings file "%s" should not be writable.', $m->settingsPath));
}
else {
$e->addInfo('system', 'settingsWritable', sprintf('The settings file "%s" can be created.', $m->settingsPath));
}
}
});

Expand Down