You are here

function callback_mostpopular_next_run in Drupal Most Popular 7

Implements the 'next_run' callback.

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.:

1 string reference to 'callback_mostpopular_next_run'
hook_mostpopular_service_info in ./mostpopular.api.inc
Defines one or more Most Popular services provided by this module.

File

./mostpopular.api.inc, line 132
Provides examples of the hooks and callbacks that can be implemented to add new services to the Most Popular framework.

Code

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