You are here

function node_revision_delete_drush_command in Node Revision Delete 7.3

Same name and namespace in other branches
  1. 8 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 13

Code

function node_revision_delete_drush_command() {
  $items['node-revision-delete'] = array(
    'description' => dt('Deletes old node revisions for a given content type.'),
    'arguments' => array(
      'type' => dt('Content type machine name.'),
      'minimum_revisions_to_keep' => dt('Minimum number of revisions to keep.'),
      'minimum_age_to_delete' => dt('Minimum age of revisions to be deleted.'),
      'when_to_delete' => dt('Minimum inactivity age to wait for delete a revision.'),
      'dry_run' => dt('Test run without deleting revisions but seeing the output results.'),
    ),
    'examples' => array(
      // @TODO: Add more examples.
      'drush nrd article 50' => dt('Keeps the latest 50 revisions of every article. Deletes the rest.'),
    ),
    'aliases' => array(
      'nrd',
    ),
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
  );
  $items['nrd-delete-cron-run'] = array(
    'description' => dt('Configures how many revisions delete per cron run.'),
    'arguments' => array(
      'quantity' => dt('Revisions quantity to delete per cron run.'),
    ),
    'aliases' => array(
      'nrd-dcr',
    ),
    'examples' => array(
      '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'] = array(
    'description' => dt('Get the last time that the node revision delete was made.'),
    'aliases' => array(
      'nrd-le',
    ),
    'examples' => array(
      'nrd-last-execute' => dt('Show the last time that the node revision delete was made.'),
    ),
  );

  // Getting all possible values.
  $values = array_keys(_node_revision_delete_word_to_time());
  $last_value = 'or ' . array_pop($values);
  $values[] = $last_value;
  $items['nrd-set-time'] = array(
    'description' => dt('Configures the frequency with which to delete revisions while cron is running.'),
    'aliases' => array(
      'nrd-st',
    ),
    'arguments' => array(
      'time' => dt('The time value (@values)', array(
        '@values' => implode(', ', $values),
      )),
    ),
    'examples' => array(
      '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'] = array(
    'description' => dt('Shows the frequency with which to delete revisions while cron is running.'),
    'aliases' => array(
      'nrd-gt',
    ),
    'examples' => array(
      'nrd-get-time' => dt('Shows the actual frequency with which to delete revisions while cron is running.'),
    ),
  );
  $items['nrd-when-to-delete-time'] = array(
    'description' => dt('Configures the time options for the inactivity time that the revision must have to be deleted.'),
    'arguments' => array(
      'max_number' => dt('The maximum number for inactivity time configuration'),
      'time' => dt('The time value for inactivity time configuration (days, weeks or months)'),
    ),
    'aliases' => array(
      'nrd-wtdt',
    ),
    'examples' => array(
      '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'] = array(
    'description' => dt('Configures time options to know the minimum age that the revision must have to be delete.'),
    'arguments' => array(
      'max_number' => dt('The maximum number for minimum age configuration'),
      'time' => dt('The time value for minimum age configuration (days, weeks or months)'),
    ),
    'aliases' => array(
      'nrd-matdt',
    ),
    'examples' => array(
      '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'] = array(
    'description' => dt('Delete all revisions prior to a revision.'),
    'arguments' => array(
      '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' => array(
      'nrd-dpr',
    ),
    'examples' => array(
      'nrd-delete-prior-revisions 1 3' => dt('Delete all revisions prior to revision id 3 of node id 1.'),
    ),
  );
  return $items;
}