function drush_node_revision_delete in Node Revision Delete 8
Same name and namespace in other branches
- 7.3 node_revision_delete.drush.inc \drush_node_revision_delete()
- 7.2 node_revision_delete.drush.inc \drush_node_revision_delete()
Callback for the node-revision-delete command.
File
- ./
node_revision_delete.drush.inc, line 180 - Drush commands related to the Node Revision Delete module.
Code
function drush_node_revision_delete() {
$args = func_get_args();
// Getting the --dry_run option.
$dry_run = drush_get_option('dry_run');
// Get all the candidate revisions.
$candidate_revisions = \Drupal::service('node_revision_delete')
->getCandidatesRevisions($args[0]);
// Checking if this is a dry run.
if ($dry_run) {
drush_log(dt('This is a dry run. No revision will be deleted.'), 'warning');
}
// Start the batch job.
batch_set(\Drupal::service('node_revision_delete')
->getRevisionDeletionBatch($candidate_revisions, $dry_run));
drush_backend_batch_process();
}