You are here

function node_revision_delete_drush_command in Node Revision Delete 8

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

Implements hook_drush_command().

File

./node_revision_delete.drush.inc, line 14
Drush commands related to the Node Revision Delete module.

Code

function node_revision_delete_drush_command() {
  $items['node-revision-delete'] = [
    'description' => dt('Deletes old node revisions for a given content type.'),
    'arguments' => [
      'type' => dt('Content type machine name.'),
    ],
    'options' => [
      'dry_run' => [
        'description' => dt('Test run without deleting revisions but seeing the output results.'),
      ],
    ],
    'aliases' => [
      'nrd',
    ],
    'examples' => [
      'drush nrd article' => dt('Delete article revisions according to set configuration.'),
      'drush nrd page --dry_run' => dt('Execute the deletion process without delete the revisions, just to see the output result.'),
    ],
  ];
  $items['nrd-delete-cron-run'] = [
    'description' => dt('Configures how many revisions delete per cron run.'),
    'arguments' => [
      'quantity' => dt('Revisions quantity to delete per cron run.'),
    ],
    'aliases' => [
      'nrd-dcr',
    ],
    'examples' => [
      'nrd-delete-cron-run' => dt('Show how many revisions the module will delete per cron run.'),
      'nrd-delete-cron-run 50' => dt('Configure the module to delete 50 revisions per cron run.'),
    ],
  ];
  $items['nrd-last-execute'] = [
    'description' => dt('Get the last time that the node revision delete was made.'),
    'aliases' => [
      'nrd-le',
    ],
    'examples' => [
      'nrd-last-execute' => dt('Show the last time that the node revision delete was made.'),
    ],
  ];
  $items['nrd-set-time'] = [
    'description' => dt('Configures the frequency with which to delete revisions while cron is running.'),
    'aliases' => [
      'nrd-st',
    ],
    'arguments' => [
      // Is not possible to call here Time::convertWordToTime() read more at
      // https://drupal.stackexchange.com/q/268239/28275 .
      'time' => dt('The time value (never, every_hour, every_time, everyday, every_week, every_10_days, every_15_days, every_month, every_3_months, every_6_months, every_year or every_2_years)'),
    ],
    'examples' => [
      'nrd-set-time' => dt('Show a list to select the frequency with which to delete revisions while cron is running.'),
      'nrd-set-time every_time' => dt('Configure the module to delete revisions every time the cron runs.'),
    ],
  ];
  $items['nrd-get-time'] = [
    'description' => dt('Shows the frequency with which to delete revisions while cron is running.'),
    'aliases' => [
      'nrd-gt',
    ],
    'examples' => [
      'nrd-get-time' => dt('Shows the actual frequency with which to delete revisions while cron is running.'),
    ],
  ];
  $items['nrd-when-to-delete-time'] = [
    'description' => dt('Configures the time options for the inactivity time that the revision must have to be deleted.'),
    'arguments' => [
      'max_number' => dt('The maximum number for inactivity time configuration'),
      'time' => dt('The time value for inactivity time configuration (days, weeks or months)'),
    ],
    'aliases' => [
      'nrd-wtdt',
    ],
    'examples' => [
      'nrd-when-to-delete-time ' => dt('Shows the time configuration for the inactivity time.'),
      'nrd-when-to-delete-time 30 days' => dt('Set the maximum inactivity time to 30 days.'),
      'nrd-when-to-delete-time 6 weeks' => dt('Set the maximum inactivity time to 6 weeks.'),
    ],
  ];
  $items['nrd-minimum-age-to-delete-time'] = [
    'description' => dt('Configures time options to know the minimum age that the revision must have to be delete.'),
    'arguments' => [
      'max_number' => dt('The maximum number for minimum age configuration'),
      'time' => dt('The time value for minimum age configuration (days, weeks or months)'),
    ],
    'aliases' => [
      'nrd-matdt',
    ],
    'examples' => [
      'nrd-minimum-age-to-delete-time ' => dt('Shows the time configuration for the minimum age of revisions.'),
      'nrd-minimum-age-to-delete-time 30 days' => dt('Set the maximum time for the minimum age to 30 days.'),
      'nrd-minimum-age-to-delete-time 6 weeks' => dt('Set the maximum time for the minimum age to 6 weeks.'),
    ],
  ];
  $items['nrd-delete-prior-revisions'] = [
    'description' => dt('Delete all revisions prior to a revision.'),
    'arguments' => [
      'nid' => dt('The id of the node which revisions will be deleted.'),
      'vid' => dt('The revision id, all prior revisions to this revision will be deleted.'),
    ],
    'aliases' => [
      'nrd-dpr',
    ],
    'examples' => [
      'nrd-delete-prior-revisions 1 3' => dt('Delete all revisions prior to revision id 3 of node id 1.'),
    ],
  ];
  return $items;
}