You are here

function drush_node_revision_delete_nrd_set_time in Node Revision Delete 7.3

Same name and namespace in other branches
  1. 8 node_revision_delete.drush.inc \drush_node_revision_delete_nrd_set_time()

Callback for the nrd-set-time command.

File

./node_revision_delete.drush.inc, line 286

Code

function drush_node_revision_delete_nrd_set_time($time = '') {

  // Check for correct argument.
  $options = _node_revision_delete_word_to_time();
  if (!in_array($time, array_keys($options))) {
    if (!empty($time)) {
      drush_log(dt('"@time_value" is not a valid time argument.', array(
        '@time_value' => $time,
      )), 'warning');
    }
    $time = drush_choice(_node_revision_delete_time_value(), dt('Choose the frequency with which to delete revisions while cron is running:'));
  }
  else {
    $time = $options[$time];
  }

  // Saving the values in the config.
  variable_set('node_revision_delete_time', $time);
  $time_value = _node_revision_delete_time_value($time);
  $message = dt('The frequency with which to delete revisions while cron is running was set to: @time.', array(
    '@time' => $time_value,
  ));
  drush_log($message, 'success');
}