You are here

function statspro_drush_run in Statistics Pro 6

Same name and namespace in other branches
  1. 6.2 statspro.drush.inc \statspro_drush_run()

Run drush command for specified mode

1 string reference to 'statspro_drush_run'
statspro_drush_command in ./statspro.drush.inc
Implementation of hook_drush_command().

File

./statspro.drush.inc, line 40
Drush include file for statuspro

Code

function statspro_drush_run() {
  $modes = func_get_args();
  if (empty($modes)) {
    drush_die('Missing mode: use drush help statspro for more information');
  }
  require_once drupal_get_path('module', 'statspro') . '/statspro.inc';
  $statspro = new statspro();
  drush_print(t('Statistics Pro information'));
  $rc = $statspro
    ->get_aggregate_stat($modes[0]);
  if (is_array($rc)) {
    drush_print($rc['subject'] . ': ' . $rc['amount']);
  }
  else {
    drush_die('Unknown mode');
  }
}