You are here

function boost_set_cookie in Boost 7

Same name and namespace in other branches
  1. 6 boost.module \boost_set_cookie()

Sets a special cookie preventing authenticated users getting served pages from the static page cache.

Parameters

$uid: User ID Number

$expires: Expiration time

1 call to boost_set_cookie()
boost_cookie_handler in ./boost.module
Logic for the setting and removal of the boost cookie.

File

./boost.module, line 771
Caches generated output as a static file to be served directly from the webserver.

Code

function boost_set_cookie($uid, $expires = NULL) {
  if (!$expires) {
    $expires = ini_get('session.cookie_lifetime');
    $expires = !empty($expires) && is_numeric($expires) ? REQUEST_TIME + (int) $expires : 0;
    setcookie(BOOST_COOKIE, (string) $uid, $expires, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure') == '1');
  }
  else {
    setcookie(BOOST_COOKIE, '0', $expires, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure') == '1');
  }
}