-
Notifications
You must be signed in to change notification settings - Fork 124
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
Postponed blog detection on WP >= 4.6 #590
Conversation
It simplifies things but does it fix a problem on MS sites? |
It should be first step. Main change is: if ( is_multisite() && $wpsc_wp_gte_46 && empty( $wp_super_cache_late_init ) ) {
add_action( 'ms_loaded', 'wp_cache_serve_cache_file' );
}
For test, I've added code: // Fixes $blogcacheid and $blog_cache_dir if ms-settings.php is loaded.
if ( is_multisite() && is_object( $current_blog ) ) {
$old_blogcacheid = $blogcacheid;
$old_blog_cache_dir = $blog_cache_dir;
require WPCACHEHOME . 'wp-cache-base.php';
if ( $old_blogcacheid != $blogcacheid || $old_blog_cache_dir = $blog_cache_dir ) {
$duration = wp_cache_microtime_diff($GLOBALS['wp_start_time'], microtime()) * 1000;
$duration = sprintf("%.0f", $duration);
wp_cache_debug( 'Blog ID/Dir changed (ms_loaded delay - '.$duration.'ms): '. $old_blogcacheid.'=>'.$blogcacheid.' '.$old_blog_cache_dir.'=>'.$blog_cache_dir );
}
} One example:
Main issue is "delete cache" (these blogs - category in example don't exist). I'm not sure for other side effects. Anyway, it needs more testing, but I think that this will fix main issues. I'm still working on it and I'm cleaning old code. Also, I'll try to re-read issues on wordpress.org. Maybe I figure out more details. |
I merged #592 first because this touches a lot of code and looks like it'll be hard to test fully. I also want to get a quick fix out for the fatal error updating posts. |
No problem. I agree that's hard to check. I'm planning to split into couple PRs. |
I just created #600 which contains one part of this PR. |
is_multisite
. It's safe because it's defined inwp-includes/load.php
.ms_loaded
( This action fires after multisite's bootstrap has finished and when the$current_site
and$current_blog
globals are populated). Running of functionwp_cache_serve_cache_file
is little postponed to we can get correct blog's domain and path (It loads few more files - probably 15-30ms more for multisite installations before serving file).