diff --git a/readme.txt b/readme.txt index 4c966035..603a08ab 100644 --- a/readme.txt +++ b/readme.txt @@ -136,7 +136,7 @@ If that doesn't work, add this line to your wp-config.php: 27. Use [Cron View](https://wordpress.org/plugins/cron-view/) to help diagnose garbage collection and preload problems. Use the plugin to make sure jobs are scheduled and for what time. Look for the wp_cache_gc and wp_cache_full_preload_hook jobs. 18. The error message, "WP Super Cache is installed but broken. The constant WPCACHEHOME must be set in the file wp-config.php and point at the WP Super Cache plugin directory." appears at the end of every page. You can delete wp-content/advanced-cache.php and reload the plugin settings page or edit wp-config.php and look for WPCACHEHOME and make sure it points at the wp-super-cache folder. This will normally be wp-content/plugins/wp-super-cache/ but you'll likely need the full path to that file (so it's easier to let the settings page fix it). If it is not correct the caching engine will not load. 19. If your server is running into trouble because of the number of semaphores used by the plugin it's because your users are using file locking which is not recommended (but is needed by a small number of users). You can globally disable file locking by defining the constant WPSC_DISABLE_LOCKING, or defining the constant WPSC_REMOVE_SEMAPHORE so that sem_remove() is called after every page is cached but that seems to cause problems for other processes requesting the same semaphore. Best to disable it. - +20. Set the variable $htaccess_path in wp-config.php or wp-cache-config.php to the path of your global .htaccess if the plugin is looking for that file in the wrong directory. This might happen if you have WordPress installed in an unusual way. ## Installation ## Install like any other plugin, directly from your plugins page but make sure you have custom permalinks enabled. Go to the plugin settings page at Settings->WP Super Cache and enable caching. diff --git a/wp-cache.php b/wp-cache.php index 7a02d40c..e8a57781 100644 --- a/wp-cache.php +++ b/wp-cache.php @@ -212,6 +212,7 @@ function wp_cache_network_pages() { function wp_cache_manager_error_checks() { global $wp_cache_debug, $wp_cache_cron_check, $cache_enabled, $super_cache_enabled, $wp_cache_config_file, $wp_cache_mobile_browsers, $wp_cache_mobile_prefixes, $wp_cache_mobile_browsers, $wp_cache_mobile_enabled, $wp_cache_mod_rewrite; global $dismiss_htaccess_warning, $dismiss_readable_warning, $dismiss_gc_warning, $wp_cache_shutdown_gc, $is_nginx; + global $htaccess_path; if ( !wpsupercache_site_admin() ) return false; @@ -373,7 +374,11 @@ function wp_cache_manager_error_checks() { } if ( ! $is_nginx && function_exists( "is_main_site" ) && true == is_main_site() ) { - $home_path = trailingslashit( get_home_path() ); + if ( isset( $htaccess_path ) ) { + $home_path = trailingslashit( get_home_path() ); + } else { + $home_path = $htaccess_path; + } $scrules = implode( "\n", extract_from_markers( $home_path.'.htaccess', 'WPSuperCache' ) ); if ( $cache_enabled && $wp_cache_mod_rewrite && !$wp_cache_mobile_enabled && strpos( $scrules, addcslashes( str_replace( ', ', '|', $wp_cache_mobile_browsers ), ' ' ) ) ) { echo '

' . __( 'Mobile rewrite rules detected', 'wp-super-cache' ) . "

"; @@ -3153,6 +3158,8 @@ function wpsc_get_logged_in_cookie() { function wpsc_get_htaccess_info() { global $wp_cache_mobile_enabled, $wp_cache_mobile_prefixes, $wp_cache_mobile_browsers, $wp_cache_disable_utf8; + global $htaccess_path; + if ( isset( $_SERVER[ "PHP_DOCUMENT_ROOT" ] ) ) { $document_root = $_SERVER[ "PHP_DOCUMENT_ROOT" ]; $apache_root = $_SERVER[ "PHP_DOCUMENT_ROOT" ]; @@ -3181,7 +3188,9 @@ function wpsc_get_htaccess_info() { $home_path = get_home_path(); $home_root = parse_url(get_bloginfo('url')); $home_root = isset( $home_root[ 'path' ] ) ? trailingslashit( $home_root[ 'path' ] ) : '/'; - if ( + if ( isset( $htaccess_path ) ) { + $home_path = $htaccess_path; + } elseif ( $home_root == '/' && $home_path != $_SERVER[ 'DOCUMENT_ROOT' ] ) {