2

I installed Boost and the page cached by boost will have a line of message at the bottom of view-source.

<!-- Page cached by Boost @ 2014-11-08 14:04:46, expires @ 2014-11-09 14:04:46, lifetime 1 day -->

How to remove the above line?

1 Answer 1

2

This is not possible in the 7.x-1.x version of the module (unless you patch the code). You should file a feature request in the Boost issue queue.

If you want to temporarily patch the code, open the file boost.module, around line 1145:

  $types['text/html'] = array(
    'title'           => t('HTML'),
    'description'     => t('HTML output, usually a webpage'),
    'extension'       => 'html',
    'enabled'         => TRUE,
    'gzip'            => TRUE,
    'lifetime_max'    => 3600,
    'lifetime_min'    => 0,
    'comment_start'  => NULL, // <--- set to null
    'comment_end'    => NULL, // <--- this too
    'variants'        => array(),
  );

If you would like to contribute a patch, which would be greatly appreciated, the right way to do this would be to modify the boost_exit() function, around line 315:

  // Add note to bottom of content if possible.
  if ($_boost['matched_header_info']['comment_start'] && $_boost['matched_header_info']['comment_end'] && $_boost['matched_header_info']['comment_footer_enabled']) {
    $expire = $_boost['matched_header_info']['lifetime_max'];
    $cached_at = date('Y-m-d H:i:s', REQUEST_TIME);
    $expires_at = date('Y-m-d H:i:s', REQUEST_TIME + $expire);
    $note = "\n" . $_boost['matched_header_info']['comment_start'] . 'Page cached by Boost @ ' . $cached_at . ', expires @ ' . $expires_at . ', lifetime ' . format_interval($expire) . $_boost['matched_header_info']['comment_end'];
    $data .= $note;
  }

You would also have to set the default (TRUE) in boost_boost_storage_types(), and to the $keys in boost_get_storage_types() so that it does the variable_get(). Bonus points for also exposing it to the admin interface.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.