Created
January 15, 2017 08:21
-
-
Save rluisr/398f6581d2f5bce24c505351c0c1d653 to your computer and use it in GitHub Desktop.
check wordpress WP_CACHE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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