function mostpopular_ga_next_run in Drupal Most Popular 7
Implements the 'next_run' callback for the GA Viewed mostpopular service.
Returns the timestamp at which to next refresh the data for this interval.
Parameters
array $service The service definition.:
integer $span The number of seconds representing the current interval.:
integer $last_run The timestamp at which this service was last run for this interval.:
File
- modules/
mostpopular_ga/ mostpopular_ga.module, line 200 - This module uses the Google Analytics API to provide Most Popular data.
Code
function mostpopular_ga_next_run($service, $span, $last_run) {
// If the interval is 2 days or less, refresh once per hour
if ($span <= 60 * 60 * 24 * 2) {
return strtotime('1 hour', $last_run);
}
elseif ($span >= 60 * 60 * 24 * 365) {
return strtotime('1 week', $last_run);
}
// Otherwise, refresh once per day.
return strtotime('1 day', $last_run);
}