You are here

function demo_drush_delete_snapshot in Demonstration site (Sandbox / Snapshot) 6

Callback for drush command demo-delete.

1 string reference to 'demo_drush_delete_snapshot'
demo_drush_command in ./demo.drush.inc
Implementation of hook_drush_command().

File

./demo.drush.inc, line 139

Code

function demo_drush_delete_snapshot($filename = NULL) {
  if (empty($filename)) {
    drush_set_error('Argument file name is not given. See "drush help demo-delete" for usage.');
    return;
  }
  if (!_demo_drush_is_file_exists($filename)) {
    drush_set_error('File does not exists. Use "drush demo-snapshots" to get the list of available snapshots.');
    return;
  }
  drush_log('This command will delete the snapshot and can not be undone', 'warning');
  if (!drush_confirm('Are you sure you want to continue?', $indent = 0)) {
    drush_log('Command Aborted.', 'ok');
    return;
  }
  module_load_include('inc', 'demo', 'demo.admin');
  $file = demo_get_fileconfig($filename);
  unlink($file['sqlfile']);
  unlink($file['infofile']);
  drush_log("Deleted snapshot {$filename}", 'success');
}