You are here

function ga_stats_data_expiration_date in Google Analytics Statistics 7

Same name and namespace in other branches
  1. 7.2 ga_stats.module \ga_stats_data_expiration_date()

Calculate when the analytics data will expire.

Return value

int

4 calls to ga_stats_data_expiration_date()
drush_ga_stats_update in ./ga_stats.drush.inc
Command callback for ga-stats-update.
ga_stats_needs_update in ./ga_stats.module
Determine if a scheduled statistics update is needed.
ga_stats_requirements in ./ga_stats.install
Implements hook_requirements().
ga_stats_update_counts_submit in ./ga_stats.admin.inc
Submit callback to update the statistics data.

File

./ga_stats.module, line 68

Code

function ga_stats_data_expiration_date() {
  $last = variable_get('ga_stats_last_update', 0);
  $timeframe = variable_get('ga_stats_enabled_timeframes', array(
    'today' => TRUE,
    'month' => TRUE,
  ));

  // Save the data for 10 or 30 minutes (based on whether hourly data is enabled)
  // @todo clarify why this seems arbitrary.
  if (array_key_exists('hour', $timeframe)) {
    $expiration = 60 * 10;
  }
  else {
    $expiration = 60 * 30;
  }
  return $last + $expiration;
}