Version:

Acquia Cohesion renames to Site Studio from version 6.2. Tell me more.

    Package export using drush

    To export Site Studio packages and dependencies to your sync directory, use the following Drush command:

    $ drush sitestudio:package:export

    This command has the following options:

    • --package[=PACKAGE] - Site studio Package id of specific package. If this option is omitted, full package export will be executed.
    • --path[=PATH] - Target directory. If this option is omitted, command defaults to value set in $settings['site_studio_sync'].

    Adding -h as option will output "Export Site studio package files to a path." message and the list of available options.

    Running this command will create the directory specified via --path option if it doesn't exist and permissions allows the directory to be created. In this directory, Drush command will place configuration entities exported as readable .yml files, all the dependency files such as fonts and images and a site_studio_package_files.json.

    • .yml files are exported in "pretty printed" format. This makes reviewing and keeping track of changes easier, but makes such files incompatible with traditional Drupal configuration import.
    • dependency files - are exported in the relevant format to them. For example, .png images can be viewed and edited as required in the package directory.
    • site_studio_package_files.json - contains Drupal metadata about the dependency files, such as URI, filesize, file mime type, timestamps, etc. 

    If destination path already contains exported package, the command will prompt the user to confirm the deletion of files in destination directory. If this is not confirmed, the export command will abort without deleting any of the files and without exporting anything. If confirmed, the command will first delete files in destination directory and then proceed to export the Package.

    Examples

    Here's the example prompt the user would see, if the destination directory of "sites/default/files/cohesion_sync" already contains files:

    The .yml files in your export directory (sites/default/files/cohesion_sync/) will be deleted and replaced with the package config and files. (yes/no) [yes]:
    
    >


    To always delete files by default, the following flags can be used: --yes or -y

    To always cancel command instead of deleting files, the following flag can be used: --no

    Here's the example output of specific package export (using package id) and specific path with confirmation flag:

    $ drush sitestudio:package:export --package=pack_blog_feature --path=sites/default/files/sync/pack_blog_feature/ -y
    Exported 64 config and 14 non-config files.

     

    Here's the example output of full package export with default path as specified in Site Studio $settings['site_studio_sync'] with prompt that asks user to confirm deletion existing package files before export:

    $ drush sitestudio:package:export

     

    The .yml files in your export directory (sites/default/files/cohesion_sync/) will be deleted and replaced with the package config and files. (yes/no) [yes]:
    
    > yes
    Exported 285 config and 12 non-config files.

     

    Here's the example of site_studio_package_files.json that contains 2 files, one image in .png format and one .ttf file:

    { 
      "file:file:f912fea9-fd41-4f12-bee2-90f6a27219bf": {
        "fid": "4",
        "uuid": "f912fea9-fd41-4f12-bee2-90f6a27219bf",
        "langcode": "en",
        "filename": "image_1.png",
        "uri": "public:\/\/image_1.png",
        "filemime": "image\/png",
        "filesize": "4594",
        "status": "1",
        "created": "1634141175",
        "changed": "1634141175" 
       },
      "file:file:b9129c1a-6416-4106-bd67-c0dea5dfda9a": {
        "fid": "290",
        "uuid": "b9129c1a-6416-4106-bd67-c0dea5dfda9a",
        "langcode": "en",
        "filename": "icomoon.ttf",
        "uri": "public:\/\/cohesion\/icomoon.ttf",
        "filemime": "application\/octet-stream",
        "filesize": "184196",
        "status": "1",
        "created": "1594199557",
        "changed": "1594199557"
       }
     }

    Legacy Drush commands

     

    The legacy package management methods described below will be removed in a future version  of Site Studio.

     

    drush sync:export - Exports all Site Studio configuration to the sync folder as a single .yml_ file.

    drush sync:export --filename-prefix=myfilenamehere - Exports all Site Studio configuration to the sync folder as a single .yml_ file with a custom file name rather than using the websites name.

    DX8 knowledge base icon

    Frequently asked questions

    Get instant answers to common questions. Available online 24/7.

    Find answers

    Raise a ticket icon

    Raise a support ticket

    To raise a ticket, sign into Acquia Cloud and select Help in the top menu.

    Raise support ticket

    Acquia

    Copyright © 2020 Acquia, Inc. All Rights Reserved. Drupal is a registered trademark of Dries Buytaert.