boost.blocks.inc

  1. cis7 sites/all/modules/ulmus/boost/boost.blocks.inc
  2. cle7 sites/all/modules/ulmus/boost/boost.blocks.inc
  3. ecd7 sites/all/modules/ulmus/boost/boost.blocks.inc
  4. elmsmedia7 sites/all/modules/ulmus/boost/boost.blocks.inc
  5. harmony7 sites/all/modules/ulmus/boost/boost.blocks.inc
  6. icor7 sites/all/modules/ulmus/boost/boost.blocks.inc
  7. meedjum_blog7 sites/all/modules/ulmus/boost/boost.blocks.inc
  8. mooc7 sites/all/modules/ulmus/boost/boost.blocks.inc

Functions

Namesort descending Description
boost_block_flush_form
boost_block_flush_form_submit
boost_block_view_status Prints the cache status of the currently displayed page.

File

sites/all/modules/ulmus/boost/boost.blocks.inc
View source
  1. <?php
  2. /**
  3. * Prints the cache status of the currently displayed page.
  4. *
  5. * see @boost_block_view()
  6. */
  7. function boost_block_view_status() {
  8. global $user;
  9. $block = array();
  10. $block['subject'] = '';
  11. // Don't show the block to anonymous users
  12. if (! $user->uid) {
  13. return $block;
  14. }
  15. // Do not use the global $_boost to not confuse hook_exit()
  16. $_boost = boost_transform_url();
  17. // Unset these variables otherwise boost_is_cacheable() will quickly bail out.
  18. unset($_boost['is_cacheable']);
  19. unset($_boost['is_cacheable_reason']);
  20. $_boost = boost_is_cacheable($_boost, 'status');
  21. if (! $_boost['is_cacheable']) {
  22. $reason = ($_boost['is_cacheable_reason'] ? $_boost['is_cacheable_reason'] : 'reason unknown');
  23. $block['content']['is_not_cacheable'] = array(
  24. '#markup' => '<p>' . t('This page will not be cached: %reason', array('%reason' => $reason)) . '</p>',
  25. );
  26. return $block;
  27. }
  28. // We need the extention for the filename
  29. $_boost['header_info'] = boost_get_header_info();
  30. $_boost['matched_header_info'] = boost_match_header_attributes($_boost['header_info']);
  31. $filename = (isset($_boost['filename']) ? $_boost['filename'] . '.' . $_boost['matched_header_info']['extension'] : 'n/a');
  32. if (file_exists($filename)) {
  33. // be precise on the time (seconds and timezone)
  34. $generated = date('c', filemtime($filename));
  35. }
  36. else {
  37. $generated = 'not cached yet (either no one has visited the page recently, or something is preventing the cache from being generated).';
  38. }
  39. $block['content'] = array(
  40. 'filename' => array(
  41. '#markup' => '<p>' . t('File: %filename', array('%filename' => $filename)) . '</p>',
  42. ),
  43. 'generated' => array(
  44. '#markup' => '<p>' . t('Generated: %generated', array('%generated' => $generated)) . '</p>',
  45. ),
  46. );
  47. if (file_exists($filename) && user_access('boost flush pages')) {
  48. $block['content']['flush'] = array(
  49. '#markup' => drupal_render(drupal_get_form('boost_block_flush_form')),
  50. );
  51. }
  52. return $block;
  53. }
  54. function boost_block_flush_form() {
  55. $form = array();
  56. $form['boost_cache']['clear'] = array(
  57. '#type' => 'submit',
  58. '#value' => t('Flush Page'),
  59. );
  60. return $form;
  61. }
  62. function boost_block_flush_form_submit() {
  63. $_boost = boost_transform_url();
  64. // We need the extention for the filename
  65. $_boost['header_info'] = boost_get_header_info();
  66. $_boost['matched_header_info'] = boost_match_header_attributes($_boost['header_info']);
  67. $filename = $_boost['filename'] . '.' . $_boost['matched_header_info']['extension'];
  68. if (is_file($filename)) {
  69. if (unlink($filename)) {
  70. drupal_set_message(t('%filename was deleted from the Boost cache', array('%filename' => $filename)));
  71. }
  72. else {
  73. drupal_set_message(t('%filename could not be deleted, check file permissions on disk to see if the web server can write/delete the file.', array('%filename' => $filename)));
  74. }
  75. }
  76. else {
  77. drupal_set_message(t('%filename was not found in the Boost cache and could not be deleted.', array('%filename' => $filename)));
  78. }
  79. }
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.