You are here

function demo_drush_reset in Demonstration site (Sandbox / Snapshot) 6

Callback for drush command demo-reset.

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

File

./demo.drush.inc, line 213

Code

function demo_drush_reset($filename = NULL) {
  if (empty($filename)) {
    drush_set_error('Argument file name is not given. See "drush help demo-reset" for usage.');
    return;
  }
  if (!_demo_drush_is_file_exists($filename)) {
    drush_set_error('File does not exist. Use "drush demo-snapshots" to get the list of available snapshots.');
    return;
  }
  drush_log('DO NOT USE THIS COMMAND ON A PRODUCTION SERVER. THIS ACTION WILL RESET YOUR DATABASE AND CAN NOT BE UNDONE. WE RECOMMAND YOU HAVE A BACKUP OF YOUR DATABASE BEFORE YOU PROCEED WIHT THIS COMMAND.', 'warning');
  if (!drush_confirm('Are you sure you want to reset the site?')) {
    drush_log('Command Aborted.', 'ok');
    return;
  }
  drush_print('This command will take a while. Please wait...');
  if (_demo_reset($filename)) {
    drush_log('Successfully restored database from snapshot ' . $filename, 'ok');
  }
  else {
    drush_set_error('Failed to restore from snapshot.');
  }
}