I thought I'd ask here as the answer could be useful to others.

I'm building a site with config being managed by this module. What is the correct/best way to sync config during an install?

It needs to be at a particular point, because other install tasks require the vocabularies/content types etc. that are created.

I've currently used drush to trigger a sync:

drush_invoke_process('@self', 'csyn', array());

However, this is leaving some components overridden (mainly the Search API components, which are just Entity API parts). It also means the profile has to be installed by drush.

The content needs to be synced rather than migrated, as once the project is live I'll be looking to re-sync using update hooks.

Any advice would be greatly appreciated.

Cheers

Comments

Mark F’s picture

If I use drush_invoke_process('@self', 'csyn', array()); and install a site using my custom installation profile I get some errors, namely:

  • array_keys() expects parameter 1 to be array, null given configuration.drush.inc:422
  • Invalid argument supplied for foreach() ConfigurationManagement.php:137
  • Invalid argument supplied for foreach() ConfigurationManagement.php:283

I tried

  drush_invoke_process('@self', 'csyn', array(
    'source' => $config_dir)
  );

this gave the same errors but I'm a complete novice at writing code. Any ideas anyone?

GDrupal’s picture

You can check configuration_import_directory() we were using it on install task on profiles with success. Cheers!

Mark F’s picture

Bravo GDrupal - that information plus finding this snippet provided the answer. Thanks

Mark F’s picture

Quick note in case anyone else battles with this - this method will only work when the configuration has been exported. It will fail if you try to import the set of files generated while tracking. The error complaining that the file configurations.inc could not be found is the giveaway.

GDrupal’s picture

Status: Active » Fixed

Cool that you found that snippet! I totally forgot it... :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.