function memcache_storage_init in Memcache Storage 7
Implements hook_init().
File
- ./
memcache_storage.module, line 83 - Provides hook implementation for Memcache Storage module.
Code
function memcache_storage_init() {
// If wildcards were not flushed for a while, then lets register a shutdown
// function which will do it.
$last_wildcards_flush = variable_get('memcache_storage_last_wildcards_flush');
$wildcards_flush_interval = variable_get('memcache_storage_wildcards_flush_interval', 3600);
if (REQUEST_TIME >= $last_wildcards_flush + $wildcards_flush_interval) {
drupal_register_shutdown_function('memcache_storage_wildcard_flush');
}
// Do nothing if debug mode is disabled.
if (!variable_get('memcache_storage_debug', FALSE)) {
return;
}
// Do nothing if user has no access to debug info.
if (!user_access('view memcache storage debug')) {
return;
}
// Trying not break normal site operating.
if (!strstr($_SERVER['PHP_SELF'], 'index.php') || strstr($_GET['q'], 'upload/js') || strstr($_GET['q'], 'admin/content/node-settings/rebuild') || strstr($_GET['q'], 'system') || strstr($_GET['q'], 'batch') || strstr($_GET['q'], 'ckeditor/xss') || strstr($_GET['q'], 'autocomplete')) {
return;
}
else {
drupal_add_library('system', 'drupal.ajax');
drupal_add_css(drupal_get_path('module', 'memcache_storage') . '/css/memcache_storage.css');
drupal_register_shutdown_function('memcache_storage_debug_shutdown');
// Avoid caching of pages with debug info in Drupal cache.
drupal_page_is_cacheable(FALSE);
// Avoid caching of pages with debug info in external cache.
drupal_add_http_header('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
}
}