<?php

/**
 * @file
 * Drush integration for Heartbeat module.
 */

/**
 * Implements hook_drush_command().
 */
function heartbeat_drush_command() {
  $items = array();

  $items['clear-activity-all'] = array(
    'description' => 'Delete all heartbeat activity logs.',
    'drupal dependencies' => array('heartbeat'),
    'callback' => 'drush_clear_activity_all',
    'aliases' => array('cal'),
  );

  return $items;
}

/**
 * Delete all heartbeat activity logs.
 */
function drush_clear_activity_all() {
  if (!drush_confirm( dt('Are you sure you want to delete all content from the heartbeat activity database table?') )) {
    return drush_user_abort();
  }

  // Delete all the rows in the table 'heartbeat_activity'.
  heartbeat_activity_delete(array(), TRUE);
  drush_log( dt('All activity has been removed from the database.'), 'ok' );
}
