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.

Drush commands

Command Description
acquia-contenthub-audit-publisher Checks published entities and compares them with the publisher to ensure consistency
acquia-contenthub-audit-subscriber Creates a manifest file of entities to import and delete
acquia-contenthub-audit-subscriber-execute-manifest Reads from the manifest file and executes user-specified changes on entities on the website
acquia-contenthub-compare Compares the CDF of an entity from a local source and a remote source, and prints the differences
acquia-contenthub-connect-site Connects client to Content Hub
acquia-contenthub-delete Deletes a single entity from Content Hub
acquia-contenthub-disconnect-site Disconnect the client from Content Hub
acquia:contenthub-filters Lists available Cloud Platform Filters
acquia:contenthub-filters:attach Attach a filter to the website
acquia:contenthub-filters:detach Detach a filter from the website
acquia:contenthub-filter:details Lists the details of a filter
acquia-contenthub-list List content entities existing in Content Hub
acquia-contenthub-local Prints an entity (in CDF format) from a local source (a Drupal website)
acquia-contenthub-regenerate-secret Regenerates the shared secret used for webhook verification
acquia-contenthub-remote Prints an entity (in CDF format) from a remote source (Content Hub)
acquia-contenthub-status-check Checks for stale content by comparing content published on subscribing websites with the original stored in Content Hub
acquia-contenthub-update-secret Updates the shared secret used for webhook verification
acquia-contenthub-watchdog-queue-sizes Log the size of the import and export queues to Drupal watchdog
acquia-contenthub-webhooks Perform a webhook management operation
queue-list General Drush command returning other Content Hub -related results
queue-run General Drush command accepting more Content Hub -related arguments

Advanced Drush commands

The following commands can remove data from Content Hub, and should be used with caution.

Command Description
acquia-contenthub-mapping Display Elastic Search field mappings from Content Hub
acquia-contenthub-purge Delete all entities from Content Hub (available in version 8.x-1.12 or later)
acquia-contenthub-reindex Reindex all entities in 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
acquia-contenthub-restore Restore the backup taken by a previous execution of the acquia-contenthub-purge command

Troubleshooting Drush commands

If you have enabled Content Hub, but Drush commands fail with the message Command [commandname] needs the following extension(s) enabled to run: acquia_contenthub, execute the following commands 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

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

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

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
  • entity-type
  • uuid: The UUID of the entity

acquia-contenthub-connect-site

Connects client to Content Hub

Alias Arguments
ach-connect none

acquia-contenthub-delete

Deletes a single entity from Content Hub

Alias Arguments
ach-del UUID: The UUID of the entity

acquia-contenthub-disconnect-site

Disconnect the client from Content Hub

Alias Arguments
ach-disconnect none

acquia:contenthub-filters

Lists available Cloud Platform Filters. Content Hub 2.x only

Alias Arguments
ach-cf

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. Content Hub 2.x only

Alias Arguments
ach-cfa

This command takes the following arguments:

  • attach UUID or attach WEBHOOK_URL attaches a filter to the website using the Cloud Platform filter’s UUID or webhook URL.

    acquia:contenthub-filters:attach 00000000-0000-0000-0000-000000000000
    
    or
    
    acquia:contenthub-filters:attach http://example.com/acquia-contenthub/webhook
    

acquia:contenthub-filters:detach

Detaches a filter from a website. Content Hub 2.x only

Alias Arguments
ach-cfd

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

  • attach UUID or attach WEBHOOK_URL detaches a filter from the website using the Cloud Platform filter’s UUID or webhook URL.

    acquia:contenthub-filters:detach 00000000-0000-0000-0000-000000000000
    
    or
    
    acquia:contenthub-filters:detach http://example.com/acquia-contenthub/webhook
    

acquia:contenthub-filter-details

Lists the details of a filter. Content Hub 2.x only

Alias Arguments
ach-cfds

This command takes the following argument:

  • UUID

acquia-contenthub-list

List content entities that exist in Content Hub

Alias Arguments
ach-list

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: Key=value pairs of conditions by which to filter the output, comma separated: for example, title=New*, status=1

acquia-contenthub-local

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

Alias Arguments
ach-lo
  • entity-type
  • entity-id: The UUID of the entity

acquia-contenthub-mapping

Shows Elastic Search field mappings for Content Hub

Alias Arguments
ach-mapping none

acquia-contenthub-purge

(Developer only): Deletes all entities from Content Hub

Important

The ach-purge command purges all entities from Acquia Content Hub. WARNING! Use caution when using this destructive command requiring elevated permissions. Every subsequent execution of this command will override the backup created by the previous call.

Alias Arguments
ach-purge
  • api: The Content Hub API key
  • secret: Your secret key

Note

Before running the ach-purge command, you should clear out the hashes in your tracking table to avoid issues with syndication later. You can do this by running the following command on your publisher site:

drush sqlq "UPDATE acquia_contenthub_publisher_export_tracking SET hash = ''"

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 none

acquia-contenthub-reindex

(Developer only): Reindexes all entities in Content Hub

Alias Arguments
ach-reindex
  • api: The Content Hub API key
  • secret: Your secret key

acquia-contenthub-remote

Prints an entity (in CDF format) from a remote source (Content Hub)

Alias Arguments
ach-re uuid: The UUID of the entity

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
  • entity_type: The entity type
  • api: The Content Hub API key
  • secret: Your secret key
  • bundle_name is available as an option

acquia-contenthub-restore

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

Alias Arguments
ach-restore
  • api: The Content Hub API key
  • secret: Your secret key

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
  • limit: The amount of previous log events to review for content changes
  • threshold: The number of minutes before content is considered stale

acquia-contenthub-update-secret

Updates the shared secret used for webhook verification

Alias Arguments
ach-upsec none

acquia-contenthub-watchdog-queue-sizes

Log the size of the import and export queues to the Drupal watchdog log.

acquia-contenthub-webhooks

Perform a webhook management operation

Alias Arguments
ach-wh

This command takes the following argument:

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

    Requires the webhook_url as an option

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