You are here

function boost_put_db in Boost 6

Puts boost info into database.

Parameters

$filename: Name of cached file; hash of this is primary key in database

$expire: Expiration time

$lifetime: Default lifetime

$push: Pre-cache this file

$router_item: Array containing page_callback, page_type & page_id.

$timer: Time it took drupal to build this page.

$timer_average: Average time Drupal has spent building this page.

$extension: Filename extension: Used for content types.

$url: Optional: Full URL of cached page

$file_path: Optional: BOOST_FILE_PATH

2 calls to boost_put_db()
boost_db_prep in ./boost.module
Figure out what is going in the database & put it in
_boost_cache_insert in ./boost.module
Shutdown function, gets called at the very end of node creation.

File

./boost.module, line 4148
Provides static file caching for Drupal text output. Pages, Feeds, ect...

Code

function boost_put_db($filename, $expire, $lifetime, $push, $router_item, $timer, $timer_average, $extension, $url = NULL, $file_path = NULL) {
  global $base_root;
  $url = is_null($url) ? $base_root . request_uri() : $url;
  $file_path = is_null($file_path) ? BOOST_FILE_PATH : $file_path;
  $hash = md5($filename);
  if (variable_get('boost_store_url_percent_enc', FALSE)) {
    $url = urldecode(rawurlencode($url));
  }
  $hash_url = md5($url);
  db_query("UPDATE {boost_cache} SET expire = %d, lifetime = %d, push = %d, page_callback = '%s', page_type = '%s', timer = %d, timer_average = %d, base_dir = '%s', page_id = '%s', extension = '%s', url = '%s', filename = '%s', hash_url = '%s' WHERE hash = '%s'", $expire, $lifetime, $push, $router_item['page_callback'], $router_item['page_type'], $timer, $timer_average, $file_path, $router_item['page_id'], $extension, $url, $filename, $hash_url, $hash);
  if (!db_affected_rows()) {
    @db_query("INSERT INTO {boost_cache} (hash, hash_url, filename, expire, lifetime, push, page_callback, page_type, timer, timer_average, base_dir, page_id, extension, url) VALUES ('%s', '%s', '%s', %d, %d, %d, '%s', '%s', %d, %d, '%s', '%s', '%s', '%s')", $hash, $hash_url, $filename, $expire, $lifetime, $push, $router_item['page_callback'], $router_item['page_type'], $timer, $timer_average, $file_path, $router_item['page_id'], $extension, $url);
  }
}