From 3cf58493862b11e183b02a970673acc92e049715 Mon Sep 17 00:00:00 2001 From: stodorovic Date: Mon, 27 Aug 2018 14:38:10 +0200 Subject: [PATCH] Uses is_multisite() instead of constants --- plugins/multisite.php | 2 +- wp-cache-base.php | 4 ++-- wp-cache.php | 9 ++++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/multisite.php b/plugins/multisite.php index 6306a160..df71f9ac 100644 --- a/plugins/multisite.php +++ b/plugins/multisite.php @@ -1,6 +1,6 @@ \n"; - if ( ( defined( 'VHOST' ) || defined( 'SUBDOMAIN_INSTALL' ) || defined( 'SUNRISE' ) || ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) == true ) ) && wpsupercache_site_admin() ) { + if ( is_multisite() && wpsupercache_site_admin() ) { echo '
'; echo ''; echo '
'; @@ -2856,7 +2856,7 @@ function wp_cache_delete_buttons() { echo '
'; wp_nonce_field('wp-cache'); echo "
\n"; - if ( ( defined( 'VHOST' ) || defined( 'SUBDOMAIN_INSTALL' ) || defined( 'SUNRISE' ) || ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) == true ) ) && wpsupercache_site_admin() ) { + if ( is_multisite() && wpsupercache_site_admin() ) { echo '
'; echo ''; echo '
'; @@ -2992,6 +2992,8 @@ function wp_cache_clean_legacy_files( $dir, $file_prefix ) { return false; if ( $handle = @opendir( $dir ) ) { + $curr_blog_id = is_multisite() ? get_current_blog_id() : false; + while ( false !== ( $file = readdir( $handle ) ) ) { if ( is_file( $dir . $file ) == false || $file == 'index.html' ) { continue; @@ -3004,8 +3006,9 @@ function wp_cache_clean_legacy_files( $dir, $file_prefix ) { @unlink( $dir . 'meta/' . str_replace( '.html', '.meta', $file ) ); } else { $meta = json_decode( wp_cache_get_legacy_cache( $dir . 'meta/' . $file ), true ); - if ( ( defined( 'VHOST' ) || defined( 'SUBDOMAIN_INSTALL' ) || defined( 'SUNRISE' ) || ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) == true ) ) && $meta[ 'blog_id' ] != $wpdb->blogid ) + if ( $curr_blog_id && $curr_blog_id !== (int)$meta['blog_id'] ) { continue; + } @unlink( $dir . $file); @unlink( $dir . 'meta/' . $file); }