/[drupal]/contributions/modules/boost/boost.module
ViewVC logotype

Diff of /contributions/modules/boost/boost.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.3.2.2.2.5.2.248, Fri Nov 13 23:10:07 2009 UTC revision 1.3.2.2.2.5.2.249, Sat Nov 14 20:41:19 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: boost.module,v 1.3.2.2.2.5.2.247 2009/11/13 23:07:32 mikeytown2 Exp $  // $Id: boost.module,v 1.3.2.2.2.5.2.248 2009/11/13 23:10:07 mikeytown2 Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 1251  function theme_boost_cache_status($ttl, Line 1251  function theme_boost_cache_status($ttl,
1251   */   */
1252  function _boost_ob_handler() {  function _boost_ob_handler() {
1253    $buffer = ob_get_contents();    $buffer = ob_get_contents();
1254      // If Compressed data was given to us decompress it
1255      if (boost_headers_contain('gzip')) {
1256        $decompressed_buffer = gzinflate(substr(substr($buffer, 10), 0, -8));
1257      }
1258      else {
1259        $decompressed_buffer = $buffer;
1260      }
1261    
1262    // Ensure we're in the correct working directory, since some web servers (e.g. Apache) mess this up here.    // Ensure we're in the correct working directory, since some web servers (e.g. Apache) mess this up here.
1263    chdir(dirname($_SERVER['SCRIPT_FILENAME']));    chdir(dirname($_SERVER['SCRIPT_FILENAME']));
# Line 1282  function _boost_ob_handler() { Line 1289  function _boost_ob_handler() {
1289    // Check the currently set content type and the HTTP response code. only cache    // Check the currently set content type and the HTTP response code. only cache
1290    // 'text/*' pages that were output with a 200 OK status. If it didn't get a    // 'text/*' pages that were output with a 200 OK status. If it didn't get a
1291    // 200 then remove that entry from the cache.    // 200 then remove that entry from the cache.
1292    if (!empty($buffer)) {    if (!empty($decompressed_buffer)) {
1293      $status = boost_get_http_status();      $status = boost_get_http_status();
1294      $types = boost_get_content_type();      $types = boost_get_content_type();
1295      if (BOOST_VERBOSE >= 7) {      if (BOOST_VERBOSE >= 7) {
# Line 1294  function _boost_ob_handler() { Line 1301  function _boost_ob_handler() {
1301          if (BOOST_ASYNCHRONOUS_OUTPUT) {          if (BOOST_ASYNCHRONOUS_OUTPUT) {
1302            boost_async_opp($buffer, FALSE, 'text/javascript');            boost_async_opp($buffer, FALSE, 'text/javascript');
1303          }          }
1304          boost_cache_set($GLOBALS['_boost_path'], $buffer, BOOST_JSON_EXTENSION);          boost_cache_set($GLOBALS['_boost_path'], $decompressed_buffer, BOOST_JSON_EXTENSION);
1305        }        }
1306        elseif ($status == 404 || $status == 403) {        elseif ($status == 404 || $status == 403) {
1307          $filename = boost_file_path($GLOBALS['_boost_path'], TRUE, BOOST_JSON_EXTENSION);          $filename = boost_file_path($GLOBALS['_boost_path'], TRUE, BOOST_JSON_EXTENSION);
# Line 1305  function _boost_ob_handler() { Line 1312  function _boost_ob_handler() {
1312          if (BOOST_ASYNCHRONOUS_OUTPUT) {          if (BOOST_ASYNCHRONOUS_OUTPUT) {
1313            boost_async_opp($buffer, FALSE, 'text/xml');            boost_async_opp($buffer, FALSE, 'text/xml');
1314          }          }
1315          boost_cache_set($GLOBALS['_boost_path'], $buffer, BOOST_XML_EXTENSION);          boost_cache_set($GLOBALS['_boost_path'], $decompressed_buffer, BOOST_XML_EXTENSION);
1316        }        }
1317        elseif ($status == 404 || $status == 403) {        elseif ($status == 404 || $status == 403) {
1318          $filename = boost_file_path($GLOBALS['_boost_path'], TRUE, BOOST_XML_EXTENSION);          $filename = boost_file_path($GLOBALS['_boost_path'], TRUE, BOOST_XML_EXTENSION);
# Line 1316  function _boost_ob_handler() { Line 1323  function _boost_ob_handler() {
1323          if (BOOST_ASYNCHRONOUS_OUTPUT) {          if (BOOST_ASYNCHRONOUS_OUTPUT) {
1324            boost_async_opp($buffer, FALSE, 'text/html');            boost_async_opp($buffer, FALSE, 'text/html');
1325          }          }
1326          boost_cache_set($GLOBALS['_boost_path'], $buffer, BOOST_FILE_EXTENSION);          boost_cache_set($GLOBALS['_boost_path'], $decompressed_buffer, BOOST_FILE_EXTENSION);
1327          boost_cache_css_js_files($buffer);          boost_cache_css_js_files($decompressed_buffer);
1328        }        }
1329        elseif ($status == 404 || $status == 403) {        elseif ($status == 404 || $status == 403) {
1330          // Kill cache entry if it exists          // Kill cache entry if it exists
# Line 2067  function boost_cache_set($path, $data, $ Line 2074  function boost_cache_set($path, $data, $
2074      return FALSE;      return FALSE;
2075    }    }
2076    
   // If Compressed data was given to us decompress it  
   if (boost_headers_contain('gzip')) {  
     $data = gzinflate(substr(substr($data, 10), 0, -8));  
   }  
   
2077    $cached_at = date('Y-m-d H:i:s', BOOST_TIME);    $cached_at = date('Y-m-d H:i:s', BOOST_TIME);
2078    // Code commenting style based on what is being cached.    // Code commenting style based on what is being cached.
2079    // Append the Boost footer with the relevant timestamps    // Append the Boost footer with the relevant timestamps

Legend:
Removed from v.1.3.2.2.2.5.2.248  
changed lines
  Added in v.1.3.2.2.2.5.2.249

  ViewVC Help
Powered by ViewVC 1.1.2