You are here

function boost_set_db_page_settings in Boost 6

Sets per page configuration.

Parameters

$lifetime: Default lifetime

$push: Pre-cache this file

$scope: At what level does this effect cache expiration

1 call to boost_set_db_page_settings()
boost_block_db_settings_form_submit in ./boost.module
Sets page specific settings in the boost cache database.

File

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

Code

function boost_set_db_page_settings($lifetime, $push, $scope) {
  $router_item = _boost_get_menu_router();
  $filename = boost_file_path($GLOBALS['_boost_path']);
  $info = boost_get_db($filename);
  if (!$info) {
    $info['expire'] = 0;
  }
  elseif ($lifetime == -1) {
    $info['expire'] = $info['expire'] - $info['lifetime'] + BOOST_CACHE_LIFETIME;
  }
  elseif ($info['lifetime'] == -1) {
    $info['expire'] = $info['expire'] - BOOST_CACHE_LIFETIME + $lifetime;
  }
  elseif ($info['lifetime'] != $lifetime) {
    $info['expire'] = $info['expire'] - $info['lifetime'] + $lifetime;
  }

  // Clear old files so they acquire the new settings.
  $data = array();
  switch ($scope) {
    case 0:
      $data[] = array(
        'base_dir' => BOOST_FILE_PATH,
        'page_callback' => $router_item['page_callback'],
        'page_type' => $router_item['page_type'],
        'page_id' => $router_item['page_id'],
      );
      break;
    case 1:
      $data[] = array(
        'base_dir' => BOOST_FILE_PATH,
        'page_callback' => $router_item['page_callback'],
        'page_type' => $router_item['page_type'],
      );
      break;
    case 2:
      $data[] = array(
        'base_dir' => BOOST_FILE_PATH,
        'page_callback' => $router_item['page_callback'],
      );
      break;
  }
  boost_put_settings_db($lifetime, $push, $router_item, $scope);
  $count = 0;
  if ($data) {
    $count += boost_cache_expire_router($data);
  }
  return $count;
}