Information for: DEVELOPERS   PARTNERS   SUPPORT

Using Drush with Content Hub for Drupal 7

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.

Note

For more information about Drush, see Introduction to Drush.

Drush commands

Command Description
content-hub-connect Connect to Content Hub
content-hub-compare Compares the version of an entity from a local source and a remote source and prints the differences
content-hub-delete Deletes a single entity from the Content Hub
content-hub-diagnostic Perform diagnostic checks on the Content Hub
content-hub-disconnect Disconnect the client from the Content Hub
content-hub-export Export a local entity to the Content Hub
content-hub-export-block Export a core custom block to Content Hub
content-hub-list List content entities existing in the Content Hub
content-hub-local Prints an entity (in CDF format) from a local source (a Drupal website)
content-hub-purge Deletes all entities from the Content Hub (deprecated in Content Hub 1.18.0 or later)
content-hub-regenerate-secret Regenerates the shared secret used for webhook verification
content-hub-remote Prints an entity (in CDF format) from a remote source (the Content Hub)
content-hub-update-secret Updates the shared secret used for webhook verification
content-hub-webhook Perform a webhook management operation
queue-list General Drush command that returns additional Content Hub-related results
queue-run General Drush command that accepts additional Content Hub-related arguments

Drush commands for developers

The following commands are restricted by the user’s access key:

Important

Using the following commands can remove data from Content Hub.

Command Description
content-hub-mapping Shows Elastic Search field mappings from Content Hub
content-hub-purge Deletes all entities from the Content Hub (available in version 1.30 or later)
content-hub-reindex Reindex all entities in Content Hub
content-hub-restore Restores the backup taken by a previous execution of the content-hub-purge command

Command details

content-hub-connect

Connects to Content Hub.

Alias Arguments
  • ch-connect
  • ch-c
  • hostname - The Content Hub hostname to connect to
  • api_key - The API key to connect with
  • secret - The secret key to connect with
  • client_name - The client name to register the website with

content-hub-compare

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

Alias Arguments
ch-comp entity-type entity-id - The UUID of the entity

content-hub-delete

Deletes a single entity from the Content Hub.

Alias Arguments
ch-delete entity-id - The UUID of the entity

content-hub-diagnostic

Perform certain diagnostics on the Content Hub.

Alias Arguments
  • ch-diagnostic
  • ch-diag
none

content-hub-disconnect

Disconnect the client from the Content Hub.

Alias Arguments
  • ch-discon
  • ch-disconnect
none

content-hub-export

Export a local entity to the Content Hub.

Alias Arguments
  • ch-ex
  • ch-export

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

  • include-dependencies - This option also exports dependent entities (they are excluded by default)

content-hub-export-block

Export a core custom block to the Content Hub

Alias Arguments
  • ch-ex-block
  • ch-export-block
  • ch-exb
bid - The block ID to export

content-hub-list

List content entities that exist in the Content Hub.

Alias Arguments
ch-list

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

  • limit: The number of entities to list
  • 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

content-hub-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

content-hub-mapping

Shows Elastic Search field mappings for Content Hub.

Alias Arguments
ch-mapping none

content-hub-purge

(Developer only) - Deletes all entities from Content Hub. This is disabled in Content Hub 1.18.0 to 8.x-1.12.

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

Note

After a purge, all content must be manually re-exported.

content-hub-regenerate-secret

Regenerates the shared secret used for webhook verification.

Alias Arguments
ch-regsec none

content-hub-remote

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

Alias Arguments
ch-re entity-id - The UUID of the entity

content-hub-reindex

(Developer only) - Reindexes all entities in Content Hub

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

content-hub-restore

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

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

content-hub-update-secret

Updates the shared secret used for webhook verification.

Alias Arguments
ch-upsec none

content-hub-webhook

Perform a webhook management operation.

Alias Arguments
  • ch-webhook
  • ch-w
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.

Argument Description
content_hub_webhook_queue Processes the remaining Content Hub webhook queue