Version Description
Download this release
Release Info
Developer | donncha |
Plugin | WP Super Cache |
Version | 1.6.2 |
Comparing to | |
See all releases |
Code changes from version 1.6.1 to 1.6.2
- readme.txt +12 -4
- wp-cache-phase2.php +75 -26
- wp-cache.php +27 -4
readme.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
# WP Super Cache #
|
2 |
* Contributors: donncha, automattic, kraftbj
|
3 |
* Tags: performance, caching, wp-cache, wp-super-cache, cache
|
4 |
-
* Tested up to: 4.9.
|
5 |
-
* Stable tag: 1.6.
|
6 |
* Requires at least: 3.0
|
7 |
* Requires PHP: 5.2.4
|
8 |
* License: GPLv2 or later
|
@@ -89,7 +89,7 @@ There is one regular WordPress filter too. Use the "do_createsupercache" filter
|
|
89 |
to customize the checks made before caching. The filter accepts one parameter.
|
90 |
The output of WP-Cache's wp_cache_get_cookies_values() function.
|
91 |
|
92 |
-
See plugins/searchengine.php as an example I use for my [No Adverts for Friends](https://odd.blog/no-adverts-for-friends/) plugin.
|
93 |
|
94 |
### Troubleshooting ###
|
95 |
If things don't work when you installed the plugin here are a few things to check:
|
@@ -261,6 +261,14 @@ Your theme is probably responsive which means it resizes the page to suit whatev
|
|
261 |
|
262 |
## Changelog ##
|
263 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
### 1.6.1 ###
|
265 |
* Fix the name of the WP Crontrol plugin. (#549)
|
266 |
* Handle errors during deactivation/uninstall by email rather than exiting. (#551)
|
@@ -655,4 +663,4 @@ Your theme is probably responsive which means it resizes the page to suit whatev
|
|
655 |
|
656 |
|
657 |
## Upgrade Notice ##
|
658 |
-
|
1 |
# WP Super Cache #
|
2 |
* Contributors: donncha, automattic, kraftbj
|
3 |
* Tags: performance, caching, wp-cache, wp-super-cache, cache
|
4 |
+
* Tested up to: 4.9.6
|
5 |
+
* Stable tag: 1.6.2
|
6 |
* Requires at least: 3.0
|
7 |
* Requires PHP: 5.2.4
|
8 |
* License: GPLv2 or later
|
89 |
to customize the checks made before caching. The filter accepts one parameter.
|
90 |
The output of WP-Cache's wp_cache_get_cookies_values() function.
|
91 |
|
92 |
+
See [plugins/searchengine.php](https://github.com/Automattic/wp-super-cache/blob/4cda5c0f2218e40e118232b5bf22d227fb3206b7/plugins/searchengine.php) as an example I use for my [No Adverts for Friends](https://odd.blog/no-adverts-for-friends/) plugin.
|
93 |
|
94 |
### Troubleshooting ###
|
95 |
If things don't work when you installed the plugin here are a few things to check:
|
261 |
|
262 |
## Changelog ##
|
263 |
|
264 |
+
### 1.6.2 ###
|
265 |
+
* Fixed serving expired supercache files (#562)
|
266 |
+
* Write directly to the config file to avoid permission problems with wp-content. (#563)
|
267 |
+
* Correctly set the .htaccess rules on the main site of a multisite. (#557)
|
268 |
+
* Check if set_transient() exists before using it. (#565)
|
269 |
+
* Removed searchengine.php example plugin as it sets a cookie to track users. Still available [here](https://github.com/Automattic/wp-super-cache/blob/4cda5c0f2218e40e118232b5bf22d227fb3206b7/plugins/searchengine.php). (#567)
|
270 |
+
* For advanced users only. Change the vary and cache control headers. See https://github.com/Automattic/wp-super-cache/pull/555 (#555)
|
271 |
+
|
272 |
### 1.6.1 ###
|
273 |
* Fix the name of the WP Crontrol plugin. (#549)
|
274 |
* Handle errors during deactivation/uninstall by email rather than exiting. (#551)
|
663 |
|
664 |
|
665 |
## Upgrade Notice ##
|
666 |
+
Fix problems writing to the config file for some users.
|
wp-cache-phase2.php
CHANGED
@@ -104,6 +104,7 @@ function wp_cache_serve_cache_file() {
|
|
104 |
}
|
105 |
} else { // no $cache_file
|
106 |
global $wpsc_save_headers;
|
|
|
107 |
// last chance, check if a supercache file exists. Just in case .htaccess rules don't work on this host
|
108 |
$filename = supercache_filename();
|
109 |
$file = get_current_url_supercache_dir() . $filename;
|
@@ -119,6 +120,9 @@ function wp_cache_serve_cache_file() {
|
|
119 |
} elseif ( isset( $wpsc_save_headers ) && $wpsc_save_headers ) {
|
120 |
wp_cache_debug( 'Saving headers. Cannot serve a supercache file.' );
|
121 |
return false;
|
|
|
|
|
|
|
122 |
}
|
123 |
|
124 |
if ( isset( $wp_cache_mfunc_enabled ) == false )
|
@@ -158,8 +162,20 @@ function wp_cache_serve_cache_file() {
|
|
158 |
if ( isset( $wp_cache_disable_utf8 ) == false || $wp_cache_disable_utf8 == 0 )
|
159 |
header( "Content-type: text/html; charset=UTF-8" );
|
160 |
|
161 |
-
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
$size = function_exists( 'mb_strlen' ) ? mb_strlen( $cachefiledata, '8bit' ) : strlen( $cachefiledata );
|
164 |
if ( $wp_cache_gzip_encoding ) {
|
165 |
if ( isset( $wpsc_served_header ) && $wpsc_served_header ) {
|
@@ -1046,22 +1062,19 @@ function wp_cache_setting( $field, $value ) {
|
|
1046 |
|
1047 |
function wp_cache_replace_line( $old, $new, $my_file ) {
|
1048 |
if ( @is_file( $my_file ) == false ) {
|
1049 |
-
|
|
|
|
|
1050 |
return false;
|
1051 |
}
|
1052 |
if (!is_writeable_ACLSafe($my_file)) {
|
1053 |
-
|
|
|
|
|
1054 |
trigger_error( "Error: file $my_file is not writable." );
|
1055 |
return false;
|
1056 |
}
|
1057 |
|
1058 |
-
$tmp_file = tempnam( sys_get_temp_dir(), 'wpsc' );
|
1059 |
-
if ( ! is_writeable_ACLSafe( $tmp_file ) ) {
|
1060 |
-
set_transient( 'wpsc_config_error', 'tmp_file_ro', 10 );
|
1061 |
-
trigger_error( "Error: temporary file $tmp_file is not writable. Make sure directory is writeable." );
|
1062 |
-
return false;
|
1063 |
-
}
|
1064 |
-
|
1065 |
$found = false;
|
1066 |
$loaded = false;
|
1067 |
$c = 0;
|
@@ -1073,7 +1086,9 @@ function wp_cache_replace_line( $old, $new, $my_file ) {
|
|
1073 |
} else {
|
1074 |
$c++;
|
1075 |
if ( $c > 100 ) {
|
1076 |
-
|
|
|
|
|
1077 |
trigger_error( "wp_cache_replace_line: Error - file $my_file could not be loaded." );
|
1078 |
return false;
|
1079 |
}
|
@@ -1086,10 +1101,12 @@ function wp_cache_replace_line( $old, $new, $my_file ) {
|
|
1086 |
}
|
1087 |
}
|
1088 |
|
1089 |
-
$fd = fopen( $
|
1090 |
if ( ! $fd ) {
|
1091 |
-
|
1092 |
-
|
|
|
|
|
1093 |
return false;
|
1094 |
}
|
1095 |
if ( $found ) {
|
@@ -1114,12 +1131,6 @@ function wp_cache_replace_line( $old, $new, $my_file ) {
|
|
1114 |
}
|
1115 |
fclose( $fd );
|
1116 |
|
1117 |
-
if ( ! rename( $tmp_file, $my_file ) ) {
|
1118 |
-
set_transient( 'wpsc_config_error', 'error_move_tmp_config_file', 10 );
|
1119 |
-
trigger_error( "wp_cache_replace_line: Error - could not rename $tmp_file to $my_file" );
|
1120 |
-
return false;
|
1121 |
-
}
|
1122 |
-
|
1123 |
if ( function_exists( "opcache_invalidate" ) ) {
|
1124 |
@opcache_invalidate( $my_file );
|
1125 |
}
|
@@ -1164,7 +1175,13 @@ function wp_cache_phase2() {
|
|
1164 |
$super_cache_enabled = false;
|
1165 |
}
|
1166 |
|
1167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1168 |
|
1169 |
ob_start( 'wp_cache_ob_callback' );
|
1170 |
wp_cache_debug( 'Created output buffer', 4 );
|
@@ -1982,6 +1999,18 @@ function wp_cache_get_ob(&$buffer) {
|
|
1982 |
$gzsize = function_exists( 'mb_strlen' ) ? mb_strlen( $gzdata, '8bit' ) : strlen( $gzdata );
|
1983 |
}
|
1984 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1985 |
if ( $gz || $wp_cache_gzip_encoding ) {
|
1986 |
wp_cache_debug( 'Gzipping buffer.', 5 );
|
1987 |
wp_cache_add_to_buffer( $buffer, "Compression = gzip" );
|
@@ -1989,7 +2018,6 @@ function wp_cache_get_ob(&$buffer) {
|
|
1989 |
$gzsize = function_exists( 'mb_strlen' ) ? mb_strlen( $gzdata, '8bit' ) : strlen( $gzdata );
|
1990 |
|
1991 |
$wp_cache_meta[ 'headers' ][ 'Content-Encoding' ] = 'Content-Encoding: ' . $wp_cache_gzip_encoding;
|
1992 |
-
$wp_cache_meta[ 'headers' ][ 'Vary' ] = 'Vary: Accept-Encoding, Cookie';
|
1993 |
// Return uncompressed data & store compressed for later use
|
1994 |
if ( $fr ) {
|
1995 |
wp_cache_debug( 'Writing gzipped buffer to wp-cache cache file.', 5 );
|
@@ -1999,7 +2027,6 @@ function wp_cache_get_ob(&$buffer) {
|
|
1999 |
$added_cache = 1;
|
2000 |
}
|
2001 |
} else { // no compression
|
2002 |
-
$wp_cache_meta[ 'headers' ][ 'Vary' ] = 'Vary: Cookie';
|
2003 |
if ( $cache_enabled && $wp_cache_object_cache ) {
|
2004 |
wp_cache_set( $oc_key, $buffer, 'supercache', $cache_max_time );
|
2005 |
$added_cache = 1;
|
@@ -2087,7 +2114,18 @@ function wp_cache_get_ob(&$buffer) {
|
|
2087 |
if ( !headers_sent() && $wp_cache_gzip_encoding && $gzdata) {
|
2088 |
wp_cache_debug( 'Writing gzip content headers. Sending buffer to browser', 5 );
|
2089 |
header( 'Content-Encoding: ' . $wp_cache_gzip_encoding );
|
2090 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2091 |
header( 'Content-Length: ' . $gzsize );
|
2092 |
return $gzdata;
|
2093 |
} else {
|
@@ -2414,7 +2452,18 @@ function wp_cache_shutdown_callback() {
|
|
2414 |
if( !isset( $wp_cache_meta[ 'dynamic' ] ) && $wp_cache_gzip_encoding && !in_array( 'Content-Encoding: ' . $wp_cache_gzip_encoding, $wp_cache_meta[ 'headers' ] ) ) {
|
2415 |
wp_cache_debug( 'Sending gzip headers.', 2 );
|
2416 |
$wp_cache_meta[ 'headers' ][ 'Content-Encoding' ] = 'Content-Encoding: ' . $wp_cache_gzip_encoding;
|
2417 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2418 |
}
|
2419 |
|
2420 |
$serial = '<?php die(); ?>' . json_encode( $wp_cache_meta );
|
104 |
}
|
105 |
} else { // no $cache_file
|
106 |
global $wpsc_save_headers;
|
107 |
+
global $cache_max_time;
|
108 |
// last chance, check if a supercache file exists. Just in case .htaccess rules don't work on this host
|
109 |
$filename = supercache_filename();
|
110 |
$file = get_current_url_supercache_dir() . $filename;
|
120 |
} elseif ( isset( $wpsc_save_headers ) && $wpsc_save_headers ) {
|
121 |
wp_cache_debug( 'Saving headers. Cannot serve a supercache file.' );
|
122 |
return false;
|
123 |
+
} elseif ( ( filemtime( $file ) + $cache_max_time ) < time() ) {
|
124 |
+
wp_cache_debug( sprintf( "Cache has expired and is older than %d seconds old.", $cache_max_time ) );
|
125 |
+
return false;
|
126 |
}
|
127 |
|
128 |
if ( isset( $wp_cache_mfunc_enabled ) == false )
|
162 |
if ( isset( $wp_cache_disable_utf8 ) == false || $wp_cache_disable_utf8 == 0 )
|
163 |
header( "Content-type: text/html; charset=UTF-8" );
|
164 |
|
165 |
+
if ( defined( 'WPSC_VARY_HEADER' ) ) {
|
166 |
+
if ( WPSC_VARY_HEADER != '' ) {
|
167 |
+
header( "Vary: " . WPSC_VARY_HEADER );
|
168 |
+
}
|
169 |
+
} else {
|
170 |
+
header( "Vary: Accept-Encoding, Cookie" );
|
171 |
+
}
|
172 |
+
if ( defined( 'WPSC_CACHE_CONTROL_HEADER' ) ) {
|
173 |
+
if ( WPSC_CACHE_CONTROL_HEADER != '' ) {
|
174 |
+
header( "Cache-Control: " . WPSC_CACHE_CONTROL_HEADER );
|
175 |
+
}
|
176 |
+
} else {
|
177 |
+
header( "Cache-Control: max-age=3, must-revalidate" );
|
178 |
+
}
|
179 |
$size = function_exists( 'mb_strlen' ) ? mb_strlen( $cachefiledata, '8bit' ) : strlen( $cachefiledata );
|
180 |
if ( $wp_cache_gzip_encoding ) {
|
181 |
if ( isset( $wpsc_served_header ) && $wpsc_served_header ) {
|
1062 |
|
1063 |
function wp_cache_replace_line( $old, $new, $my_file ) {
|
1064 |
if ( @is_file( $my_file ) == false ) {
|
1065 |
+
if ( function_exists( 'set_transient' ) ) {
|
1066 |
+
set_transient( 'wpsc_config_error', 'config_file_missing', 10 );
|
1067 |
+
}
|
1068 |
return false;
|
1069 |
}
|
1070 |
if (!is_writeable_ACLSafe($my_file)) {
|
1071 |
+
if ( function_exists( 'set_transient' ) ) {
|
1072 |
+
set_transient( 'wpsc_config_error', 'config_file_ro', 10 );
|
1073 |
+
}
|
1074 |
trigger_error( "Error: file $my_file is not writable." );
|
1075 |
return false;
|
1076 |
}
|
1077 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1078 |
$found = false;
|
1079 |
$loaded = false;
|
1080 |
$c = 0;
|
1086 |
} else {
|
1087 |
$c++;
|
1088 |
if ( $c > 100 ) {
|
1089 |
+
if ( function_exists( 'set_transient' ) ) {
|
1090 |
+
set_transient( 'wpsc_config_error', 'config_file_not_loaded', 10 );
|
1091 |
+
}
|
1092 |
trigger_error( "wp_cache_replace_line: Error - file $my_file could not be loaded." );
|
1093 |
return false;
|
1094 |
}
|
1101 |
}
|
1102 |
}
|
1103 |
|
1104 |
+
$fd = fopen( $my_file, 'w' );
|
1105 |
if ( ! $fd ) {
|
1106 |
+
if ( function_exists( 'set_transient' ) ) {
|
1107 |
+
set_transient( 'wpsc_config_error', 'config_file_ro', 10 );
|
1108 |
+
}
|
1109 |
+
trigger_error( "wp_cache_replace_line: Error - could not write to $my_file" );
|
1110 |
return false;
|
1111 |
}
|
1112 |
if ( $found ) {
|
1131 |
}
|
1132 |
fclose( $fd );
|
1133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1134 |
if ( function_exists( "opcache_invalidate" ) ) {
|
1135 |
@opcache_invalidate( $my_file );
|
1136 |
}
|
1175 |
$super_cache_enabled = false;
|
1176 |
}
|
1177 |
|
1178 |
+
if ( defined( 'WPSC_VARY_HEADER' ) ) {
|
1179 |
+
if ( WPSC_VARY_HEADER != '' ) {
|
1180 |
+
header( 'Vary: ' . WPSC_VARY_HEADER );
|
1181 |
+
}
|
1182 |
+
} else {
|
1183 |
+
header( 'Vary: Accept-Encoding, Cookie' );
|
1184 |
+
}
|
1185 |
|
1186 |
ob_start( 'wp_cache_ob_callback' );
|
1187 |
wp_cache_debug( 'Created output buffer', 4 );
|
1999 |
$gzsize = function_exists( 'mb_strlen' ) ? mb_strlen( $gzdata, '8bit' ) : strlen( $gzdata );
|
2000 |
}
|
2001 |
} else {
|
2002 |
+
if ( defined( 'WPSC_VARY_HEADER' ) ) {
|
2003 |
+
if ( WPSC_VARY_HEADER != '' ) {
|
2004 |
+
$vary_header = WPSC_VARY_HEADER;
|
2005 |
+
} else {
|
2006 |
+
$vary_header = '';
|
2007 |
+
}
|
2008 |
+
} else {
|
2009 |
+
$vary_header = 'Accept-Encoding, Cookie';
|
2010 |
+
}
|
2011 |
+
if ( $vary_header ) {
|
2012 |
+
$wp_cache_meta[ 'headers' ][ 'Vary' ] = 'Vary: ' . $vary_header;
|
2013 |
+
}
|
2014 |
if ( $gz || $wp_cache_gzip_encoding ) {
|
2015 |
wp_cache_debug( 'Gzipping buffer.', 5 );
|
2016 |
wp_cache_add_to_buffer( $buffer, "Compression = gzip" );
|
2018 |
$gzsize = function_exists( 'mb_strlen' ) ? mb_strlen( $gzdata, '8bit' ) : strlen( $gzdata );
|
2019 |
|
2020 |
$wp_cache_meta[ 'headers' ][ 'Content-Encoding' ] = 'Content-Encoding: ' . $wp_cache_gzip_encoding;
|
|
|
2021 |
// Return uncompressed data & store compressed for later use
|
2022 |
if ( $fr ) {
|
2023 |
wp_cache_debug( 'Writing gzipped buffer to wp-cache cache file.', 5 );
|
2027 |
$added_cache = 1;
|
2028 |
}
|
2029 |
} else { // no compression
|
|
|
2030 |
if ( $cache_enabled && $wp_cache_object_cache ) {
|
2031 |
wp_cache_set( $oc_key, $buffer, 'supercache', $cache_max_time );
|
2032 |
$added_cache = 1;
|
2114 |
if ( !headers_sent() && $wp_cache_gzip_encoding && $gzdata) {
|
2115 |
wp_cache_debug( 'Writing gzip content headers. Sending buffer to browser', 5 );
|
2116 |
header( 'Content-Encoding: ' . $wp_cache_gzip_encoding );
|
2117 |
+
if ( defined( 'WPSC_VARY_HEADER' ) ) {
|
2118 |
+
if ( WPSC_VARY_HEADER != '' ) {
|
2119 |
+
$vary_header = WPSC_VARY_HEADER;
|
2120 |
+
} else {
|
2121 |
+
$vary_header = '';
|
2122 |
+
}
|
2123 |
+
} else {
|
2124 |
+
$vary_header = 'Accept-Encoding, Cookie';
|
2125 |
+
}
|
2126 |
+
if ( $vary_header ) {
|
2127 |
+
header( 'Vary: ' . $vary_header );
|
2128 |
+
}
|
2129 |
header( 'Content-Length: ' . $gzsize );
|
2130 |
return $gzdata;
|
2131 |
} else {
|
2452 |
if( !isset( $wp_cache_meta[ 'dynamic' ] ) && $wp_cache_gzip_encoding && !in_array( 'Content-Encoding: ' . $wp_cache_gzip_encoding, $wp_cache_meta[ 'headers' ] ) ) {
|
2453 |
wp_cache_debug( 'Sending gzip headers.', 2 );
|
2454 |
$wp_cache_meta[ 'headers' ][ 'Content-Encoding' ] = 'Content-Encoding: ' . $wp_cache_gzip_encoding;
|
2455 |
+
if ( defined( 'WPSC_VARY_HEADER' ) ) {
|
2456 |
+
if ( WPSC_VARY_HEADER != '' ) {
|
2457 |
+
$vary_header = WPSC_VARY_HEADER;
|
2458 |
+
} else {
|
2459 |
+
$vary_header = '';
|
2460 |
+
}
|
2461 |
+
} else {
|
2462 |
+
$vary_header = 'Accept-Encoding, Cookie';
|
2463 |
+
}
|
2464 |
+
if ( $vary_header ) {
|
2465 |
+
$wp_cache_meta[ 'headers' ][ 'Vary' ] = 'Vary: ' . $vary_header;
|
2466 |
+
}
|
2467 |
}
|
2468 |
|
2469 |
$serial = '<?php die(); ?>' . json_encode( $wp_cache_meta );
|
wp-cache.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP Super Cache
|
4 |
Plugin URI: https://wordpress.org/plugins/wp-super-cache/
|
5 |
Description: Very fast caching plugin for WordPress.
|
6 |
-
Version: 1.6.
|
7 |
Author: Automattic
|
8 |
Author URI: https://automattic.com/
|
9 |
License: GPL2+
|
@@ -378,7 +378,7 @@ function wp_cache_manager_error_checks() {
|
|
378 |
}
|
379 |
|
380 |
if ( ! $is_nginx && function_exists( "is_main_site" ) && true == is_main_site() ) {
|
381 |
-
if ( isset( $htaccess_path ) ) {
|
382 |
$home_path = trailingslashit( get_home_path() );
|
383 |
} else {
|
384 |
$home_path = $htaccess_path;
|
@@ -2315,7 +2315,7 @@ function wpsc_config_file_notices() {
|
|
2315 |
$msg = sprintf( __( 'Error: Configuration file %s could not be loaded. Please reload the page.' ), $wp_cache_config_file );
|
2316 |
break;
|
2317 |
case 'config_file_missing':
|
2318 |
-
$msg = sprintf( __( 'Error: Configuration file %s
|
2319 |
break;
|
2320 |
|
2321 |
}
|
@@ -3337,7 +3337,30 @@ function wpsc_get_htaccess_info() {
|
|
3337 |
|
3338 |
$gziprules = "<IfModule mod_mime.c>\n <FilesMatch \"\\.html\\.gz\$\">\n ForceType text/html\n FileETag None\n </FilesMatch>\n AddEncoding gzip .gz\n AddType text/html .gz\n</IfModule>\n";
|
3339 |
$gziprules .= "<IfModule mod_deflate.c>\n SetEnvIfNoCase Request_URI \.gz$ no-gzip\n</IfModule>\n";
|
3340 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3341 |
$gziprules .= "<IfModule mod_expires.c>\n ExpiresActive On\n ExpiresByType text/html A3\n</IfModule>\n";
|
3342 |
$gziprules .= "Options -Indexes\n";
|
3343 |
return array( "document_root" => $document_root, "apache_root" => $apache_root, "home_path" => $home_path, "home_root" => $home_root, "home_root_lc" => $home_root_lc, "inst_root" => $inst_root, "wprules" => $wprules, "scrules" => $scrules, "condition_rules" => $condition_rules, "rules" => $rules, "gziprules" => $gziprules );
|
3 |
Plugin Name: WP Super Cache
|
4 |
Plugin URI: https://wordpress.org/plugins/wp-super-cache/
|
5 |
Description: Very fast caching plugin for WordPress.
|
6 |
+
Version: 1.6.2
|
7 |
Author: Automattic
|
8 |
Author URI: https://automattic.com/
|
9 |
License: GPL2+
|
378 |
}
|
379 |
|
380 |
if ( ! $is_nginx && function_exists( "is_main_site" ) && true == is_main_site() ) {
|
381 |
+
if ( ! isset( $htaccess_path ) ) {
|
382 |
$home_path = trailingslashit( get_home_path() );
|
383 |
} else {
|
384 |
$home_path = $htaccess_path;
|
2315 |
$msg = sprintf( __( 'Error: Configuration file %s could not be loaded. Please reload the page.' ), $wp_cache_config_file );
|
2316 |
break;
|
2317 |
case 'config_file_missing':
|
2318 |
+
$msg = sprintf( __( 'Error: Configuration file %s is missing. Please reload the page.' ), $wp_cache_config_file );
|
2319 |
break;
|
2320 |
|
2321 |
}
|
3337 |
|
3338 |
$gziprules = "<IfModule mod_mime.c>\n <FilesMatch \"\\.html\\.gz\$\">\n ForceType text/html\n FileETag None\n </FilesMatch>\n AddEncoding gzip .gz\n AddType text/html .gz\n</IfModule>\n";
|
3339 |
$gziprules .= "<IfModule mod_deflate.c>\n SetEnvIfNoCase Request_URI \.gz$ no-gzip\n</IfModule>\n";
|
3340 |
+
if ( defined( 'WPSC_VARY_HEADER' ) ) {
|
3341 |
+
if ( WPSC_VARY_HEADER != '' ) {
|
3342 |
+
$vary_header = WPSC_VARY_HEADER;
|
3343 |
+
}
|
3344 |
+
} else {
|
3345 |
+
$vary_header = 'Accept-Encoding, Cookie';
|
3346 |
+
}
|
3347 |
+
if ( defined( 'WPSC_CACHE_CONTROL_HEADER' ) ) {
|
3348 |
+
if ( WPSC_CACHE_CONTROL_HEADER != '' ) {
|
3349 |
+
$cache_control_header = WPSC_CACHE_CONTROL_HEADER;
|
3350 |
+
}
|
3351 |
+
} else {
|
3352 |
+
$cache_control_header = 'max-age=3, must-revalidate';
|
3353 |
+
}
|
3354 |
+
$headers_text = "";
|
3355 |
+
if ( $vary_header != '' ) {
|
3356 |
+
$headers_text .= " Header set Vary '$vary_header'\n";
|
3357 |
+
}
|
3358 |
+
if ( $cache_control_header != '' ) {
|
3359 |
+
$headers_text .= " Header set Cache-Control '$cache_control_header'\n";
|
3360 |
+
}
|
3361 |
+
if ( $headers_text != '' ) {
|
3362 |
+
$gziprules .= "<IfModule mod_headers.c>\n$headers_text</IfModule>\n";
|
3363 |
+
}
|
3364 |
$gziprules .= "<IfModule mod_expires.c>\n ExpiresActive On\n ExpiresByType text/html A3\n</IfModule>\n";
|
3365 |
$gziprules .= "Options -Indexes\n";
|
3366 |
return array( "document_root" => $document_root, "apache_root" => $apache_root, "home_path" => $home_path, "home_root" => $home_root, "home_root_lc" => $home_root_lc, "inst_root" => $inst_root, "wprules" => $wprules, "scrules" => $scrules, "condition_rules" => $condition_rules, "rules" => $rules, "gziprules" => $gziprules );
|