You are here

function delete_all_drush_command in Delete all 8

Same name and namespace in other branches
  1. 6 delete_all.drush.inc \delete_all_drush_command()
  2. 7 delete_all.drush.inc \delete_all_drush_command()
  3. 2.x drush/delete_all.drush.inc \delete_all_drush_command()

Implements hook_drush_command().

delete-all-delete-user (dadu)

  • Command to delete users.
  • "--roles" is an optional parameter here and provides the option to delete all users of a role specified in the command.
  • Following are the possible ways to use the command: 1. `drush dadu`

    • Deletes all users.

    2. `drush dadu --role`

    • User can choose one of the roles from the options given. All users with that role will be deleted.

    3. `drush dadu --role role_1,role_2,role_3`

    • All users with either of the given roles will be deleted. Please note that Role names can have black spaces between them, but two roles should be separed only by a 'comma' without any space before or after the comma.

delete-all-delete-content (dadc)

  • Command to delete content. *
  • "--type" is an optional parameter here and provides the option to delete all contents of a type specified in the command. *
  • Following are the possible ways to use the command: * 1. `drush dadc`

    • Deletes all content of all types.

    2. `drush dadc --type`

    • User can choose one of the content type from the options given. All content of that type will be deleted.

    3. `drush dadc --type type_1,type_2,type_3`

    • All content with either of the given types will be deleted. Please note that machine name of the content type must be provided. Two content types should be separed only by a 'comma' without any space before or after the comma.

delete-all-delete-entities (dade)

  • Command to delete entities. *
  • "--type" is an optional parameter here and provides the option to delete all entities of a type specified in the command. *
  • Following are the possible ways to use the command: * 1. `drush dade`

    • User can choose one of the entity types from the options given. After selecting an entity type, a bundle select option will appear. Options to delete all or cancel also exists. All entities of that type and bundle will be deleted after confirmation

2. `drush dade --type type_1

  • All entities with the given type will be deleted. Please note that machine name of the entity type must be provided. Unlike the delete users and delete content options, this does not work with multiple entity types in the same command. *

2. `drush dade --type entity_type --bundle bundle_type

  • All entities with the given type will be deleted. Please note that machine name of the entity type must be provided. Unlike the delete users and delete content options, this does not work with multiple entity types in the same command.

File

drush/delete_all.drush.inc, line 70
delete all Drush command

Code

function delete_all_drush_command() {
  $items = [];
  $items['delete-all-delete-users'] = [
    'description' => 'Delete users.',
    'options' => [
      'role' => 'pick roles',
    ],
    'examples' => [
      'drush delete-all-delete-users' => 'Delete all users.',
    ],
    'aliases' => [
      'dadu',
    ],
  ];
  $items['delete-all-delete-content'] = [
    'description' => 'Delete content.',
    'options' => [
      'type' => 'pick content type',
    ],
    'examples' => [
      'drush delete-all-delete-content' => 'Delete content.',
    ],
    'aliases' => [
      'dadc',
    ],
  ];
  $items['delete-all-delete-entities'] = [
    'description' => 'Delete entities.',
    'options' => [
      'type' => 'pick entity type',
      'bundle' => 'pick entity bundle',
    ],
    'examples' => [
      'drush delete-all-delete-entities ' => 'Delete entities.',
    ],
    'aliases' => [
      'dade',
    ],
  ];
  return $items;
}