function boost_block_view_status

cis7 boost.blocks.inc boost_block_view_status()
cle7 boost.blocks.inc boost_block_view_status()
elmsmedia7 boost.blocks.inc boost_block_view_status()
icor7 boost.blocks.inc boost_block_view_status()
meedjum_blog7 boost.blocks.inc boost_block_view_status()
mooc7 boost.blocks.inc boost_block_view_status()

Prints the cache status of the currently displayed page.

see

Plugin annotation

@boost_block_view()
1 call to boost_block_view_status()
boost_block_view in sites/all/modules/ulmus/boost/boost.module
Implements hook_block_view().

File

sites/all/modules/ulmus/boost/boost.blocks.inc, line 8

Code

function boost_block_view_status() {
  global $user;

  $block = array();
  $block['subject'] = '';

  // Don't show the block to anonymous users
  if (! $user->uid) {
    return $block;
  }

  // Do not use the global $_boost to not confuse hook_exit()
  $_boost = boost_transform_url();

  // Unset these variables otherwise boost_is_cacheable() will quickly bail out.
  unset($_boost['is_cacheable']);
  unset($_boost['is_cacheable_reason']);

  $_boost = boost_is_cacheable($_boost, 'status');

  if (! $_boost['is_cacheable']) {
    $reason = ($_boost['is_cacheable_reason'] ? $_boost['is_cacheable_reason'] : 'reason unknown');
    $block['content']['is_not_cacheable'] = array(
      '#markup' => '<p>' . t('This page will not be cached: %reason', array('%reason' => $reason)) . '</p>',
    );

    return $block;
  }

  // We need the extention for the filename
  $_boost['header_info'] = boost_get_header_info();
  $_boost['matched_header_info'] = boost_match_header_attributes($_boost['header_info']);

  $filename = (isset($_boost['filename']) ? $_boost['filename'] . '.' . $_boost['matched_header_info']['extension'] : 'n/a');

  if (file_exists($filename)) {
    // be precise on the time (seconds and timezone)
    $generated = date('c', filemtime($filename));
  }
  else {
    $generated = 'not cached yet (either no one has visited the page recently, or something is preventing the cache from being generated).';
  }

  $block['content'] = array(
    'filename' => array(
      '#markup' => '<p>' . t('File: %filename', array('%filename' => $filename)) . '</p>',
    ),
    'generated' => array(
      '#markup' => '<p>' . t('Generated: %generated', array('%generated' => $generated)) . '</p>',
    ),
  );

  if (file_exists($filename) && user_access('boost flush pages')) {
    $block['content']['flush'] = array(
      '#markup' => drupal_render(drupal_get_form('boost_block_flush_form')),
    );
  }

  return $block;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.