You are here

function _feedapi_store_stat in FeedAPI 5

Same name and namespace in other branches
  1. 6 feedapi.module \_feedapi_store_stat()

Store statistics information

Parameters

$id: A numerical id

$type: A string which describes what we want to store. This is an identifier, think of as a variable name

$val: This is the variable value

$timestamp: Timestamp for the value

$time: Optional, a string equivalent to the $timestamp

$update: Boolean, TRUE if you'd like to modify an existing entry in the stat table

1 call to _feedapi_store_stat()
_feedapi_invoke_refresh in ./feedapi.module
Helper function for feedapi_invoke(). Refresh the feed, call the proper parsers and processors' hooks. Don't call this function directly, use feedapi_refresh() instead.

File

./feedapi.module, line 1477
Handle the submodules (for feed and item processing) Provide a basic management of feeds

Code

function _feedapi_store_stat($id, $type, $val, $timestamp, $time = NULL, $update = FALSE) {
  if (!$time) {
    $time = date("Y-m-d H:i", $timestamp);
  }
  if ($update) {
    db_query("UPDATE {feedapi_stat} SET value = %d, timestamp = %d WHERE time = '%s' AND type = '%s' AND id = %d", $val, $timestamp, $time, $type, $id);
  }
  if (!$update || !db_affected_rows()) {
    db_query("INSERT INTO {feedapi_stat} (id, value, time, timestamp, type) VALUES (%d, %d, '%s', %d, '%s')", $id, $val, $time, $timestamp, $type);
  }
}