0

I have written a script that copies a drupal 8 site. The steps go something like this:

  1. dump old site database into file
  2. replace old site name with new site name in said file
  3. create a new database using that file
  4. Copy all files from the old directory into the new directory
  5. Modify sites.php and settings.php to contain the new site's configuration.

This works (I've debugged the script quite a bit) except for theme settings are not transferred over. Are the theme settings stored in the database? If so, why are my settings not transferred over? If not, where are they stored?

Assuming access only from a command line, how can my script copy theme settings from one Drupal 8 installation to another using the same theme?

0

Theme settings are stored in the database. However, Drupal 8 has configuration management. You can export the configuration to yml files. Theme configuration is included.

  1. You can download the yml files at /admin/config/development/configuration/full/export
  2. Or you can export it to the configuration folder by

    $ drush config-export sync

0

Using drush cex and drush cim to try and transfer settings failed because there were errors in the database. So, if the database transfer did not work, then importing configuration settings would also fail.

It turns out the problem was step 2 (replacing the URL in the database dump). Apparently

sed -i -e "s|$oldURL|$newURL|g" $databaseDump

was causing problems in the database. When it operated on binary lines, stuff broke (I have no idea why). I tried the same thing with perl and bbe but the result was the same. What eventually worked was changing the sed command to:

sed -i -e "/binary/!s|$oldURL|$newURL|g" $databaseDump

This is not without its own problems; any instance of the URL on a binary line will not be replaced. An example I ran into was accessing images from the 'asset_injector' module since the URL for the images is not replaced. But it works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.