function super_cache_invalidate() { //Now, we are actually using the referrer and not the request, with some precautions $GLOBALS['wp_cache_request_uri'] = substr($_SERVER['HTTP_REFERER'], stripos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']) + strlen($_SERVER[''] . $_SERVER['HTTP_HOST'])); $GLOBALS['wp_cache_request_uri'] = preg_replace('/[ <>\'\\"\\r\\n\\t\\(\\)]/', '', str_replace('/index.php', '/', str_replace('..', '', preg_replace("/(\\?.*)?\$/", '', $GLOBALS['wp_cache_request_uri'])))); // get some supercache variables extract(wp_super_cache_init()); tp_logger(wp_super_cache_init()); // this is hackery for logged in users, a cookie is added to the request somehow and gzip is not correctly set, so we forcefully fix this if (!$cache_file) { $GLOBALS['wp_cache_gzip_encoding'] = gzip_accepted(); unset($_COOKIE[key($_COOKIE)]); extract(wp_super_cache_init()); tp_logger(wp_super_cache_init()); } $dir = get_current_url_supercache_dir(); // delete possible files that we can figure out, not deleting files for other cookies for example, but will do the trick in most cases $cache_fname = "{$dir}index.html"; tp_logger("attempting delete of supercache: {$cache_fname}"); @unlink($cache_fname); $cache_fname = "{$dir}index.html.gz"; tp_logger("attempting delete of supercache: {$cache_fname}"); @unlink($cache_fname); tp_logger("attempting delete of wp_cache: {$cache_file}"); @unlink($cache_file); tp_logger("attempting delete of wp_cache_meta: {$meta_pathname}"); @unlink($meta_pathname); // go at edit pages too $GLOBALS['wp_cache_request_uri'] .= "?edit=1"; extract(wp_super_cache_init()); tp_logger(wp_super_cache_init()); tp_logger("attempting delete of edit_wp_cache: {$cache_file}"); @unlink($cache_file); tp_logger("attempting delete of edit_wp_cache_meta: {$meta_pathname}"); @unlink($meta_pathname); }
function wp_cache_postload() { global $cache_enabled, $wp_super_cache_late_init, $wp_super_cache_debug; if (!$cache_enabled) { return true; } if (isset($wp_super_cache_late_init) && true == $wp_super_cache_late_init) { if (isset($wp_super_cache_debug) && $wp_super_cache_debug) { wp_cache_debug("Supercache Late Init: add wp_cache_serve_cache_file to init", 3); } add_action('init', 'wp_cache_late_loader', 9999); } else { wp_super_cache_init(); wp_cache_phase2(); } }