You are here

statspro.drush.inc in Statistics Pro 6

Same filename and directory in other branches
  1. 6.2 statspro.drush.inc

Drush include file for statuspro

File

statspro.drush.inc
View source
<?php

/**
 * @file
 *   Drush include file for statuspro
 *
 */

/**
 * Implementation of hook_drush_help().
 */
function statspro_drush_help($section) {
  switch ($section) {
    case 'drush:statspro':
      return dt('Usage: drush [options] statspro [aliases|comments|error|modules|nodes|node_types|pi|sessions|terms|uerror|upi|users|uwarning|warning]');
  }
}

/**
 * Implementation of hook_drush_command().
 *
 * @return array
 */
function statspro_drush_command() {
  $items = array();
  $items['statspro'] = array(
    'callback' => 'statspro_drush_run',
    'description' => 'statspro drush commands',
  );
  return $items;
}

/**
 * Run drush command for specified mode
 *
 */
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');
  }
}

Functions

Namesort descending Description
statspro_drush_command Implementation of hook_drush_command().
statspro_drush_help Implementation of hook_drush_help().
statspro_drush_run Run drush command for specified mode