Skip to content

Commit

Permalink
different check when civi is already installed
Browse files Browse the repository at this point in the history
  • Loading branch information
demeritcowboy committed Sep 24, 2020
1 parent 55d30ed commit 2665ff8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions setup/plugins/installFiles/InstallSettingsFile.civi-setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
*/
$m = $e->getModel();

$installed = \Civi\Setup::instance()->checkInstalled();
$alreadyInstalled = $installed->isSettingInstalled() || $installed->isDatabaseInstalled();

if (empty($m->settingsPath)) {
$e->addError('system', 'settingsPath', sprintf('The settingsPath is undefined.'));
}
Expand All @@ -29,10 +32,20 @@
}

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) {
$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

0 comments on commit 2665ff8

Please sign in to comment.