You are here

public static function MostPopularLastRun::fetchAll in Drupal Most Popular 7

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

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

Parameters

integer $sid: The service ID. If null, all services are returned.

integer $iid: The interval ID. If null, all intervals are returned.

Return value

array<MostPopularLastRun> An array of last run data for the given service and interval.

2 calls to MostPopularLastRun::fetchAll()
MostPopularLastRun::resetLastRun in classes/lastrun.php
Resets the last time the specified service was run.
MostPopularLastRun::resetThrottles in classes/lastrun.php
Resets the throttles for the given service to the defaults.

File

classes/lastrun.php, line 174
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 fetchAll($sid = NULL, $iid = NULL) {
  $where = array();
  $params = array();
  if (isset($sid)) {
    $where[] = 'sid = %d';
    $params[] = (int) $sid;
  }
  if (isset($iid)) {
    $where[] = 'iid = %d';
    $params[] = (int) $iid;
  }
  $sql = 'SELECT * FROM {' . self::$table . '}';
  if (count($where) > 0) {
    $sql .= ' WHERE ' . implode(' AND ', $where);
  }
  $out = array();
  $result = db_query($sql, $params);
  while ($row = db_fetch_object($result)) {
    $out[] = new MostPopularLastRun($row);
  }
  return $out;
}