You are here

public static function MostPopularItem::reset in Drupal Most Popular 6

Same name and namespace in other branches
  1. 7 classes/items.php \MostPopularItem::reset()

Clears the cached items for the given service and interval.

Parameters

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

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

3 calls to MostPopularItem::reset()
mostpopular_clear_caches in ./mostpopular.api.php
Clears all of the cached values from services, and resets the last time the service was run to 0.
mostpopular_intervals_form_submit in ./mostpopular.admin.inc
mostpopular_refresh in ./mostpopular.api.php
Refreshes data from each service by invoking hook_mostpopular_service('refresh').

File

classes/items.php, line 110
Defines a wrapper for the mostpopular_items table.

Class

MostPopularItem
@file Defines a wrapper for the mostpopular_items table.

Code

public static function reset($sid = NULL, $iid = NULL) {
  $where = array();
  $params = array();
  if (!empty($sid)) {
    $where[] = 'sid = %d';
    $params[] = $sid;
  }
  if (!empty($iid)) {
    $where[] = 'iid = %d';
    $params[] = $iid;
  }
  $sql = 'DELETE FROM {' . self::$table . '}';
  if (count($where)) {
    $sql .= ' WHERE ' . implode(' AND ', $where);
  }
  db_query($sql, $params);
}