You are here

function votingapi_drush_command in Voting API 8.3

Same name and namespace in other branches
  1. 7.3 votingapi.drush.inc \votingapi_drush_command()
  2. 7.2 votingapi.drush.inc \votingapi_drush_command()

Implements hook_drush_command().

File

./votingapi.drush.inc, line 38
Voting API module integration with Drush 8 and earlier.

Code

function votingapi_drush_command() {
  $items['generate-votes'] = [
    'aliases' => [
      'genv',
    ],
    'description' => dt('Creates dummy voting data.'),
    'drupal dependencies' => [
      'votingapi',
    ],
    'core' => [
      '8+',
    ],
    'arguments' => [
      'entity_type' => 'The type of entity to generate votes for.',
      'vote_type' => "The type of votes to generate, defaults to 'percent'.",
    ],
    'options' => [
      'kill_votes' => "Specify 'kill_votes' to delete all existing votes before generating new ones.",
      'age' => 'The maximum age, in seconds, of each vote.',
      'node_types' => "A comma delimited list of node types to generate votes for, if the entity type is 'node'.",
    ],
    'examples' => [
      'drush generate-votes [entity_type] [vote_type].' => dt('Creates dummy voting data.'),
    ],
  ];
  $items['votingapi-recalculate'] = [
    'aliases' => [
      'vcalc',
    ],
    'description' => dt('Regenerates voting results from raw vote data.'),
    'drupal dependencies' => [
      'votingapi',
    ],
    'core' => [
      '8+',
    ],
    // Various D7 code assumes we have a uid.
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_LOGIN,
    'arguments' => [
      'entity_type' => 'The type of entity to recalculate vote results for.',
    ],
    'examples' => [
      'drush votingapi-recalculate [entity_type]' => dt('Regenerates voting results from raw vote data.'),
    ],
  ];
  $items['votingapi-flush'] = [
    'aliases' => [
      'vflush',
    ],
    'description' => dt('Deletes all existing voting data.'),
    'drupal dependencies' => [
      'votingapi',
    ],
    'core' => [
      '8+',
    ],
    // Various D7 code assumes we have a uid.
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_LOGIN,
    'arguments' => [
      'entity_type' => 'The type of entity whose voting data should be flushed.',
    ],
    'examples' => [
      'drush votingapi-flush [entity_type]' => dt('Deletes all existing voting data.'),
    ],
  ];
  return $items;
}