Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uses is_multisite() instead of constants #600

Merged
merged 1 commit into from
Sep 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/multisite.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

if ( ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) === true ) || defined( 'SUBDOMAIN_INSTALL' ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) ) {
if ( is_multisite() ) {
add_cacheaction( 'add_cacheaction', 'wp_super_cache_multisite_init' );
}

Expand Down
4 changes: 2 additions & 2 deletions wp-cache-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

// We want to be able to identify each blog in a WordPress MU install
$blogcacheid = '';
if ( ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) == true ) || defined( 'SUBDOMAIN_INSTALL' ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) ) {
if ( is_multisite() ) {
$blogcacheid = 'blog'; // main blog
if ( defined( 'SUBDOMAIN_INSTALL' ) && constant( 'SUBDOMAIN_INSTALL' ) == true ) {
if ( ( defined('SUBDOMAIN_INSTALL') && SUBDOMAIN_INSTALL ) || ( defined( 'VHOST' ) && VHOST == 'yes' ) ) {
$blogcacheid = $WPSC_HTTP_HOST;
} else {
if ( isset( $base ) == false ) {
Expand Down
9 changes: 6 additions & 3 deletions wp-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ function toggleLayer( whichLayer ) {
wp_nonce_field('wp-cache');
echo "</form>\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 '<form name="wp_cache_content_delete" action="#listfiles" method="post">';
echo '<input type="hidden" name="wp_delete_all_cache" />';
echo '<div class="submit"><input id="deleteallpost" class="button-secondary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Delete Cache On All Blogs', 'wp-super-cache' ) . '" /></div>';
Expand Down Expand Up @@ -2856,7 +2856,7 @@ function wp_cache_delete_buttons() {
echo '<div class="submit" style="float:left;margin-left:10px"><input id="deletepost" class="button-secondary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Delete Cache', 'wp-super-cache' ) . '" /></div>';
wp_nonce_field('wp-cache');
echo "</form>\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 '<form name="wp_cache_content_delete" action="#listfiles" method="post">';
echo '<input type="hidden" name="wp_delete_all_cache" />';
echo '<div class="submit" style="float:left;margin-left:10px"><input id="deleteallpost" class="button-secondary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Delete Cache On All Blogs', 'wp-super-cache' ) . '" /></div>';
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down