Information for: DEVELOPERS   PARTNERS   SUPPORT

Using Drush with Content Hub for Drupal 9

Content Hub includes several Drush commands for both normal product use and for more advanced administration. You can use the commands to administer your content from the command line. For more information about Drush, see Introduction to Drush.

Note

Drush versions 10.3.3 and higher has enhanced queue handling that improves the export and import process in Content Hub.

Drush commands

Drush commands Description Module version Drush 8.x compatible (CH 1.x only) Drush 9.x compatible Drush 10.x compatible Notes
acquia:contenthub-audit-publisher Checks published entities and compares them with the publisher to ensure consistency 1.x yes yes no Contains deprecated functions, therefore drush 10.x is incompatible
acquia:contenthub-audit-subscriber Creates a manifest file of entities to import and delete 1.x no yes yes See arguments
acquia:contenthub-audit-subscriber-execute-manifest Reads from the manifest file and executes user-specified changes on entities on the website 1.x no yes yes See arguments
acquia:contenthub-compare Compares the CDF of an entity from a local source and a remote source, and prints the differences 1.x yes yes yes See arguments
acquia:contenthub-enqueue-by-filters Adds entities to the import queue on a subscriber site based on the associated filters, except the default filter 3.x, 2.x no yes yes See arguments
acquia:contenthub-reindex Reindex all entities in Content Hub 1.x yes yes yes Use with caution: This command can remove content from Content Hub
acquia:contenthub-reset-entities Delete all entities of a specified type from Content Hub, reindex, and then re-export the entities back to Content Hub 1.x yes yes yes Use with caution: This command can remove content from Content Hub
acquia:contenthub-status-check Checks for stale content by comparing content published on subscribing websites with the original stored in Content Hub 1.x yes yes yes See arguments
acquia:contenthub-watchdog-queue-sizes Log the size of the import and export queues to Drupal watchdog 1.x yes no no N/A
acquia:contenthub-entity Retrieves an entity from a local source or Content Hub 2.x no yes yes See arguments
acquia:contenthub:entity-scan:filter Helper drush command for debugging 2.x no yes yes See arguments
acquia:contenthub-export-local-cdf Requires the location of a YAML $manifest 2.x no yes yes See arguments
acquia:contenthub-filter-details Lists the details of a filter 2.x no yes yes See arguments
acquia:contenthub-filters Lists available Cloud filters 2.x no yes yes See arguments
acquia:contenthub-filters:attach Attach a filter to the website 2.x no yes yes See arguments
acquia:contenthub-filters:detach Detach a filter from the website 2.x no yes yes See arguments
acquia:contenthub-import-local-cdf Imports entities from a CDF document 2.x no yes yes See arguments
acquia:contenthub-publisher-upgrade Publisher upgrade command 2.x no yes yes For 1.x to 2.x upgrades only. Do not run as a standalone command
acquia:contenthub-subscriber-upgrade Subscriber upgrade command 2.x no yes yes For 1.x to 2.x upgrades only. Do not run as a standalone command
acquia:contenthub-fix-config-entities-with-null-uuids Assigns randomly generated UUIDs to configuration entities with NULL UUIDs 2.x no yes yes Experimental: Use with caution
acquia:contenthub-remote Prints the CDF from a remote source (Content Hub) 2.x, 1.x yes yes yes Drush 8.x version available for Content Hub 1.x only
acquia:contenthub-webhooks Perform a webhook management operation 2.x, 1.x yes yes yes Drush 8.x version available for Content Hub 1.x only
acquia:contenthub-webhook-interests-purge Performs a webhook interest list purge operation for the current site 2.x yes yes yes

acquia:contenthub-connect-site Connects a site with Content Hub 2.x, 1.x yes yes yes Drush 8.x version available for Content Hub 1.x only
acquia:contenthub-delete Deletes a single entity from the Content Hub 2.x, 1.x yes yes yes Drush 8.x version available for Content Hub 1.x only
acquia:contenthub-disconnect-site Disconnects a site with Content Hub 2.x, 1.x yes yes yes Drush 8.x version available for Content Hub 1.x only
acquia:contenthub-list List entities from the Content Hub using the listEntities() method 2.x, 1.x yes yes yes Drush 8.x version available for Content Hub 1.x only
acquia:contenthub-local Prints the CDF from a local source (Drupal website) 2.x, 1.x yes yes no Drush 8.x version available for Content Hub 1.x only
acquia:contenthub-mapping Shows Elastic Search field mappings from Content Hub 2.x, 1.x yes yes yes Drush 8.x version available for Content Hub 1.x only;
Use with caution: This command can remove content from Content Hub
acquia:contenthub-purge Purges all entities from Content Hub 2.x, 1.x yes yes yes Drush 8.x version available for Content Hub 1.x only;
Use with caution: This command can remove content from Content Hub
acquia:contenthub-regenerate-secret Regenerates the Shared Secret used for webhook verification 2.x, 1.x yes yes yes Drush 8.x version available for Content Hub 1.x only
acquia:contenthub-restore Restores the backup taken by a previous execution of the purge command 2.x, 1.x yes yes yes Drush 8.x version available for Content Hub 1.x only;
Use with caution: This command can remove content from Content Hub
acquia:contenthub-update-secret Updates the Shared Secret used for webhook verification 2.x, 1.x yes yes yes Drush 8.x version available for Content Hub 1.x only
acquia:contenthub-audit-entity Audits an entity for differences with the existing CDF in Acquia Content Hub 2.x no yes yes See arguments
acquia:contenthub-settings Gets Content Hub settings from the different providers and determines the active configuration 2.x no yes yes See arguments
acquia:contenthub-re-queue Adds entities of a specified type to the export queue on a publisher 2.x no yes yes See arguments
queue-list General Drush command returning other Content Hub - related results 1.x yes no no See description
queue-run General Drush command accepting more Content Hub - related arguments 1.x yes no no See arguments
queue:list General Drush command returning other Content Hub - related results 2.x no yes yes See arguments
queue:run General Drush command accepting more Content Hub - related arguments 2.x no yes yes See arguments
queue:run General Drush command accepting more Content Hub - related arguments 2.x no yes yes See arguments

Troubleshooting Drush commands

If you have enabled Content Hub, but Drush commands fail with the message Command [command_name] needs the following extension(s) enabled to run: acquia_contenthub, execute the following command to try to resolve the issue:

drush en acquia_contenthub -y drush cr

If Drush commands for Content Hub continue to fail, contact Acquia Support.

Command details

acquia:contenthub-audit-publisher

Checks published entities and compares them with what exists in the Content Hub publisher to ensure consistency

Alias Arguments
ach-audit-publisher, ach-ap (Content Hub 1.x only)

This command takes the following argument:

  • entity-type

You can pass an array of options to process the data:

  • publish: Republish inconsistent entities to Content Hub
  • status: The export status of the entities to audit, defaults to EXPORTED. Possible values include:
    • EXPORTED
    • INITIATED
    • REINDEX
    • QUEUED

acquia:contenthub-audit-subscriber

Creates a manifest file of entities to import and delete by checking the filter configuration and verifying which entities from Content Hub matches those filters

Alias Arguments
ach-audit-subscriber, ach-as (Content Hub 1.x only)

This command takes the following arguments:

  • help: Checks imported entities and compares them to Content Hub
  • manifest_file: The file name, including path, to write the manifest to

You can pass an array of options to process the data:

  • types[=TYPES]: Comma-separated list of entity types to search and delete

Note

This command only gathers information about changes you can make to entities on your website.

acquia:contenthub-audit-subscriber-execute-manifest

Reads from the manifest file created by the ach-as command and executes user-specified changes on entities on the website

Alias Arguments
ach-audit-subscriber-exe-manifest, ach-asem (Content Hub 1.x only)

This command takes the following arguments:

  • manifest_file: The file name, including path, to write the manifest to
  • output_manifest_file: The file name, including path, to write the resulting manifest after execution

acquia:contenthub-compare

Compares the CDF of an entity from a local source and a remote source and prints the differences

Alias Arguments
ach-comp (Content Hub 1.x only)
  • entity-type
  • uuid: The UUID of the entity

acquia:contenthub-enqueue-by-filters

Adds entities to the import queue on a subscriber site based on the associated filters, except the default filter.

Alias Arguments
ach-enqueue-by-filters, ach-enfi
  • --filter-uuids[=FILTER-UUIDS] Creates import queue items based on specified filter uuids, where FILTER-UUIDS is a comma-separated list of filter uuids

acquia:contenthub-reindex

(Developer only) Reindexes all entities in Content Hub

Alias Arguments
ach-reindex (Content Hub 1.x only)
  • api: The Content Hub API key
  • secret: Your secret key

acquia:contenthub-reset-entities

(Developer only): Deletes all entities and / or bundles of a specified type from Content Hub, reindexes, and then re-exports the entities or bundles back to Content Hub

Alias Arguments
ach-reset (Content Hub 1.x only)
  • entity_type: The entity type
  • api: The Content Hub API key
  • secret: Your secret key
  • bundle_name is available as an option

acquia:contenthub-status-check

Checks for stale content by comparing content published on subscribing websites with the original stored in Content Hub

Alias Arguments
ach-st-ch (Content Hub 1.x only)
  • limit: The amount of previous log events to review for content changes
  • threshold: The number of minutes before content is considered stale

acquia:contenthub-watchdog-queue-sizes

Logs the size of the import and export queues to the Drupal watchdog log. (Content Hub 1.x only)

acquia:contenthub-entity

Retrieves an entity from a local source or Content Hub

Alias Arguments
ach-ent (Content Hub 2.x only)
  • @param string $op: The operation performed can be local or remote
  • @param string $uuid: Entity identifier or entity’s UUID
  • @param string $entity_type: The entity type in case of local retrieval

acquia:contenthub:entity-scan:filter

This command takes an entity UUID and compares it against the existing Cloud Filters, returning a list of filters and sites that the entity matches.

Run --help to review the help information of the command.

Option to --rebuild-cache to initiate a depcalc cache rebuild using the tracking table before running the scan. This may take a few minutes to complete.

Alias Arguments
ach-es-f, ach-esf (Content Hub 2.x only)
  • Requires one argument:$uuid
  • uuid is the exact uuid of the entity being inspected

acquia:contenthub-export-local-cdf

Requires the location of a YAML $manifest

Alias Arguments
ach-elc (Content Hub 2.x only)
  • The $manifest file format is a yml file you must create using the following format:

    entities:
      - node:e2ea160b-3512-4302-ad44-0b7113887922
      - node:9ed840bc-3205-476b-ac37-2da260f9808a
      - node:55f2b0f8-aeb2-490f-b5ba-998aef48fb7f
      - media:44bbe986-989e-493f-8691-cd0d39285aa9
    

acquia:contenthub-filter-details

Lists the details of a filter.

Alias Arguments
ach-cfds (Content Hub 2.x only)

This command takes the following argument:

  • UUID

acquia:contenthub-filters

Lists available Cloud filters.

Alias Arguments
ach-cf (Content Hub 2.x only)

You can pass an array of options to control the output:

  • --webhook[=WEBHOOK_URL] allows the user to define a webhook to display related filters
  • --interactive allows the user to select the webhook to display related filters

acquia:contenthub-filters:attach

Attaches a filter to a website.

Alias Arguments
ach-cfa (Content Hub 2.x only)
  • Requires two arguments:$uuid and $url:
  • uuid is the exact uuid of the filter you want to attach
  • url is the webhook URL you want to attach the filter to

acquia:contenthub-filters:detach

Detaches a filter from a website.

Alias Arguments
ach-cfd (Content Hub 2.x only)
  • Requires two arguments:$uuid and $url:
  • uuid is the exact uuid of the filter you want to detach
  • url is the webhook URL you want to detach the filter from

acquia:contenthub-import-local-cdf

Imports entities from a CDF document

Alias Arguments
ach-ilc (Content Hub 2.x only)
  • Requires a $location of a json file containing a cdf of entities

acquia:contenthub-publisher-upgrade

Publisher upgrade command

Alias Arguments
ach-publisher-upgrade, ach-puup (Content Hub 2.x only) N/A

acquia:contenthub-subscriber-upgrade

Subscriber upgrade command

Alias Arguments
ach-subscriber-upgrade, ach-suup (Content Hub 2.x only) N/A

acquia:contenthub-fix-config-entities-with-null-uuids

Assigns randomly generated UUIDs to configuration entities with NULL UUIDs (Experimental: Use with caution)

Alias Arguments
ach-fix-null-uuids (Content Hub 2.x only) N/A

acquia:contenthub-remote

Prints the CDF from a remote source (Content Hub)

Alias Arguments
ach-re (Content Hub 2.x and 1.x) uuid: The UUID of the entity

acquia:contenthub-webhooks

Performs a webhook management operation

Alias Arguments
ach-wh (Content Hub 2.x and 1.x)
  • This command takes the following argument:

  • op: The operation to use: register, unregister, or list.

    Requires the webhook_url as an option

acquia-contenthub-webhook-interests-purge

Deletes the current webhook and reassigns all existing filters of the current webhook to the newly created webhook. Webhook uuid changes so it must be updated in the configuration. If the configuration is saved in the database, no further action is needed. Otherwise, update the webhook in settings.php or environment variables depending on how the configuration is managed. This deletes everything from the import tracking table and the import queue.

Alias Arguments
ach-wi-purge N/A

acquia:contenthub-connect-site

Connects client to Content Hub

Alias Arguments
ach-connect (Content Hub 2.x and 1.x) N/A

acquia:contenthub-delete

Deletes a single entity from Content Hub

Alias Arguments
ach-del (Content Hub 2.x and 1.x)
  • UUID: The UUID of the entity
  • --ignore-origin: Ignores the origin check when deleting an entity

acquia:contenthub-disconnect-site

Disconnect the client from Content Hub

Alias Arguments
ach-disconnect (Content Hub 2.x and 1.x) N/A

acquia:contenthub-list

List content entities that exist in Content Hub

Alias Arguments
ach-list (Content Hub 2.x and 1.x)

You can pass an array of options to control the output:

  • limit: The number of entities to be listed
  • start: The offset to start listing the entities (useful for pagination)
  • origin: The client’s origin UUID
  • language: Filter entities by language: for example, en
  • attributes: The attributes to display for all listed entities
  • type: The entity types to include
  • filters=title=New*, status=1: The filters listed by new titles

acquia:contenthub-local

Prints an entity (in CDF format) from a local source (a Drupal website)

Alias Arguments
ach-lo (Content Hub 2.x and 1.x)
  • entity-type
  • entity-id: The ID of the entity. You can also run ach-ent which is defined here using the local operation.

acquia:contenthub-mapping

Shows Elastic Search field mappings for Content Hub

Alias Arguments
ach-mapping (Content Hub 2.x and 1.x) N/A

acquia:contenthub-purge

(Developer only): Deletes all entities from Content Hub

Important

The ach-purge command purges all entities from Acquia Content Hub. You must run this command cautiously as it requires elevated permissions. This command helps to recover from a disaster state where other recovery steps fail. This requires re-exporting all entities that are currently in the Content Hub service. Every subsequent execution of this command will override the backup created by the previous call.

To remove content from a healthy subscription, use ach-del.

Alias Arguments
ach-purge (Content Hub 2.x and 1.x)
  • api: The Content Hub API key
  • secret: Your secret key

When this command is run, a message like the following displays:

You are about to DROP all tables in your 'MY-WEBSITE' database. Do
you want to continue? (y/n):

You must confirm before Acquia Content Hub will purge the contents.

acquia:contenthub-regenerate-secret

Regenerates the shared secret used for webhook verification

Alias Arguments
ach-regsec (Content Hub 2.x and 1.x) N/A

acquia:contenthub-restore

(Developer only): Restores the backup taken by a previous execution of the purge command

Alias Arguments
ach-restore (Content Hub 2.x and 1.x)
  • api: The Content Hub API key
  • secret: Your secret key

acquia:contenthub-update-secret

Updates the shared secret used for webhook verification

Alias Arguments
ach-upsec (Content Hub 2.x and 1.x) N/A

acquia:contenthub-audit-entity

Audits an entity for differences with the existing CDF in Acquia Content Hub. It is a publisher command, which is only available if the site has the acquia_contenthub_publisher module enabled. It lists the entity and all its dependencies, and compares that data with the one stored remotely in Content Hub. It provides the option to republish that entity and all its dependencies if there are differences.

Alias Arguments
ach-audit-entity, ach-ae (Content Hub 2.x only)

This command takes the following arguments:

  • drush acquia:contenthub-audit-entity node 123: Audits the node with nid = 123 and all its dependencies.
  • drush ach-ae node 53fd2ed2-5d29-4028-9423-0713ef2f82b3: Audits the node with UUID = 53fd2ed2-5d29-4028-9423-0713ef2f82b3.

acquia:contenthub-settings

Gets Content Hub settings from the different providers and determines the active configuration.

Alias Arguments
ach-chs (Content Hub 2.x only)

This command takes the following argument:

  • drush ach-chs

acquia:contenthub-re-queue

Adds entities of a specified type to the export queue on a publisher.

Alias Arguments
ach-rq

This command requires at least one of the following options:

  • type=[entity-type]
  • bundle=[bundle]
  • only-queued-entities: Requeues all entities with the queued status on the publisher tracking table
  • use-tracking-table: Requeues all entities on the tracking table
  • –uuid=[uuid]: Enqueues the entity by uuid. –type=[entity_type] must be specified

queue-list

This command is not specific to Content Hub, but will return more results with it. See drush queue-list

Result Description
content_hub_webhook_queue The number of items in the Content Hub webhook queue

queue-run

This command is not specific to Content Hub. See drush queue-run.

Alias Arguments
acquia_contenthub_export_queue Processes the queue of entities to export
acquia_contenthub_import_queue Processes the queue of entities to import
content_hub_webhook_queue Processes the remaining Content Hub webhook queue

queue:list

This command is not specific to Content Hub, but will return more results with it.

Alias Arguments
acquia_contenthub_publish_export Processes the Content Hub publish export
acquia_contenthub_import_from_filters Processes the Content Hub import from filters
acquia_contenthub_subscriber_import Processes the Content Hub import the subscriber

queue:run

This command is not specific to Content Hub.

Alias Arguments
acquia_contenthub_publish_export Processes the Content Hub publish export
acquia_contenthub_import_from_filters Processes the Content Hub import from filters
acquia_contenthub_subscriber_import Processes the Content Hub import the subscriber