You are here

public static function MostPopularLastRun::fetch in Drupal Most Popular 6

Same name and namespace in other branches
  1. 7 classes/lastrun.php \MostPopularLastRun::fetch()

Fetches the last run data for the given service and interval.

If there is not yet any saved data for this service and interval, this function creates and returns new data.

Parameters

integer $sid: The service ID.

integer $iid: The interval ID.

Return value

MostPopularLastRun The data for the last time the service was run, or a new object if the service has not yet run.

5 calls to MostPopularLastRun::fetch()
mostpopular_get_last_run in ./mostpopular.api.php
Gets the last time the given service was run for the given interval. If no interval is specified, gets the most recent time for any interval.
mostpopular_get_throttle in ./mostpopular.api.php
Gets the throttle setting for the given service and interval.
mostpopular_refresh in ./mostpopular.api.php
Refreshes data from each service by invoking hook_mostpopular_service('refresh').
mostpopular_service_config_form in ./mostpopular.admin.inc
mostpopular_service_config_form_submit in ./mostpopular.admin.inc

File

classes/lastrun.php, line 213
Defines a wrapper for the mostpopular_last_run table.

Class

MostPopularLastRun
@file Defines a wrapper for the mostpopular_last_run table.

Code

public static function fetch($sid, $iid) {
  $out = array();
  $sql = 'SELECT * FROM {' . self::$table . '} WHERE sid = %d AND iid = %d';
  $result = db_query($sql, (int) $sid, (int) $iid);
  if ($row = db_fetch_object($result)) {
    return new MostPopularLastRun($row);
  }
  return self::create($sid, $iid);
}