8000 Don't load wp-cache-config.php if it's already loaded by stodorovic · Pull Request #605 · Automattic/wp-super-cache · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Don't load wp-cache-config.php if it's already loaded #605

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

Merged
Merged
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
34 changes: 17 additions & 17 deletions wp-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,13 @@ function wpsc_init() {
global $wp_cache_mobile, $wp_cache_mobile_enabled, $wp_cache_mobile_browsers, $wp_cache_mobile_prefixes;
global $wp_cache_config_file, $wp_cache_config_file_sample;

// WP-CLI: Hotfix for $blog_cache_dir for single site. It'll be removed after merging #590
if ( empty( $GLOBALS['blog_cache_dir'] ) && ! is_multisite() ) {
$GLOBALS['blog_cache_dir'] = $cache_path;
}

if( !@include($wp_cache_config_file) ) {
get_wpcachehome();
$wp_cache_config_file_sample = WPCACHEHOME . 'wp-cache-config-sample.php';
@include($wp_cache_config_file_sample);
} else {
get_wpcachehome();
// Check is cache config already loaded.
if ( ! isset( $cache_enabled, $super_cache_enabled, $wp_cache_mod_rewrite, $cache_path ) &&
8000 empty( $wp_cache_phase1_loaded ) &&
// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
! @include( $wp_cache_config_file )
) {
@include $wp_cache_config_file_sample; // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
}

include(WPCACHEHOME . 'wp-cache-base.php');
Expand Down Expand Up @@ -116,13 +112,17 @@ function wp_cache_set_home() {
include_once( WPCACHEHOME . 'ossdl-cdn.php' );

function get_wpcachehome() {
if( defined( 'WPCACHEHOME' ) == false ) {
if( is_file( dirname(__FILE__) . '/wp-cache-config-sample.php' ) ) {
define( 'WPCACHEHOME', trailingslashit( dirname(__FILE__) ) );
} elseif( is_file( dirname(__FILE__) . '/wp-super-cache/wp-cache-config-sample.php' ) ) {
define( 'WPCACHEHOME', dirname(__FILE__) . '/wp-super-cache/' );
if ( function_exists( '_deprecated_function' ) ) {
_deprecated_function( __FUNCTION__, 'WP Super Cache 1.6.5' );
}

if ( ! defined( 'WPCACHEHOME' ) ) {
if ( is_file( dirname( __FILE__ ) . '/wp-cache-config-sample.php' ) ) {
define( 'WPCACHEHOME', trailingslashit( dirname( __FILE__ ) ) );
} elseif ( is_file( dirname( __FILE__ ) . '/wp-super-cache/wp-cache-config-sample.php' ) ) {
define( 'WPCACHEHOME', dirname( __FILE__ ) . '/wp-super-cache/' );
} else {
die( sprintf( __( 'Please create %s /wp-cache-config.php from wp-super-cache/wp-cache-config-sample.php', 'wp-super-cache' ), WP_CONTENT_DIR ) );
die( sprintf( esc_html__( 'Please create %s /wp-cache-config.php from wp-super-cache/wp-cache-config-sample.php', 'wp-super-cache' ), esc_attr( WP_CONTENT_DIR ) ) );
}
}
}
Expand Down
0