drush-ops / drush

Drush is a command-line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those who spend their working hours hacking away at the command prompt.
https://www.drush.org
2.34k stars 1.08k forks source link

config export and import assume CONFIG_SYNC_DIRECTORY exists #3851

Closed joachim-n closed 5 years ago

joachim-n commented 5 years ago

Describe the bug

If you remove $config_directories[CONFIG_SYNC_DIRECTORY], then the cex and cim commands crash.

(Yes this is possibly crazy -- chasing a different bug in ACSF and was advised to remove it...)

To Reproduce

Remove it in settings.php (well in my case, ACSF hooks, but the net effect is the same).

Expected behavior

Drush sees there is only one config directory location, and uses it by default.

Actual behavior

Crash:

In bootstrap.inc line 191:

  The configuration directory type 'sync' does not exist

The problem is in code like this:

    public function doExport($options, $destination_dir)
    {
        // Prepare the configuration storage for the export.
        if ($destination_dir ==  Path::canonicalize(\config_get_config_directory(CONFIG_SYNC_DIRECTORY))) {

config_get_config_directory() is getting called with CONFIG_SYNC_DIRECTORY and CONFIG_SYNC_DIRECTORY might not be a valid location, in which case, config_get_config_directory() throws an exception.

(I've checked latest Drush and that code is there too.)

System Configuration

Q A
Drush version? 9.3.1
Drupal version? 8.x
PHP version 7.1
OS? Linux
weitzman commented 5 years ago

I dont follow the bug. $config_directories['sync'] gets written to settings.php by the drupal installer and is required to be present.

joachim-n commented 5 years ago

$config_directories['sync'] gets written to settings.php by the drupal installer

Indeed. I was advised to remove the $config_directories['sync'] value in settings.php by Acquia support, as ACSF sets a different config location, and (so I was told) the presence of two locations in the $config_directories array is causing problems.

is required to be present

Hmm, I see what you mean -- that's assumed by Drupal core's config UI, and so is effectively a core requirement. I was thinking it might not bother Drush.