Skip to content

Instantly share code, notes, and snippets.

@rluisr
Created January 15, 2017 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rluisr/398f6581d2f5bce24c505351c0c1d653 to your computer and use it in GitHub Desktop.
Save rluisr/398f6581d2f5bce24c505351c0c1d653 to your computer and use it in GitHub Desktop.
check wordpress WP_CACHE
<?php
function check_cache()
{
$path = preg_replace("/wp-content/", " ", WP_CONTENT_DIR);
$path = trim($path);
$wp_config = file_get_contents("${path}wp-config.php");
if (preg_match("/^define\('WP_CACHE',\s*true\);/mi", $wp_config) === 1) {
file_put_contents(WP_CONTENT_DIR . '/block-wpscan/cache_status', "1", LOCK_EX);
add_action('admin_notices', 'admin_cache_enable');
} else {
file_put_contents(WP_CONTENT_DIR . '/block-wpscan/cache_status', "0", LOCK_EX);
remove_action('admin_notices', 'admin_cache_enable');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment