function drush_ga_stats_generate_validate in Google Analytics Statistics 7.2
Same name and namespace in other branches
- 7 ga_stats.drush.inc \drush_ga_stats_generate_validate()
Implements hook_drush_COMMAND_validate().
File
- ./
ga_stats.drush.inc, line 40
Code
function drush_ga_stats_generate_validate() {
module_load_include('.inc', 'ga_stats', 'inc/ga');
$metric = drush_get_option('metric', 'pageviews');
$options = ga_stats_ga_metrics(TRUE);
if (!array_key_exists($metric, $options)) {
drush_set_option('metric', drush_choice($options));
}
$timeframe = drush_get_option('timeframe', 'month');
$options = ga_stats_ga_timeframes(FALSE, TRUE);
if (!array_key_exists($timeframe, $options)) {
drush_set_option('timeframe', drush_choice($options));
}
$range = drush_get_option('range', 1000);
if (!is_numeric($range) || $range < 1) {
return drush_set_error('Range must be an integer greater than 1.');
}
}