diff --git a/includes/pre-wp-functions.php b/includes/pre-wp-functions.php new file mode 100644 index 00000000..2535e343 --- /dev/null +++ b/includes/pre-wp-functions.php @@ -0,0 +1,16 @@ +
' . esc_html__( 'Domain Mapping plugin detected! Please go to the Supercache plugins page and enable the domain mapping helper plugin.', 'wp-super-cache' ) . '
'; } } diff --git a/plugins/multisite.php b/plugins/multisite.php index df71f9ac..cf4f056d 100644 --- a/plugins/multisite.php +++ b/plugins/multisite.php @@ -47,14 +47,13 @@ function wp_super_cache_multisite_notice() { } function wp_super_cache_override_on_flag() { - global $cache_enabled, $super_cache_enabled; - if ( true !== $cache_enabled ) { + if ( true !== $GLOBALS['wpsc_config']['cache_enabled'] ) { return false; } if ( 1 === (int) get_option( 'wp_super_cache_disabled' ) ) { - $cache_enabled = false; - $super_cache_enabled = false; + $GLOBALS['wpsc_config']['cache_enabled'] = false; + $GLOBALS['wpsc_config']['super_cache_enabled'] = false; define( 'DONOTCACHEPAGE', 1 ); define( 'SUBMITDISABLED', 'disabled style="color: #aaa" ' ); if ( is_admin() ) { diff --git a/plugins/wptouch.php b/plugins/wptouch.php index 9f2209a6..e956c938 100644 --- a/plugins/wptouch.php +++ b/plugins/wptouch.php @@ -41,8 +41,7 @@ function wp_super_cache_wptouch_admin() { add_cacheaction( 'cache_admin_page', 'wp_super_cache_wptouch_admin' ); function wp_super_cache_wptouch_notice() { - global $cache_enabled; - if ( $cache_enabled ) { + if ( $GLOBALS['wpsc_config']['cache_enabled'] ) { echo '' . __( 'WPTouch plugin detected! Please go to the Supercache plugins page and enable the WPTouch helper plugin.', 'wp-super-cache' ) . '
" . PHP_EOL ); fwrite( $fp, '<' . '?php // END HEADER ?' . '>' . PHP_EOL ); fclose( $fp ); - wp_cache_setting( 'wp_cache_debug_log', $wp_cache_debug_log ); - wp_cache_setting( 'wp_cache_debug_username', $wp_cache_debug_username ); + wp_cache_setting( 'wp_cache_debug_log', $GLOBALS['wpsc_config']['wp_cache_debug_log'] ); + wp_cache_setting( 'wp_cache_debug_username', $GLOBALS['wpsc_config']['wp_cache_debug_username'] ); } $msg = ' -if ( !isset( $_SERVER[ "PHP_AUTH_USER" ] ) || ( $_SERVER[ "PHP_AUTH_USER" ] != "' . $wp_cache_debug_username . '" && $_SERVER[ "PHP_AUTH_PW" ] != "' . $wp_cache_debug_username . '" ) ) { +if ( !isset( $_SERVER[ "PHP_AUTH_USER" ] ) || ( $_SERVER[ "PHP_AUTH_USER" ] != "' . $GLOBALS['wpsc_config']['wp_cache_debug_username'] . '" && $_SERVER[ "PHP_AUTH_PW" ] != "' . $GLOBALS['wpsc_config']['wp_cache_debug_username'] . '" ) ) { header( "WWW-Authenticate: Basic realm=\"WP-Super-Cache Debug Log\"" ); header( $_SERVER[ "SERVER_PROTOCOL" ] . " 401 Unauthorized" ); echo "You must login to view the debug log"; exit; }' . PHP_EOL; - $fp = fopen( $cache_path . 'view_' . $wp_cache_debug_log, 'w' ); + $fp = fopen( $GLOBALS['wpsc_config']['cache_path'] . 'view_' . $GLOBALS['wpsc_config']['wp_cache_debug_log'], 'w' ); if ( $fp ) { fwrite( $fp, '<' . "?php" . PHP_EOL ); - $msg .= '$debug_log = file( "./' . $wp_cache_debug_log . '" ); + $msg .= '$debug_log = file( "./' . $GLOBALS['wpsc_config']['wp_cache_debug_log'] . '" ); $start_log = 1 + array_search( "<" . "?php // END HEADER ?" . ">" . PHP_EOL, $debug_log ); if ( $start_log > 1 ) { $debug_log = array_slice( $debug_log, $start_log ); @@ -1119,7 +1109,7 @@ function wpsc_create_debug_log( $filename = '', $username = '' ) { fclose( $fp ); } - return array( 'wp_cache_debug_log' => $wp_cache_debug_log, 'wp_cache_debug_username' => $wp_cache_debug_username ); + return array( 'wp_cache_debug_log' => $GLOBALS['wpsc_config']['wp_cache_debug_log'], 'wp_cache_debug_username' => $GLOBALS['wpsc_config']['wp_cache_debug_username'] ); } function wpsc_delete_url_cache( $url ) { @@ -1287,9 +1277,9 @@ function wpsc_shutdown_message() { } function wp_cache_phase2() { - global $wp_cache_gzip_encoding, $super_cache_enabled, $cache_rebuild_files, $cache_enabled, $wp_cache_gmt_offset, $wp_cache_blog_charset; + global $wp_cache_gzip_encoding, $wp_cache_gmt_offset, $wp_cache_blog_charset; - if ( $cache_enabled == false ) { + if ( $GLOBALS['wpsc_config']['cache_enabled'] == false ) { wp_cache_debug( 'wp_cache_phase2: Caching disabled! Exit' ); define( 'WPSCSHUTDOWNMESSAGE', __( 'Caching disabled. Page not cached.', 'wp-super-cache' ) ); add_action( 'wp_footer', 'wpsc_shutdown_message' ); @@ -1327,7 +1317,7 @@ function wp_cache_phase2() { if ( ! empty( $_GET ) ) { wp_cache_debug( 'Supercache caching disabled. Only using wp-cache. Non empty GET request. ' . wpsc_dump_get_request(), 5 ); - $super_cache_enabled = false; + $GLOBALS['wpsc_config']['super_cache_enabled'] = false; } if ( defined( 'WPSC_VARY_HEADER' ) ) { @@ -1342,7 +1332,7 @@ function wp_cache_phase2() { wp_cache_debug( 'Created output buffer', 4 ); // restore old supercache file temporarily - if ( ( $_SERVER['REQUEST_METHOD'] !== 'POST' && empty( $_POST ) ) && $super_cache_enabled && $cache_rebuild_files ) { + if ( ( $_SERVER['REQUEST_METHOD'] !== 'POST' && empty( $_POST ) ) && $GLOBALS['wpsc_config']['super_cache_enabled'] && $GLOBALS['wpsc_config']['cache_rebuild_files'] ) { $user_info = wp_cache_get_cookies_values(); if( empty( $user_info ) @@ -1398,7 +1388,7 @@ function wpsc_register_post_hooks() { } function wpcache_do_rebuild( $dir ) { - global $do_rebuild_list, $cache_path, $wpsc_file_mtimes; + global $do_rebuild_list, $wpsc_file_mtimes; wp_cache_debug( "wpcache_do_rebuild: doing rebuild for $dir" ); if ( !is_dir( $dir ) ) { @@ -1616,9 +1606,10 @@ function wp_cache_is_rejected($uri) { } function wp_cache_mutex_init() { - global $mutex, $wp_cache_mutex_disabled, $use_flock, $blog_cache_dir, $mutex_filename, $sem_id; + global $mutex, $use_flock, $blog_cache_dir; + $mutex_filename = 'wp_cache_mutex.lock'; - if ( defined( 'WPSC_DISABLE_LOCKING' ) || ( isset( $wp_cache_mutex_disabled ) && $wp_cache_mutex_disabled ) ) + if ( defined( 'WPSC_DISABLE_LOCKING' ) || ( isset( $GLOBALS['wpsc_config']['wp_cache_mutex_disabled'] ) && $GLOBALS['wpsc_config']['wp_cache_mutex_disabled'] ) ) return true; if( !is_bool( $use_flock ) ) { @@ -1634,15 +1625,15 @@ function wp_cache_mutex_init() { wp_cache_debug( "Created mutex lock on filename: {$blog_cache_dir}{$mutex_filename}", 5 ); $mutex = @fopen( $blog_cache_dir . $mutex_filename, 'w' ); } else { - wp_cache_debug( "Created mutex lock on semaphore: {$sem_id}", 5 ); - $mutex = @sem_get( $sem_id, 1, 0666, 1 ); + wp_cache_debug( "Created mutex lock on semaphore: {$GLOBALS['wpsc_config']['sem_id']}", 5 ); + $mutex = @sem_get( $GLOBALS['wpsc_config']['sem_id'], 1, 0666, 1 ); } } function wp_cache_writers_entry() { - global $mutex, $wp_cache_mutex_disabled, $use_flock; + global $mutex, $use_flock; - if ( defined( 'WPSC_DISABLE_LOCKING' ) || ( isset( $wp_cache_mutex_disabled ) && $wp_cache_mutex_disabled ) ) + if ( defined( 'WPSC_DISABLE_LOCKING' ) || ( isset( $GLOBALS['wpsc_config']['wp_cache_mutex_disabled'] ) && $GLOBALS['wpsc_config']['wp_cache_mutex_disabled'] ) ) return true; if( !$mutex ) { @@ -1662,9 +1653,9 @@ function wp_cache_writers_entry() { } function wp_cache_writers_exit() { - global $mutex, $wp_cache_mutex_disabled, $use_flock; + global $mutex, $use_flock; - if ( defined( 'WPSC_DISABLE_LOCKING' ) || ( isset( $wp_cache_mutex_disabled ) && $wp_cache_mutex_disabled ) ) + if ( defined( 'WPSC_DISABLE_LOCKING' ) || ( isset( $GLOBALS['wpsc_config']['wp_cache_mutex_disabled'] ) && $GLOBALS['wpsc_config']['wp_cache_mutex_disabled'] ) ) return true; if( !$mutex ) { @@ -1771,7 +1762,7 @@ function wpsc_is_fatal_error() { } function wp_cache_ob_callback( $buffer ) { - global $wp_cache_pages, $wp_query, $wp_super_cache_query, $cache_acceptable_files, $wp_cache_no_cache_for_get, $wp_cache_request_uri, $do_rebuild_list, $wpsc_file_mtimes, $wpsc_save_headers, $super_cache_enabled; + global $wp_cache_pages, $wp_query, $wp_super_cache_query, $cache_acceptable_files, $wp_cache_no_cache_for_get, $wp_cache_request_uri, $do_rebuild_list, $wpsc_file_mtimes, $wpsc_save_headers; $script = basename( $_SERVER[ 'PHP_SELF' ] ); // All the things that can stop a page being cached @@ -1866,7 +1857,7 @@ function wp_cache_ob_callback( $buffer ) { } if ( isset( $wpsc_save_headers ) && $wpsc_save_headers ) - $super_cache_enabled = false; // use standard caching to record headers + $GLOBALS['wpsc_config']['super_cache_enabled'] = false; // use standard caching to record headers if ( $cache_this_page ) { @@ -1901,7 +1892,6 @@ function wp_cache_ob_callback( $buffer ) { function wp_cache_append_tag( &$buffer ) { global $wp_cache_gmt_offset, $wp_super_cache_comments; - global $cache_enabled, $super_cache_enabled; if ( false == isset( $wp_super_cache_comments ) ) $wp_super_cache_comments = 1; @@ -1910,7 +1900,7 @@ function wp_cache_append_tag( &$buffer ) { return false; $timestamp = gmdate('Y-m-d H:i:s', (time() + ( $wp_cache_gmt_offset * 3600))); - if ( $cache_enabled || $super_cache_enabled ) { + if ( $GLOBALS['wpsc_config']['cache_enabled'] || $GLOBALS['wpsc_config']['super_cache_enabled'] ) { $msg = "Cached page generated by WP-Super-Cache on $timestamp"; } else { $msg = "Live page served on $timestamp"; @@ -1958,12 +1948,12 @@ function wp_cache_maybe_dynamic( &$buffer ) { } function wp_cache_get_ob(&$buffer) { - global $cache_enabled, $cache_path, $cache_filename, $wp_start_time, $supercachedir; - global $new_cache, $wp_cache_meta, $cache_compression, $wp_super_cache_query; - global $wp_cache_gzip_encoding, $super_cache_enabled; + global $cache_filename, $wp_start_time, $supercachedir; + global $new_cache, $wp_cache_meta, $wp_super_cache_query; + global $wp_cache_gzip_encoding; global $gzsize, $supercacheonly; global $blog_cache_dir, $wp_supercache_cache_list; - global $wp_cache_not_logged_in, $cache_max_time; + global $wp_cache_not_logged_in; global $wp_cache_is_home, $wp_cache_front_page_checks, $wp_cache_mfunc_enabled; if ( isset( $wp_cache_mfunc_enabled ) == false ) @@ -1976,7 +1966,7 @@ function wp_cache_get_ob(&$buffer) { * we avoid caching incomplete files */ if ( $buffer == '' ) { $new_cache = false; - if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) { + if ( isset( $GLOBALS['wpsc_config']['wp_super_cache_debug'] ) && $GLOBALS['wpsc_config']['wp_super_cache_debug'] ) { wp_cache_debug( "Buffer is blank. Output buffer may have been corrupted by another plugin or this is a redirected URL. Look for text 'ob_start' in the files of your plugins directory.", 2 ); wp_cache_add_to_buffer( $buffer, "Page not cached by WP Super Cache. Blank Page. Check output buffer usage by plugins." ); } @@ -1984,7 +1974,7 @@ function wp_cache_get_ob(&$buffer) { if ( isset( $wp_super_cache_query[ 'is_404' ] ) && false == apply_filters( 'wpsupercache_404', false ) ) { $new_cache = false; - if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) { + if ( isset( $GLOBALS['wpsc_config']['wp_super_cache_debug'] ) && $GLOBALS['wpsc_config']['wp_super_cache_debug'] ) { wp_cache_debug( '404 file not found not cached', 2 ); wp_cache_add_to_buffer( $buffer, "Page not cached by WP Super Cache. 404." ); } @@ -1992,7 +1982,7 @@ function wp_cache_get_ob(&$buffer) { if ( !preg_match( apply_filters( 'wp_cache_eof_tags', '/(<\/html>|<\/rss>|<\/feed>|<\/urlset|<\?xml)/i' ), $buffer ) ) { $new_cache = false; - if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) { + if ( isset( $GLOBALS['wpsc_config']['wp_super_cache_debug'] ) && $GLOBALS['wpsc_config']['wp_super_cache_debug'] ) { wp_cache_debug( 'No closing html tag. Not caching.', 2 ); wp_cache_add_to_buffer( $buffer, "Page not cached by WP Super Cache. No closing HTML tag. Check your theme." ); } @@ -2019,13 +2009,13 @@ function wp_cache_get_ob(&$buffer) { $home_url = parse_url( trailingslashit( get_bloginfo( 'url' ) ) ); $dir = get_current_url_supercache_dir(); - $supercachedir = $cache_path . 'supercache/' . preg_replace('/:.*$/', '', $home_url[ 'host' ]); - if ( ! empty( $_GET ) || isset( $wp_super_cache_query[ 'is_feed' ] ) || ( $super_cache_enabled == true && is_dir( substr( $supercachedir, 0, -1 ) . '.disabled' ) ) ) { + $supercachedir = $GLOBALS['wpsc_config']['cache_path'] . 'supercache/' . preg_replace('/:.*$/', '', $home_url[ 'host' ]); + if ( ! empty( $_GET ) || isset( $wp_super_cache_query[ 'is_feed' ] ) || ( $GLOBALS['wpsc_config']['super_cache_enabled'] == true && is_dir( substr( $supercachedir, 0, -1 ) . '.disabled' ) ) ) { wp_cache_debug( 'Supercache disabled: GET or feed detected or disabled by config.', 2 ); - $super_cache_enabled = false; + $GLOBALS['wpsc_config']['super_cache_enabled'] = false; } - $tmp_wpcache_filename = $cache_path . uniqid( mt_rand(), true ) . '.tmp'; + $tmp_wpcache_filename = $GLOBALS['wpsc_config']['cache_path'] . uniqid( mt_rand(), true ) . '.tmp'; if ( defined( 'WPSC_SUPERCACHE_ONLY' ) ) { $supercacheonly = true; @@ -2034,7 +2024,7 @@ function wp_cache_get_ob(&$buffer) { $supercacheonly = false; } - if( $super_cache_enabled ) { + if( $GLOBALS['wpsc_config']['super_cache_enabled'] ) { if ( wp_cache_get_cookies_values() == '' && empty( $_GET ) ) { wp_cache_debug( 'Anonymous user detected. Only creating Supercache file.', 3 ); $supercacheonly = true; @@ -2043,19 +2033,18 @@ function wp_cache_get_ob(&$buffer) { $cache_error = ''; if ( wpsc_is_caching_user_disabled() ) { - $super_cache_enabled = false; - $cache_enabled = false; + $GLOBALS['wpsc_config']['super_cache_enabled'] = false; + $GLOBALS['wpsc_config']['cache_enabled'] = false; $cache_error = 'Not caching requests by known users. (See Advanced Settings page)'; wp_cache_debug( 'Not caching for known user.', 5 ); } - if ( !$cache_enabled ) { + if ( ! $GLOBALS['wpsc_config']['cache_enabled'] ) { wp_cache_debug( 'Cache is not enabled. Sending buffer to browser.', 5 ); wp_cache_writers_exit(); wp_cache_add_to_buffer( $buffer, "Page not cached by WP Super Cache. Check your settings page. $cache_error" ); if ( $wp_cache_mfunc_enabled == 1 ) { - global $wp_super_cache_late_init; - if ( false == isset( $wp_super_cache_late_init ) || ( isset( $wp_super_cache_late_init ) && $wp_super_cache_late_init == 0 ) ) + if ( false == isset( $GLOBALS['wpsc_config']['wp_super_cache_late_init'] ) || ( isset( $GLOBALS['wpsc_config']['wp_super_cache_late_init'] ) && $GLOBALS['wpsc_config']['wp_super_cache_late_init'] == 0 ) ) wp_cache_add_to_buffer( $buffer, 'Super Cache dynamic page detected but $wp_super_cache_late_init not set. See the readme.txt for further details.' ); } @@ -2083,8 +2072,8 @@ function wp_cache_get_ob(&$buffer) { if ( ! $supercacheonly ) { $fr = @fopen( $tmp_wpcache_filename, 'w' ); if ( ! $fr ) { - wp_cache_debug( 'Error. Supercache could not write to ' . str_replace( ABSPATH, '', $cache_path ) . $cache_filename, 1 ); - wp_cache_add_to_buffer( $buffer, "File not cached! Super Cache Couldn't write to: " . str_replace( ABSPATH, '', $cache_path ) . $cache_filename ); + wp_cache_debug( 'Error. Supercache could not write to ' . str_replace( ABSPATH, '', $GLOBALS['wpsc_config']['cache_path'] ) . $cache_filename, 1 ); + wp_cache_add_to_buffer( $buffer, "File not cached! Super Cache Couldn't write to: " . str_replace( ABSPATH, '', $GLOBALS['wpsc_config']['cache_path'] ) . $cache_filename ); wp_cache_writers_exit(); return wp_cache_maybe_dynamic( $buffer ); } @@ -2092,7 +2081,7 @@ function wp_cache_get_ob(&$buffer) { $user_info = wp_cache_get_cookies_values(); $do_cache = apply_filters( 'do_createsupercache', $user_info ); if ( - $super_cache_enabled && + $GLOBALS['wpsc_config']['super_cache_enabled'] && ( $user_info == '' || $do_cache === true @@ -2109,7 +2098,7 @@ function wp_cache_get_ob(&$buffer) { wp_cache_writers_exit(); return wp_cache_maybe_dynamic( $buffer ); } elseif ( - $cache_compression && + $GLOBALS['wpsc_config']['cache_compression'] && ( ! isset( $wp_cache_mfunc_enabled ) || $wp_cache_mfunc_enabled == 0 @@ -2145,8 +2134,7 @@ function wp_cache_get_ob(&$buffer) { wp_cache_add_to_buffer( $buffer, "Warning! Obsolete mfunc/mclude/dynamic-cached-content tags found. Please update your theme. See http://ocaoimh.ie/y/5b for more information." ); } - global $wp_super_cache_late_init; - if ( false == isset( $wp_super_cache_late_init ) || ( isset( $wp_super_cache_late_init ) && $wp_super_cache_late_init == 0 ) ) + if ( false == isset( $GLOBALS['wpsc_config']['wp_super_cache_late_init'] ) || ( isset( $GLOBALS['wpsc_config']['wp_super_cache_late_init'] ) && $GLOBALS['wpsc_config']['wp_super_cache_late_init'] == 0 ) ) wp_cache_add_to_buffer( $buffer, 'Super Cache dynamic page detected but late init not set. See the readme.txt for further details.' ); if ( $fr ) { // wpcache caching @@ -2163,7 +2151,7 @@ function wp_cache_get_ob(&$buffer) { $buffer = do_cacheaction( 'wpsc_cachedata', $buffer ); // dynamic content for display } - if ( $cache_compression && $wp_cache_gzip_encoding ) { + if ( $GLOBALS['wpsc_config']['cache_compression'] && $wp_cache_gzip_encoding ) { wp_cache_debug( 'Gzipping dynamic buffer for display.', 5 ); wp_cache_add_to_buffer( $buffer, "Compression = gzip" ); $gzdata = gzencode( $buffer, 6, FORCE_GZIP ); @@ -2300,7 +2288,7 @@ function wp_cache_get_ob(&$buffer) { } } -function wp_cache_phase2_clean_cache($file_prefix) { +function wp_cache_phase2_clean_cache( $file_prefix ) { global $wpdb, $blog_cache_dir; if( !wp_cache_writers_entry() ) @@ -2337,7 +2325,7 @@ function prune_super_cache( $directory, $force = false, $rename = false ) { return false; } - global $cache_max_time, $cache_path, $blog_cache_dir; + global $blog_cache_dir; static $log = 0; static $protected_directories = ''; @@ -2356,8 +2344,8 @@ function prune_super_cache( $directory, $force = false, $rename = false ) { wp_cache_debug( "prune_super_cache: exiting as file/dir does not exist: $directory" ); return $log; } - if( !isset( $cache_max_time ) ) - $cache_max_time = 3600; + if( !isset( $GLOBALS['wpsc_config']['cache_max_time'] ) ) + $GLOBALS['wpsc_config']['cache_max_time'] = 3600; $now = time(); @@ -2374,7 +2362,7 @@ function prune_super_cache( $directory, $force = false, $rename = false ) { $entry = $directory . $entry; prune_super_cache( $entry, $force, $rename ); // If entry is a directory, AND it's not a protected one, AND we're either forcing the delete, OR the file is out of date, - if( is_dir( $entry ) && !in_array( $entry, $protected_directories ) && ( $force || @filemtime( $entry ) + $cache_max_time <= $now ) ) { + if( is_dir( $entry ) && !in_array( $entry, $protected_directories ) && ( $force || @filemtime( $entry ) + $GLOBALS['wpsc_config']['cache_max_time'] <= $now ) ) { // if the directory isn't empty can't delete it if( $handle = @opendir( $entry ) ) { $donotdelete = false; @@ -2394,7 +2382,7 @@ function prune_super_cache( $directory, $force = false, $rename = false ) { if ( $force ) { wp_cache_debug( "gc: deleted $entry, forced delete", 2 ); } else { - wp_cache_debug( "gc: deleted $entry, older than $cache_max_time seconds", 2 ); + wp_cache_debug( "gc: deleted $entry, older than {$GLOBALS['wpsc_config']['cache_max_time']} seconds", 2 ); } } } elseif ( in_array( $entry, $protected_directories ) ) { @@ -2403,7 +2391,7 @@ function prune_super_cache( $directory, $force = false, $rename = false ) { } closedir($dh); } - } elseif( is_file($directory) && ($force || @filemtime( $directory ) + $cache_max_time <= $now ) ) { + } elseif ( is_file($directory) && ($force || @filemtime( $directory ) + $GLOBALS['wpsc_config']['cache_max_time'] <= $now ) ) { $oktodelete = true; if ( in_array( $directory, $protected_directories ) ) { wp_cache_debug( "gc: could not delete $directory as it's protected.", 2 ); @@ -2427,9 +2415,6 @@ function prune_super_cache( $directory, $force = false, $rename = false ) { } function wp_cache_rebuild_or_delete( $file ) { - global $cache_rebuild_files, $cache_path, $file_prefix; - - if ( strpos( $file, '?' ) !== false ) $file = substr( $file, 0, strpos( $file, '?' ) ); @@ -2455,13 +2440,13 @@ function wp_cache_rebuild_or_delete( $file ) { return false; } - if ( substr( basename( $file ), 0, mb_strlen( $file_prefix ) ) == $file_prefix ) { + if ( substr( basename( $file ), 0, mb_strlen( $GLOBALS['wpsc_config']['file_prefix'] ) ) == $GLOBALS['wpsc_config']['file_prefix'] ) { @unlink( $file ); wp_cache_debug( "rebuild_or_gc: deleted non-anonymous file: $file" ); return false; } - if ( substr( basename( $file ), 0, 5 + mb_strlen( $file_prefix ) ) == 'meta-' . $file_prefix ) { + if ( substr( basename( $file ), 0, 5 + mb_strlen( $GLOBALS['wpsc_config']['file_prefix'] ) ) == 'meta-' . $GLOBALS['wpsc_config']['file_prefix'] ) { @unlink( $file ); wp_cache_debug( "rebuild_or_gc: deleted meta file: $file" ); return false; @@ -2471,7 +2456,7 @@ function wp_cache_rebuild_or_delete( $file ) { wp_cache_debug( "rebuild_or_gc: file has disappeared: $file" ); return false; } - if( $cache_rebuild_files && substr( $file, -14 ) != '.needs-rebuild' ) { + if ( $GLOBALS['wpsc_config']['cache_rebuild_files'] && substr( $file, -14 ) != '.needs-rebuild' ) { if( @rename($file, $file . '.needs-rebuild') ) { @touch( $file . '.needs-rebuild' ); wp_cache_debug( "rebuild_or_gc: rename file to {$file}.needs-rebuild", 2 ); @@ -2489,9 +2474,9 @@ function wp_cache_rebuild_or_delete( $file ) { } function wp_cache_phase2_clean_expired( $file_prefix, $force = false ) { - global $cache_path, $cache_max_time, $blog_cache_dir, $wp_cache_preload_on; + global $blog_cache_dir, $wp_cache_preload_on; - if ( $cache_max_time == 0 ) { + if ( $GLOBALS['wpsc_config']['cache_max_time'] == 0 ) { wp_cache_debug( "wp_cache_phase2_clean_expired: disabled because GC disabled.", 2 ); return false; } @@ -2505,25 +2490,25 @@ function wp_cache_phase2_clean_expired( $file_prefix, $force = false ) { if ( ( $handle = @opendir( $blog_cache_dir ) ) ) { while ( false !== ($file = readdir($handle))) { if ( preg_match("/^$file_prefix/", $file) && - (@filemtime( $blog_cache_dir . $file) + $cache_max_time) <= $now ) { + (@filemtime( $blog_cache_dir . $file) + $GLOBALS['wpsc_config']['cache_max_time']) <= $now ) { @unlink( $blog_cache_dir . $file ); @unlink( $blog_cache_dir . 'meta/' . str_replace( '.html', '.meta', $file ) ); wp_cache_debug( "wp_cache_phase2_clean_expired: Deleting obsolete wpcache cache+meta files: $file" ); continue; } if($file != '.' && $file != '..') { - if( is_dir( $blog_cache_dir . $file ) == false && (@filemtime($blog_cache_dir . $file) + $cache_max_time) <= $now ) { + if( is_dir( $blog_cache_dir . $file ) == false && (@filemtime($blog_cache_dir . $file) + $GLOBALS['wpsc_config']['cache_max_time']) <= $now ) { if ( substr( $file, -9 ) != '.htaccess' && $file != 'index.html' ) { @unlink($blog_cache_dir . $file); - wp_cache_debug( "Deleting $blog_cache_dir{$file}, older than $cache_max_time seconds", 5 ); + wp_cache_debug( "Deleting $blog_cache_dir{$file}, older than {$GLOBALS['wpsc_config']['cache_max_time']} seconds", 5 ); } } } } closedir($handle); if ( false == $wp_cache_preload_on || true == $force ) { - wp_cache_debug( "Doing GC on supercache dir: {$cache_path}supercache", 2 ); - $deleted = prune_super_cache( $cache_path . 'supercache', false, false ); + wp_cache_debug( "Doing GC on supercache dir: {$GLOBALS['wpsc_config']['cache_path']}supercache", 2 ); + $deleted = prune_super_cache( $GLOBALS['wpsc_config']['cache_path'] . 'supercache', false, false ); } } @@ -2532,8 +2517,8 @@ function wp_cache_phase2_clean_expired( $file_prefix, $force = false ) { } function wp_cache_shutdown_callback() { - global $cache_max_time, $meta_file, $new_cache, $wp_cache_meta, $known_headers, $blog_id, $wp_cache_gzip_encoding, $supercacheonly, $blog_cache_dir; - global $wp_cache_request_uri, $wp_cache_key, $cache_enabled, $wp_cache_blog_charset, $wp_cache_not_logged_in; + global $meta_file, $new_cache, $wp_cache_meta, $known_headers, $blog_id, $wp_cache_gzip_encoding, $supercacheonly, $blog_cache_dir; + global $wp_cache_request_uri, $wp_cache_key, $wp_cache_blog_charset, $wp_cache_not_logged_in; global $WPSC_HTTP_HOST, $wp_super_cache_query; if ( ! function_exists( 'wpsc_init' ) ) { @@ -2619,7 +2604,7 @@ function wp_cache_shutdown_callback() { $wp_cache_meta[ 'headers' ][ 'Content-Type' ] = "Content-Type: $value"; } - if ( $cache_enabled && !$supercacheonly && $new_cache ) { + if ( $GLOBALS['wpsc_config']['cache_enabled'] && ! $supercacheonly && $new_cache ) { if( !isset( $wp_cache_meta[ 'dynamic' ] ) && $wp_cache_gzip_encoding && !in_array( 'Content-Encoding: ' . $wp_cache_gzip_encoding, $wp_cache_meta[ 'headers' ] ) ) { wp_cache_debug( 'Sending gzip headers.', 2 ); $wp_cache_meta[ 'headers' ][ 'Content-Encoding' ] = 'Content-Encoding: ' . $wp_cache_gzip_encoding; @@ -2686,7 +2671,7 @@ function wp_cache_no_postid($id) { } function wp_cache_get_postid_from_comment( $comment_id, $status = 'NA' ) { - global $super_cache_enabled, $wp_cache_request_uri; + global $wp_cache_request_uri; if ( defined( 'DONOTDELETECACHE' ) ) { return; @@ -2728,7 +2713,7 @@ function wp_cache_get_postid_from_comment( $comment_id, $status = 'NA' ) { } elseif( $comment['comment_approved'] == '0' ) { if ( $comment[ 'comment_type' ] == '' ) { wp_cache_debug( "Moderated comment. Don't delete supercache file until comment approved.", 4 ); - $super_cache_enabled = 0; // don't remove the super cache static file until comment is approved + $GLOBALS['wpsc_config']['super_cache_enabled'] = false; // don't remove the super cache static file until comment is approved define( 'DONOTDELETECACHE', 1 ); } else { wp_cache_debug( 'Moderated ping or trackback. Not deleting cache files..', 4 ); @@ -2757,16 +2742,14 @@ function wp_cache_clear_cache_on_menu() { /* Clear out the cache directory. */ function wp_cache_clear_cache( $blog_id = 0 ) { - global $cache_path; - if ( $blog_id == 0 ) { wp_cache_debug( 'Clearing all cached files in wp_cache_clear_cache()', 4 ); - prune_super_cache( $cache_path . 'supercache/', true ); - prune_super_cache( $cache_path, true ); + prune_super_cache( $GLOBALS['wpsc_config']['cache_path'] . 'supercache/', true ); + prune_super_cache( $GLOBALS['wpsc_config']['cache_path'], true ); } else { wp_cache_debug( "Clearing all cached files for blog $blog_id in wp_cache_clear_cache()", 4 ); prune_super_cache( get_supercache_dir( $blog_id ), true ); - prune_super_cache( $cache_path . 'blogs/', true ); + prune_super_cache( $GLOBALS['wpsc_config']['cache_path'] . 'blogs/', true ); } do_action( 'wp_cache_cleared' ); @@ -2882,7 +2865,7 @@ function wpsc_post_transition( $new_status, $old_status, $post ) { /* check if we want to clear out all cached files on post updates, otherwise call standard wp_cache_post_change() */ function wp_cache_post_edit( $post_id ) { - global $wp_cache_clear_on_post_edit, $cache_path, $blog_cache_dir; + global $wp_cache_clear_on_post_edit, $blog_cache_dir; static $last_post_edited = -1; if ( $post_id == $last_post_edited ) { @@ -2906,7 +2889,7 @@ function wp_cache_post_edit( $post_id ) { // we want to process the post again just in case it becomes published before the second time this function is called. $last_post_edited = $post_id; if( $wp_cache_clear_on_post_edit ) { - wp_cache_debug( "wp_cache_post_edit: Clearing cache $blog_cache_dir and {$cache_path}supercache/ on post edit per config.", 2 ); + wp_cache_debug( "wp_cache_post_edit: Clearing cache $blog_cache_dir and {$GLOBALS['wpsc_config']['cache_path']}supercache/ on post edit per config.", 2 ); prune_super_cache( $blog_cache_dir, true ); prune_super_cache( get_supercache_dir(), true ); } else { @@ -2947,7 +2930,7 @@ function wp_cache_post_id_gc( $post_id, $all = 'all' ) { } function wp_cache_post_change( $post_id ) { - global $file_prefix, $cache_path, $blog_id, $super_cache_enabled, $blog_cache_dir, $wp_cache_refresh_single_only; + global $blog_id, $blog_cache_dir, $wp_cache_refresh_single_only; static $last_processed = -1; if ( $post_id == $last_processed ) { @@ -3034,7 +3017,7 @@ function wp_cache_post_change( $post_id ) { $supercache_files_deleted = false; if ( $handle = @opendir( $blog_cache_dir ) ) { while ( false !== ($file = readdir($handle))) { - if ( strpos( $file, $file_prefix ) !== false ) { + if ( strpos( $file, $GLOBALS['wpsc_config']['file_prefix'] ) !== false ) { if ( strpos( $file, '.html' ) ) { // delete old wpcache files immediately wp_cache_debug( "wp_cache_post_change: Deleting obsolete wpcache cache+meta files: $file" ); @@ -3055,7 +3038,7 @@ function wp_cache_post_change( $post_id ) { wp_cache_debug( "Post change: deleting post wp-cache files for {$meta[ 'uri' ]}: $file", 4 ); @unlink( $blog_cache_dir . 'meta/' . $file ); @unlink( $blog_cache_dir . $file ); - if ( false == $supercache_files_deleted && $super_cache_enabled == true ) { + if ( false == $supercache_files_deleted && $GLOBALS['wpsc_config']['super_cache_enabled'] == true ) { wp_cache_debug( "Post change: deleting supercache files for {$permalink}" ); wpsc_rebuild_files( $dir . $permalink ); $supercache_files_deleted = true; @@ -3066,7 +3049,7 @@ function wp_cache_post_change( $post_id ) { wp_cache_debug( "Post change: deleting wp-cache files for {$meta[ 'uri' ]}: $file", 4 ); @unlink( $blog_cache_dir . 'meta/' . $file ); @unlink( $blog_cache_dir . $file ); - if ( $super_cache_enabled == true ) { + if ( $GLOBALS['wpsc_config']['super_cache_enabled'] == true ) { wp_cache_debug( "Post change: deleting supercache files for {$meta[ 'uri' ]}" ); wpsc_rebuild_files( $dir . $meta[ 'uri' ] ); do_action( 'gc_cache', 'rebuild', trailingslashit( $meta[ 'uri' ] ) ); @@ -3115,15 +3098,14 @@ function maybe_stop_gc( $flag ) { } } function get_gc_flag() { - global $cache_path; - return $cache_path . strtolower( preg_replace( '!/:.*$!', '', str_replace( 'http://', '', str_replace( 'https://', '', get_option( 'home' ) ) ) ) ) . "_wp_cache_gc.txt"; + return $GLOBALS['wpsc_config']['cache_path'] . strtolower( preg_replace( '!/:.*$!', '', str_replace( 'http://', '', str_replace( 'https://', '', get_option( 'home' ) ) ) ) ) . "_wp_cache_gc.txt"; } function wp_cache_gc_cron() { - global $file_prefix, $cache_max_time, $cache_gc_email_me, $cache_time_interval; + global $cache_gc_email_me, $cache_time_interval; $msg = ''; - if ( $cache_max_time == 0 ) { + if ( $GLOBALS['wpsc_config']['cache_max_time'] == 0 ) { wp_cache_debug( 'Cache garbage collection disabled because cache expiry time is zero.', 5 ); return false; } @@ -3141,12 +3123,12 @@ function wp_cache_gc_cron() { wp_cache_debug( 'Cache garbage collection.', 5 ); - if( !isset( $cache_max_time ) ) - $cache_max_time = 600; + if( !isset( $GLOBALS['wpsc_config']['cache_max_time'] ) ) + $GLOBALS['wpsc_config']['cache_max_time'] = 600; $start = time(); $num = 0; - if( false === ( $num = wp_cache_phase2_clean_expired( $file_prefix ) ) ) { + if( false === ( $num = wp_cache_phase2_clean_expired( $GLOBALS['wpsc_config']['file_prefix'] ) ) ) { wp_cache_debug( 'Cache Expiry cron job failed. Probably mutex locked.', 1 ); update_option( 'wpsupercache_gc_time', time() - ( $cache_time_interval - 10 ) ); // if GC failed then run it again in one minute $msg .= __( 'Cache expiry cron job failed. Job will run again in 10 seconds.', 'wp-super-cache' ) . "\n"; @@ -3170,19 +3152,19 @@ function wp_cache_gc_cron() { } function schedule_wp_gc( $forced = 0 ) { - global $cache_schedule_type, $cache_max_time, $cache_time_interval, $cache_scheduled_time, $cache_schedule_interval; + global $cache_schedule_type, $cache_time_interval, $cache_scheduled_time, $cache_schedule_interval; if ( false == isset( $cache_time_interval ) ) $cache_time_interval = 3600; if ( false == isset( $cache_schedule_type ) ) { $cache_schedule_type = 'interval'; - $cache_schedule_interval = $cache_max_time; + $cache_schedule_interval = $GLOBALS['wpsc_config']['cache_max_time']; } if ( $cache_schedule_type == 'interval' ) { - if ( !isset( $cache_max_time ) ) - $cache_max_time = 600; - if ( $cache_max_time == 0 ) + if ( !isset( $GLOBALS['wpsc_config']['cache_max_time'] ) ) + $GLOBALS['wpsc_config']['cache_max_time'] = 600; + if ( $GLOBALS['wpsc_config']['cache_max_time'] == 0 ) return false; $last_gc = get_option( "wpsupercache_gc_time" ); @@ -3191,8 +3173,7 @@ function schedule_wp_gc( $forced = 0 ) { $last_gc = get_option( "wpsupercache_gc_time" ); } if ( $forced || ( $last_gc < ( time() - 60 ) ) ) { // Allow up to 60 seconds for the previous job to run - global $wp_cache_shutdown_gc; - if ( !isset( $wp_cache_shutdown_gc ) || $wp_cache_shutdown_gc == 0 ) { + if ( !isset( $GLOBALS['wpsc_config']['wp_cache_shutdown_gc'] ) || $GLOBALS['wpsc_config']['wp_cache_shutdown_gc'] == 0 ) { if ( !($t = wp_next_scheduled( 'wp_cache_gc' ) ) ) { wp_clear_scheduled_hook( 'wp_cache_gc' ); wp_schedule_single_event( time() + $cache_time_interval, 'wp_cache_gc' ); diff --git a/wp-cache.php b/wp-cache.php index d8c344ed..6c12667e 100644 --- a/wp-cache.php +++ b/wp-cache.php @@ -30,7 +30,7 @@ */ if ( ! function_exists( 'wp_cache_phase2' ) ) { - require_once( dirname( __FILE__ ) . '/wp-cache-phase2.php'); + require_once( dirname( __FILE__ ) . '/wp-cache-phase1.php'); } if ( ! defined( 'PHP_VERSION_ID' ) ) { @@ -72,11 +72,9 @@ function wpsc_init() { * WP-CLI requires explicit declaration of global variables. * It's minimal list of global variables. */ -global $super_cache_enabled, $cache_enabled, $wp_cache_mod_rewrite, $wp_cache_home_path, $cache_path, $file_prefix; -global $wp_cache_mutex_disabled, $mutex_filename, $sem_id, $wp_super_cache_late_init; -global $cache_compression, $cache_max_time, $wp_cache_shutdown_gc, $cache_rebuild_files; -global $wp_super_cache_debug, $wp_super_cache_advanced_debug, $wp_cache_debug_level, $wp_cache_debug_to_file; -global $wp_cache_debug_log, $wp_cache_debug_ip, $wp_cache_debug_username, $wp_cache_debug_email; +global $wpsc_config; +global $wp_super_cache_advanced_debug, $wp_cache_debug_level, $wp_cache_debug_to_file; +global $wp_cache_debug_ip, $wp_cache_debug_email; global $cache_time_interval, $cache_scheduled_time, $cache_schedule_interval, $cache_schedule_type, $cache_gc_email_me; global $wp_cache_preload_on, $wp_cache_preload_interval, $wp_cache_preload_posts, $wp_cache_preload_taxonomies; global $wp_cache_preload_email_me, $wp_cache_preload_email_volume; @@ -84,12 +82,12 @@ function wpsc_init() { global $wp_cache_config_file, $wp_cache_config_file_sample; // Check is cache config already loaded. -if ( ! isset( $cache_enabled, $super_cache_enabled, $wp_cache_mod_rewrite, $cache_path ) && +if ( ! isset( $GLOBALS['wpsc_config']['cache_enabled'], $GLOBALS['wpsc_config']['super_cache_enabled'], $GLOBALS['wpsc_config']['wp_cache_mod_rewrite'], $GLOBALS['wpsc_config']['cache_path'] ) && 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_once './wp-cache-phase1.php'; } include(WPCACHEHOME . 'wp-cache-base.php'); @@ -147,7 +145,7 @@ function wpsc_remove_advanced_cache() { } function wpsupercache_uninstall() { - global $wp_cache_config_file, $cache_path; + global $wp_cache_config_file; wpsc_remove_advanced_cache(); @@ -157,10 +155,10 @@ function wpsupercache_uninstall() { wp_cache_remove_index(); - if ( ! empty( $cache_path ) ) { - @unlink( $cache_path . '.htaccess' ); - @unlink( $cache_path . 'meta' ); - @unlink( $cache_path . 'supercache' ); + if ( ! empty( $GLOBALS['wpsc_config']['cache_path'] ) ) { + @unlink( $GLOBALS['wpsc_config']['cache_path'] . '.htaccess' ); + @unlink( $GLOBALS['wpsc_config']['cache_path'] . 'meta' ); + @unlink( $GLOBALS['wpsc_config']['cache_path'] . 'supercache' ); } wp_clear_scheduled_hook( 'wp_cache_check_site_hook' ); @@ -174,16 +172,16 @@ function wpsupercache_uninstall() { } function wpsupercache_deactivate() { - global $wp_cache_config_file, $wpsc_advanced_cache_filename, $cache_path; + global $wp_cache_config_file, $wpsc_advanced_cache_filename; wpsc_remove_advanced_cache(); - if ( ! empty( $cache_path ) ) { - prune_super_cache( $cache_path, true ); + if ( ! empty( $GLOBALS['wpsc_config']['cache_path'] ) ) { + prune_super_cache( $GLOBALS['wpsc_config']['cache_path'], true ); wp_cache_remove_index(); - @unlink( $cache_path . '.htaccess' ); - @unlink( $cache_path . 'meta' ); - @unlink( $cache_path . 'supercache' ); + @unlink( $GLOBALS['wpsc_config']['cache_path'] . '.htaccess' ); + @unlink( $GLOBALS['wpsc_config']['cache_path'] . 'meta' ); + @unlink( $GLOBALS['wpsc_config']['cache_path'] . 'supercache' ); } wp_clear_scheduled_hook( 'wp_cache_check_site_hook' ); @@ -195,9 +193,8 @@ function wpsupercache_deactivate() { register_deactivation_hook( __FILE__, 'wpsupercache_deactivate' ); function wpsupercache_activate() { - global $cache_path; - if ( ! isset( $cache_path ) || $cache_path == '' ) - $cache_path = WP_CONTENT_DIR . '/cache/'; // from sample config file + if ( ! isset( $GLOBALS['wpsc_config']['cache_path'] ) || $GLOBALS['wpsc_config']['cache_path'] == '' ) + $GLOBALS['wpsc_config']['cache_path'] = WP_CONTENT_DIR . '/cache/'; // from sample config file ob_start(); wpsc_init(); @@ -242,8 +239,8 @@ function wp_cache_network_pages() { add_action( 'network_admin_menu', '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 $wp_cache_debug, $wp_cache_cron_check, $wp_cache_config_file, $wp_cache_mobile_browsers, $wp_cache_mobile_prefixes, $wp_cache_mobile_browsers, $wp_cache_mobile_enabled; + global $dismiss_htaccess_warning, $dismiss_readable_warning, $dismiss_gc_warning, $is_nginx; global $htaccess_path; if ( ! wpsupercache_site_admin() ) { @@ -336,9 +333,9 @@ function wp_cache_manager_error_checks() { } if ( - $cache_enabled == true && - $super_cache_enabled == true && - $wp_cache_mod_rewrite && + $GLOBALS['wpsc_config']['cache_enabled'] == true && + $GLOBALS['wpsc_config']['super_cache_enabled'] == true && + $GLOBALS['wpsc_config']['wp_cache_mod_rewrite'] && ! got_mod_rewrite() && ! $is_nginx ) { @@ -368,7 +365,7 @@ function wp_cache_manager_error_checks() { } elseif ( !isset( $dismiss_gc_warning ) ) { $dismiss_gc_warning = 0; } - if ( $cache_enabled && ( !isset( $wp_cache_shutdown_gc ) || $wp_cache_shutdown_gc == 0 ) && function_exists( 'get_gc_flag' ) ) { + if ( $GLOBALS['wpsc_config']['cache_enabled'] && ( ! isset( $GLOBALS['wpsc_config']['wp_cache_shutdown_gc'] ) || $GLOBALS['wpsc_config']['wp_cache_shutdown_gc'] == 0 ) && function_exists( 'get_gc_flag' ) ) { $gc_flag = get_gc_flag(); if ( $dismiss_gc_warning == 0 ) { if ( false == maybe_stop_gc( $gc_flag ) && false == wp_next_scheduled( 'wp_cache_gc' ) ) { @@ -421,10 +418,10 @@ function wp_cache_manager_error_checks() { $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 ), ' ' ) ) ) { + if ( $GLOBALS['wpsc_config']['cache_enabled'] && $GLOBALS['wpsc_config']['wp_cache_mod_rewrite'] && !$wp_cache_mobile_enabled && strpos( $scrules, addcslashes( str_replace( ', ', '|', $wp_cache_mobile_browsers ), ' ' ) ) ) { echo '"; - } elseif ( $wp_cache_mod_rewrite && $cache_enabled && $wp_cache_mobile_enabled && $scrules != '' && ( + } elseif ( $GLOBALS['wpsc_config']['wp_cache_mod_rewrite'] && $GLOBALS['wpsc_config']['cache_enabled'] && $wp_cache_mobile_enabled && $scrules != '' && ( ( '' != $wp_cache_mobile_prefixes && false === strpos( $scrules, addcslashes( str_replace( ', ', '|', $wp_cache_mobile_prefixes ), ' ' ) ) ) || ( '' != $wp_cache_mobile_browsers && false === strpos( $scrules, addcslashes( str_replace( ', ', '|', $wp_cache_mobile_browsers ), ' ' ) ) ) ) ) { @@ -439,14 +436,14 @@ function wp_cache_manager_error_checks() {' . __( 'Mobile rewrite rules detected', 'wp-super-cache' ) . "
"; echo "" . __( 'For best performance you should enable "Mobile device support" or delete the mobile rewrite rules in your .htaccess. Look for the 2 lines with the text "2.0\ MMP|240x320" and delete those.', 'wp-super-cache' ) . "
" . __( 'This will have no affect on ordinary users but mobile users will see uncached pages.', 'wp-super-cache' ) . "
__( 'Required to serve compressed supercache files properly.', 'wp-super-cache' ), 'mod_headers' => __( 'Required to set caching information on supercache pages. IE7 users will see old pages without this module.', 'wp-super-cache' ), 'mod_expires' => __( 'Set the expiry date on supercached pages. Visitors may not see new pages when they refresh or leave comments without this module.', 'wp-super-cache' ) ); foreach( $required_modules as $req => $desc ) { @@ -474,7 +471,7 @@ function wp_cache_manager_error_checks() { } if ( isset( $disable_supercache_htaccess_warning ) == false ) $disable_supercache_htaccess_warning = false; - if ( ! $is_nginx && $dismiss_htaccess_warning == 0 && $wp_cache_mod_rewrite && $super_cache_enabled && $disable_supercache_htaccess_warning == false && get_option( 'siteurl' ) != get_option( 'home' ) ) { + if ( ! $is_nginx && $dismiss_htaccess_warning == 0 && $GLOBALS['wpsc_config']['wp_cache_mod_rewrite'] && $GLOBALS['wpsc_config']['super_cache_enabled'] && $disable_supercache_htaccess_warning == false && get_option( 'siteurl' ) != get_option( 'home' ) ) { ?>Update Mod_Rewrite Rules button.', 'wp-super-cache' ); ?>
here. Unfortunately, WordPress writes to the .htaccess in the install directory, not where your site is served from.
When you update the rewrite rules in this plugin you will have to copy the file to where your site is hosted. This will be fixed in the future.', 'wp-super-cache' ); ?>