Skip to content

Commit

Permalink
fix: Allow to disable configuration management for drupal based projects
Browse files Browse the repository at this point in the history
  • Loading branch information
stmh committed Apr 12, 2023
1 parent c1d8050 commit 36b18c7
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/Method/DrushMethod.php
Expand Up @@ -625,12 +625,15 @@ private function checkExistingInstall(
HostConfig $host_config,
TaskContextInterface $context
) {
$config_management_enabled = !empty($host_config['configurationManagement']);
$shell->pushWorkingDir($host_config['siteFolder']);
$settings_file_exists = $shell->exists($host_config['siteFolder'] . '/settings.php');
$config_dir_exists = $shell->exists($this->getConfigSyncDirectory($host_config) . '/core.extension.yml');
$config_dir_exists =
$config_management_enabled
&& $shell->exists($this->getConfigSyncDirectory($host_config) . '/core.extension.yml');
$config_used = false;

if ($settings_file_exists) {
if ($config_management_enabled && $settings_file_exists) {
$result = $shell->run(
sprintf(
'#!grep -q "^\$settings\[\'config_sync_directory\'] = \'%s/" settings.php',
Expand All @@ -646,12 +649,18 @@ private function checkExistingInstall(

$supported_by_drush = $host_config['drushVersion'] >= 9;

$this->logger->debug(sprintf("Settings file exists: %s", $settings_file_exists ? "TRUE" : "FALSE"));
$this->logger->debug(sprintf(
"Configuration dir %s exists: %s",
$this->getConfigSyncDirectory($host_config),
$config_dir_exists ? "TRUE" : "FALSE"
"Configuration management disabled: %s",
$config_management_enabled ? "TRUE" : "FALSE"
));
$this->logger->debug(sprintf("Settings file exists: %s", $settings_file_exists ? "TRUE" : "FALSE"));
if ($config_management_enabled) {
$this->logger->debug(sprintf(
"Configuration dir %s exists: %s",
$this->getConfigSyncDirectory($host_config),
$config_dir_exists ? "TRUE" : "FALSE"
));
}
$this->logger->debug(sprintf("Configuration used: %s", $config_used ? "TRUE" : "FALSE"));
$this->logger->debug(sprintf("Drush supports config import: %s", $supported_by_drush ? "TRUE" : "FALSE"));

Expand Down

0 comments on commit 36b18c7

Please sign in to comment.