public static function MostPopularItem::reset in Drupal Most Popular 7
Same name and namespace in other branches
- 6 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.
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);
}