You are here

function mostpopular_default_next_run in Drupal Most Popular 7

Implements the default 'next_run' callback, for services that don't provide their own.

Returns the timestamp at which to next refresh the data for this interval.

Parameters

object $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

./mostpopular.module, line 974
The main file for the Most Popular module.

Code

function mostpopular_default_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);
}