Version Description
Added REST API settings endpoints, simplified settings, reorganised cache files. Lots of bug fixes.
=
Download this release
Release Info
Developer | donncha |
Plugin | WP Super Cache |
Version | 1.5.0 |
Comparing to | |
See all releases |
Code changes from version 1.4.9 to 1.5.0
- advanced-cache.php +2 -1
- ossdl-cdn.php +22 -11
- plugins/awaitingmoderation.php +3 -3
- plugins/badbehaviour.php +3 -3
- plugins/domain-mapping.php +3 -3
- plugins/jetpack.php +3 -3
- plugins/searchengine.php +2 -3
- plugins/wptouch.php +4 -4
- readme.txt +59 -62
- rest/class.wp-super-cache-rest-delete-cache.php +35 -0
- rest/class.wp-super-cache-rest-get-cache.php +45 -0
- rest/class.wp-super-cache-rest-get-settings.php +201 -0
- rest/class.wp-super-cache-rest-get-stats.php +18 -0
- rest/class.wp-super-cache-rest-get-status.php +114 -0
- rest/class.wp-super-cache-rest-preload.php +31 -0
- rest/class.wp-super-cache-rest-test-cache.php +97 -0
- rest/class.wp-super-cache-rest-update-settings.php +654 -0
- rest/class.wp-super-cache-settings-map.php +259 -0
- rest/load.php +147 -0
- wp-cache-base.php +6 -3
- wp-cache-config-sample.php +19 -1
- wp-cache-phase1.php +131 -17
- wp-cache-phase2.php +315 -121
- wp-cache.php +961 -571
- wp-super-cache.pot +349 -349
advanced-cache.php
CHANGED
@@ -8,8 +8,9 @@ function wpcache_broken_message() {
|
|
8 |
$doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
|
9 |
$xmlrpc_request = defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST;
|
10 |
$rest_request = defined( 'REST_REQUEST' ) && REST_REQUEST;
|
|
|
11 |
|
12 |
-
$skip_output = ( $doing_ajax || $xmlrpc_request || $rest_request );
|
13 |
if ( false == strpos( $_SERVER[ 'REQUEST_URI' ], 'wp-admin' ) && !$skip_output ) {
|
14 |
echo "<!-- 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. -->";
|
15 |
}
|
8 |
$doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
|
9 |
$xmlrpc_request = defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST;
|
10 |
$rest_request = defined( 'REST_REQUEST' ) && REST_REQUEST;
|
11 |
+
$robots_request = strpos( $_SERVER[ 'REQUEST_URI' ], 'robots.txt' ) != false;
|
12 |
|
13 |
+
$skip_output = ( $doing_ajax || $xmlrpc_request || $rest_request || $robots_request);
|
14 |
if ( false == strpos( $_SERVER[ 'REQUEST_URI' ], 'wp-admin' ) && !$skip_output ) {
|
15 |
echo "<!-- 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. -->";
|
16 |
}
|
ossdl-cdn.php
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
|
5 |
/* Set up some defaults */
|
6 |
if ( get_option( 'ossdl_off_cdn_url' ) == false )
|
7 |
-
add_option('ossdl_off_cdn_url',
|
8 |
-
$ossdl_off_blog_url =
|
9 |
$ossdl_off_cdn_url = trim( get_option('ossdl_off_cdn_url') );
|
10 |
if ( get_option( 'ossdl_off_include_dirs' ) == false )
|
11 |
add_option('ossdl_off_include_dirs', 'wp-content,wp-includes');
|
@@ -20,7 +20,7 @@ if ( !is_array( $arr_of_excludes ) )
|
|
20 |
if ( get_option( 'ossdl_cname' ) == false )
|
21 |
add_option('ossdl_cname', '');
|
22 |
$ossdl_cname = trim(get_option('ossdl_cname'));
|
23 |
-
$ossdl_https =
|
24 |
$arr_of_cnames = array_map('trim', explode(',', $ossdl_cname));
|
25 |
if ($arr_of_cnames[0] == '') $arr_of_cnames = array();
|
26 |
|
@@ -123,10 +123,14 @@ if ( false == isset( $ossdlcdn ) )
|
|
123 |
if ( $ossdlcdn == 1 )
|
124 |
add_action('init', 'do_scossdl_off_ob_start');
|
125 |
|
126 |
-
|
127 |
-
global $ossdlcdn, $wp_cache_config_file;
|
128 |
-
|
129 |
$valid_nonce = isset($_REQUEST['_wpnonce']) ? wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache') : false;
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
if ( $valid_nonce && isset($_POST['action']) && ( $_POST['action'] == 'update_ossdl_off' )){
|
131 |
update_option('ossdl_off_cdn_url', $_POST['ossdl_off_cdn_url']);
|
132 |
update_option('ossdl_off_include_dirs', $_POST['ossdl_off_include_dirs'] == '' ? 'wp-content,wp-includes' : $_POST['ossdl_off_include_dirs']);
|
@@ -142,20 +146,27 @@ function scossdl_off_options() {
|
|
142 |
}
|
143 |
wp_cache_replace_line('^ *\$ossdlcdn', "\$ossdlcdn = $ossdlcdn;", $wp_cache_config_file);
|
144 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
$example_cdn_uri = str_replace( 'http://', 'http://cdn.', str_replace( 'www.', '', get_option( 'siteurl' ) ) );
|
146 |
$example_cnames = str_replace( 'http://cdn.', 'http://cdn1.', $example_cdn_uri );
|
147 |
$example_cnames .= ',' . str_replace( 'http://cdn.', 'http://cdn2.', $example_cdn_uri );
|
148 |
$example_cnames .= ',' . str_replace( 'http://cdn.', 'http://cdn3.', $example_cdn_uri );
|
149 |
|
150 |
-
$example_cdn_uri = get_option('ossdl_off_cdn_url') ==
|
151 |
-
$example_cdn_uri .= '/wp-includes/js/
|
152 |
?>
|
153 |
-
<p><?php _e( 'Your website probably uses lots of static files. Image, Javascript and CSS files are usually static files that could just as easily be served from another site or CDN. Therefore, this plugin replaces any links in the <code>wp-content</code> and <code>wp-includes</code> directories (except for PHP files) on your site with the URL you provide below. That way you can either copy all the static content to a dedicated host or mirror the files to a CDN by <a href="
|
154 |
<p><?php printf( __( '<strong style="color: red">WARNING:</strong> Test some static urls e.g., %s to ensure your CDN service is fully working before saving changes.', 'wp-super-cache' ), '<code>' . $example_cdn_uri . '</code>' ); ?></p>
|
155 |
<p><?php _e( 'You can define different CDN URLs for each site on a multsite network.', 'wp-super-cache' ); ?></p>
|
156 |
<p><form method="post" action="">
|
157 |
<?php wp_nonce_field('wp-cache'); ?>
|
158 |
-
<table class="form-table"><
|
159 |
<tr valign="top">
|
160 |
<td style='text-align: right'>
|
161 |
<input id='ossdlcdn' type="checkbox" name="ossdlcdn" value="1" <?php if ( $ossdlcdn ) echo "checked=1"; ?> />
|
@@ -195,7 +206,7 @@ function scossdl_off_options() {
|
|
195 |
</tr>
|
196 |
</tbody></table>
|
197 |
<input type="hidden" name="action" value="update_ossdl_off" />
|
198 |
-
<p class="submit"><input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /></p>
|
199 |
</form></p>
|
200 |
<p><?php _e( 'CDN functionality provided by <a href="http://wordpress.org/plugins/ossdl-cdn-off-linker/">OSSDL CDN Off Linker</a> by <a href="http://mark.ossdl.de/">Mark Kubacki</a>', 'wp-super-cache' ); ?></p>
|
201 |
<?php
|
4 |
|
5 |
/* Set up some defaults */
|
6 |
if ( get_option( 'ossdl_off_cdn_url' ) == false )
|
7 |
+
add_option('ossdl_off_cdn_url', get_home_url() );
|
8 |
+
$ossdl_off_blog_url = apply_filters( 'ossdl_off_blog_url', get_home_url() );
|
9 |
$ossdl_off_cdn_url = trim( get_option('ossdl_off_cdn_url') );
|
10 |
if ( get_option( 'ossdl_off_include_dirs' ) == false )
|
11 |
add_option('ossdl_off_include_dirs', 'wp-content,wp-includes');
|
20 |
if ( get_option( 'ossdl_cname' ) == false )
|
21 |
add_option('ossdl_cname', '');
|
22 |
$ossdl_cname = trim(get_option('ossdl_cname'));
|
23 |
+
$ossdl_https = intval(get_option('ossdl_https'));
|
24 |
$arr_of_cnames = array_map('trim', explode(',', $ossdl_cname));
|
25 |
if ($arr_of_cnames[0] == '') $arr_of_cnames = array();
|
26 |
|
123 |
if ( $ossdlcdn == 1 )
|
124 |
add_action('init', 'do_scossdl_off_ob_start');
|
125 |
|
126 |
+
if ( function_exists( 'wp_verify_nonce' ) )
|
|
|
|
|
127 |
$valid_nonce = isset($_REQUEST['_wpnonce']) ? wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache') : false;
|
128 |
+
else
|
129 |
+
$valid_nonce = false;
|
130 |
+
|
131 |
+
function scossdl_off_update() {
|
132 |
+
global $ossdlcdn, $wp_cache_config_file, $valid_nonce;
|
133 |
+
|
134 |
if ( $valid_nonce && isset($_POST['action']) && ( $_POST['action'] == 'update_ossdl_off' )){
|
135 |
update_option('ossdl_off_cdn_url', $_POST['ossdl_off_cdn_url']);
|
136 |
update_option('ossdl_off_include_dirs', $_POST['ossdl_off_include_dirs'] == '' ? 'wp-content,wp-includes' : $_POST['ossdl_off_include_dirs']);
|
146 |
}
|
147 |
wp_cache_replace_line('^ *\$ossdlcdn', "\$ossdlcdn = $ossdlcdn;", $wp_cache_config_file);
|
148 |
}
|
149 |
+
}
|
150 |
+
|
151 |
+
function scossdl_off_options() {
|
152 |
+
global $ossdlcdn, $wp_cache_config_file, $valid_nonce;
|
153 |
+
|
154 |
+
scossdl_off_update();
|
155 |
+
|
156 |
$example_cdn_uri = str_replace( 'http://', 'http://cdn.', str_replace( 'www.', '', get_option( 'siteurl' ) ) );
|
157 |
$example_cnames = str_replace( 'http://cdn.', 'http://cdn1.', $example_cdn_uri );
|
158 |
$example_cnames .= ',' . str_replace( 'http://cdn.', 'http://cdn2.', $example_cdn_uri );
|
159 |
$example_cnames .= ',' . str_replace( 'http://cdn.', 'http://cdn3.', $example_cdn_uri );
|
160 |
|
161 |
+
$example_cdn_uri = get_option('ossdl_off_cdn_url') == get_home_url() ? $example_cdn_uri : get_option('ossdl_off_cdn_url');
|
162 |
+
$example_cdn_uri .= '/wp-includes/js/jquery/jquery-migrate.js';
|
163 |
?>
|
164 |
+
<p><?php _e( 'Your website probably uses lots of static files. Image, Javascript and CSS files are usually static files that could just as easily be served from another site or CDN. Therefore, this plugin replaces any links in the <code>wp-content</code> and <code>wp-includes</code> directories (except for PHP files) on your site with the URL you provide below. That way you can either copy all the static content to a dedicated host or mirror the files to a CDN by <a href="https://knowledgelayer.softlayer.com/faq/how-does-origin-pull-work" target="_blank">origin pull</a>.', 'wp-super-cache' ); ?></p>
|
165 |
<p><?php printf( __( '<strong style="color: red">WARNING:</strong> Test some static urls e.g., %s to ensure your CDN service is fully working before saving changes.', 'wp-super-cache' ), '<code>' . $example_cdn_uri . '</code>' ); ?></p>
|
166 |
<p><?php _e( 'You can define different CDN URLs for each site on a multsite network.', 'wp-super-cache' ); ?></p>
|
167 |
<p><form method="post" action="">
|
168 |
<?php wp_nonce_field('wp-cache'); ?>
|
169 |
+
<table class="form-table"><tbody>
|
170 |
<tr valign="top">
|
171 |
<td style='text-align: right'>
|
172 |
<input id='ossdlcdn' type="checkbox" name="ossdlcdn" value="1" <?php if ( $ossdlcdn ) echo "checked=1"; ?> />
|
206 |
</tr>
|
207 |
</tbody></table>
|
208 |
<input type="hidden" name="action" value="update_ossdl_off" />
|
209 |
+
<p class="submit"><input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'wp-super-cache' ) ?>" /></p>
|
210 |
</form></p>
|
211 |
<p><?php _e( 'CDN functionality provided by <a href="http://wordpress.org/plugins/ossdl-cdn-off-linker/">OSSDL CDN Off Linker</a> by <a href="http://mark.ossdl.de/">Mark Kubacki</a>', 'wp-super-cache' ); ?></p>
|
212 |
<?php
|
plugins/awaitingmoderation.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
function awaitingmoderation_action( $buffer ) {
|
4 |
-
$buffer = str_replace( __( 'Your comment is awaiting moderation.' ), '', $buffer );
|
5 |
return $buffer;
|
6 |
}
|
7 |
|
@@ -37,9 +37,9 @@ function wp_supercache_awaitingmoderation_admin() {
|
|
37 |
<?php
|
38 |
if ($changed) {
|
39 |
if ( $cache_awaitingmoderation )
|
40 |
-
$status = __( "enabled" );
|
41 |
else
|
42 |
-
$status = __( "disabled" );
|
43 |
echo "<p><strong>" . sprintf( __( "Awaiting Moderation is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
|
44 |
}
|
45 |
echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
|
1 |
<?php
|
2 |
|
3 |
function awaitingmoderation_action( $buffer ) {
|
4 |
+
$buffer = str_replace( __( 'Your comment is awaiting moderation.', 'wp-super-cache' ), '', $buffer );
|
5 |
return $buffer;
|
6 |
}
|
7 |
|
37 |
<?php
|
38 |
if ($changed) {
|
39 |
if ( $cache_awaitingmoderation )
|
40 |
+
$status = __( "enabled", 'wp-super-cache' );
|
41 |
else
|
42 |
+
$status = __( "disabled", 'wp-super-cache' );
|
43 |
echo "<p><strong>" . sprintf( __( "Awaiting Moderation is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
|
44 |
}
|
45 |
echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
|
plugins/badbehaviour.php
CHANGED
@@ -65,12 +65,12 @@ function wp_supercache_badbehaviour_admin() {
|
|
65 |
<label><input type="radio" name="cache_badbehaviour" value="1" <?php if( $cache_badbehaviour ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Enabled', 'wp-super-cache' ); ?></label>
|
66 |
<label><input type="radio" name="cache_badbehaviour" value="0" <?php if( !$cache_badbehaviour ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Disabled', 'wp-super-cache' ); ?></label>
|
67 |
<p><?php _e( '', 'wp-super-cache' ); ?></p><?php
|
68 |
-
echo '<p>' . sprintf( __( '(Only
|
69 |
if ( isset( $changed ) && $changed ) {
|
70 |
if ( $cache_badbehaviour )
|
71 |
-
$status = __( "enabled" );
|
72 |
else
|
73 |
-
$status = __( "disabled" );
|
74 |
echo "<p><strong>" . sprintf( __( "Bad Behavior support is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
|
75 |
}
|
76 |
echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
|
65 |
<label><input type="radio" name="cache_badbehaviour" value="1" <?php if( $cache_badbehaviour ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Enabled', 'wp-super-cache' ); ?></label>
|
66 |
<label><input type="radio" name="cache_badbehaviour" value="0" <?php if( !$cache_badbehaviour ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Disabled', 'wp-super-cache' ); ?></label>
|
67 |
<p><?php _e( '', 'wp-super-cache' ); ?></p><?php
|
68 |
+
echo '<p>' . sprintf( __( '(Only WPCache caching supported, disabled compression and requires <a href="http://www.bad-behavior.ioerror.us/">Bad Behavior</a> in "%s/plugins/bad-behavior/") ', 'wp-super-cache' ), WP_CONTENT_DIR ) . '</p>';
|
69 |
if ( isset( $changed ) && $changed ) {
|
70 |
if ( $cache_badbehaviour )
|
71 |
+
$status = __( "enabled", 'wp-super-cache' );
|
72 |
else
|
73 |
+
$status = __( "disabled", 'wp-super-cache' );
|
74 |
echo "<p><strong>" . sprintf( __( "Bad Behavior support is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
|
75 |
}
|
76 |
echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
|
plugins/domain-mapping.php
CHANGED
@@ -78,9 +78,9 @@ function wp_supercache_domain_mapping_admin() {
|
|
78 |
echo '<p>' . __( 'Provides support for <a href="http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/">Domain Mapping</a> plugin to map multiple domains to a blog.', 'wp-super-cache' ) . '</p>';
|
79 |
if ( isset( $changed ) && $changed ) {
|
80 |
if ( $cache_domain_mapping )
|
81 |
-
$status = __( "enabled" );
|
82 |
else
|
83 |
-
$status = __( "disabled" );
|
84 |
echo "<p><strong>" . sprintf( __( "Domain Mapping support is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
|
85 |
}
|
86 |
echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
|
@@ -93,7 +93,7 @@ function wp_supercache_domain_mapping_admin() {
|
|
93 |
add_cacheaction( 'cache_admin_page', 'wp_supercache_domain_mapping_admin' );
|
94 |
|
95 |
function wp_supercache_domain_mapping_notice() {
|
96 |
-
global $cache_enabled
|
97 |
if( $cache_enabled )
|
98 |
echo '<div class="error"><p><strong>' . __('Domain Mapping plugin detected! Please go to the Supercache plugins page and enable the domain mapping helper plugin.', 'wp-super-cache' ) . '</strong></p></div>';
|
99 |
}
|
78 |
echo '<p>' . __( 'Provides support for <a href="http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/">Domain Mapping</a> plugin to map multiple domains to a blog.', 'wp-super-cache' ) . '</p>';
|
79 |
if ( isset( $changed ) && $changed ) {
|
80 |
if ( $cache_domain_mapping )
|
81 |
+
$status = __( "enabled", 'wp-super-cache' );
|
82 |
else
|
83 |
+
$status = __( "disabled", 'wp-super-cache' );
|
84 |
echo "<p><strong>" . sprintf( __( "Domain Mapping support is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
|
85 |
}
|
86 |
echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
|
93 |
add_cacheaction( 'cache_admin_page', 'wp_supercache_domain_mapping_admin' );
|
94 |
|
95 |
function wp_supercache_domain_mapping_notice() {
|
96 |
+
global $cache_enabled;
|
97 |
if( $cache_enabled )
|
98 |
echo '<div class="error"><p><strong>' . __('Domain Mapping plugin detected! Please go to the Supercache plugins page and enable the domain mapping helper plugin.', 'wp-super-cache' ) . '</strong></p></div>';
|
99 |
}
|
plugins/jetpack.php
CHANGED
@@ -25,7 +25,7 @@ function wp_super_cache_jetpack_admin() {
|
|
25 |
<h4><?php _e( 'Jetpack Mobile Theme', 'wp-super-cache' ); ?></h4>
|
26 |
<?php
|
27 |
if ( false == file_exists( dirname( WPCACHEHOME ) . '/jetpack/class.jetpack-user-agent.php' ) ) {
|
28 |
-
echo "<strong>" . sprintf( __( "Jetpack not found in %s. Install it and enable the mobile theme and this helper plugin to cache visits by mobile visitors." ), dirname( WPCACHEHOME ) ) . "</strong>";
|
29 |
} else { ?>
|
30 |
<form name="wp_manager" action="" method="post">
|
31 |
<label><input type="radio" name="cache_jetpack" value="1" <?php if( $cache_jetpack ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Enabled', 'wp-super-cache' ); ?></label>
|
@@ -34,9 +34,9 @@ function wp_super_cache_jetpack_admin() {
|
|
34 |
echo '<p>' . __( 'Provides support for the <a href="http://wordpress.org/extend/plugins/jetpack/">Jetpack</a> mobile theme and plugin. PHP caching mode and mobile support will be enabled too.', 'wp-super-cache' ) . '</p>';
|
35 |
if ( isset( $changed ) && $changed ) {
|
36 |
if ( $cache_jetpack )
|
37 |
-
$status = __( "enabled" );
|
38 |
else
|
39 |
-
$status = __( "disabled" );
|
40 |
echo "<p><strong>" . sprintf( __( "Jetpack Mobile Theme support is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
|
41 |
}
|
42 |
echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
|
25 |
<h4><?php _e( 'Jetpack Mobile Theme', 'wp-super-cache' ); ?></h4>
|
26 |
<?php
|
27 |
if ( false == file_exists( dirname( WPCACHEHOME ) . '/jetpack/class.jetpack-user-agent.php' ) ) {
|
28 |
+
echo "<strong>" . sprintf( __( "Jetpack not found in %s. Install it and enable the mobile theme and this helper plugin to cache visits by mobile visitors.", 'wp-super-cache' ), dirname( WPCACHEHOME ) ) . "</strong>";
|
29 |
} else { ?>
|
30 |
<form name="wp_manager" action="" method="post">
|
31 |
<label><input type="radio" name="cache_jetpack" value="1" <?php if( $cache_jetpack ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Enabled', 'wp-super-cache' ); ?></label>
|
34 |
echo '<p>' . __( 'Provides support for the <a href="http://wordpress.org/extend/plugins/jetpack/">Jetpack</a> mobile theme and plugin. PHP caching mode and mobile support will be enabled too.', 'wp-super-cache' ) . '</p>';
|
35 |
if ( isset( $changed ) && $changed ) {
|
36 |
if ( $cache_jetpack )
|
37 |
+
$status = __( "enabled", 'wp-super-cache' );
|
38 |
else
|
39 |
+
$status = __( "disabled", 'wp-super-cache' );
|
40 |
echo "<p><strong>" . sprintf( __( "Jetpack Mobile Theme support is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
|
41 |
}
|
42 |
echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
|
plugins/searchengine.php
CHANGED
@@ -41,7 +41,6 @@ function searchenginesupercache( $user_info ) {
|
|
41 |
} else {
|
42 |
return false;
|
43 |
}
|
44 |
-
return $user_info;
|
45 |
}
|
46 |
|
47 |
function searchengine_phase2_actions() {
|
@@ -72,9 +71,9 @@ function wp_supercache_searchengine_admin() {
|
|
72 |
echo '<p>' . __( 'Provides support for <a href="http://ocaoimh.ie/no-adverts-for-friends/">No Adverts for Friends</a>.', 'wp-super-cache' ) . '</p>';
|
73 |
if ( isset( $changed ) && $changed ) {
|
74 |
if ( 'yes' == $cache_no_adverts_for_friends )
|
75 |
-
$status = __( "enabled" );
|
76 |
else
|
77 |
-
$status = __( "disabled" );
|
78 |
echo "<p><strong>" . sprintf( __( "No Adverts for Friends support is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
|
79 |
}
|
80 |
echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
|
41 |
} else {
|
42 |
return false;
|
43 |
}
|
|
|
44 |
}
|
45 |
|
46 |
function searchengine_phase2_actions() {
|
71 |
echo '<p>' . __( 'Provides support for <a href="http://ocaoimh.ie/no-adverts-for-friends/">No Adverts for Friends</a>.', 'wp-super-cache' ) . '</p>';
|
72 |
if ( isset( $changed ) && $changed ) {
|
73 |
if ( 'yes' == $cache_no_adverts_for_friends )
|
74 |
+
$status = __( "enabled", 'wp-super-cache' );
|
75 |
else
|
76 |
+
$status = __( "disabled", 'wp-super-cache' );
|
77 |
echo "<p><strong>" . sprintf( __( "No Adverts for Friends support is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
|
78 |
}
|
79 |
echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
|
plugins/wptouch.php
CHANGED
@@ -25,9 +25,9 @@ function wp_super_cache_wptouch_admin() {
|
|
25 |
echo '<p>' . __( 'Provides support for <a href="http://wordpress.org/extend/plugins/wptouch/">WPTouch</a> mobile theme and plugin.', 'wp-super-cache' ) . '</p>';
|
26 |
if ( isset( $changed ) && $changed ) {
|
27 |
if ( $cache_wptouch )
|
28 |
-
$status = __( "enabled" );
|
29 |
else
|
30 |
-
$status = __( "disabled" );
|
31 |
echo "<p><strong>" . sprintf( __( "WPTouch support is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
|
32 |
}
|
33 |
echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
|
@@ -40,7 +40,7 @@ function wp_super_cache_wptouch_admin() {
|
|
40 |
add_cacheaction( 'cache_admin_page', 'wp_super_cache_wptouch_admin' );
|
41 |
|
42 |
function wp_super_cache_wptouch_notice() {
|
43 |
-
global $cache_enabled
|
44 |
if( $cache_enabled )
|
45 |
echo '<div class="error"><p><strong>' . __('WPTouch plugin detected! Please go to the Supercache plugins page and enable the WPTouch helper plugin.', 'wp-super-cache' ) . '</strong></p></div>';
|
46 |
}
|
@@ -80,7 +80,7 @@ function wp_super_cache_maybe_disable_wptouch( $t ) {
|
|
80 |
add_cacheaction( 'disable_mobile_check', 'wp_super_cache_maybe_disable_wptouch' );
|
81 |
|
82 |
function wp_super_cache_wptouch_browsers( $browsers ) {
|
83 |
-
global $
|
84 |
|
85 |
if ( false == function_exists( 'bnc_wptouch_get_exclude_user_agents' ) || false == function_exists( 'bnc_wptouch_get_user_agents' ) )
|
86 |
return $browsers;
|
25 |
echo '<p>' . __( 'Provides support for <a href="http://wordpress.org/extend/plugins/wptouch/">WPTouch</a> mobile theme and plugin.', 'wp-super-cache' ) . '</p>';
|
26 |
if ( isset( $changed ) && $changed ) {
|
27 |
if ( $cache_wptouch )
|
28 |
+
$status = __( "enabled", 'wp-super-cache' );
|
29 |
else
|
30 |
+
$status = __( "disabled", 'wp-super-cache' );
|
31 |
echo "<p><strong>" . sprintf( __( "WPTouch support is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
|
32 |
}
|
33 |
echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
|
40 |
add_cacheaction( 'cache_admin_page', 'wp_super_cache_wptouch_admin' );
|
41 |
|
42 |
function wp_super_cache_wptouch_notice() {
|
43 |
+
global $cache_enabled;
|
44 |
if( $cache_enabled )
|
45 |
echo '<div class="error"><p><strong>' . __('WPTouch plugin detected! Please go to the Supercache plugins page and enable the WPTouch helper plugin.', 'wp-super-cache' ) . '</strong></p></div>';
|
46 |
}
|
80 |
add_cacheaction( 'disable_mobile_check', 'wp_super_cache_maybe_disable_wptouch' );
|
81 |
|
82 |
function wp_super_cache_wptouch_browsers( $browsers ) {
|
83 |
+
global $wptouch_exclude_ua, $wp_cache_config_file;
|
84 |
|
85 |
if ( false == function_exists( 'bnc_wptouch_get_exclude_user_agents' ) || false == function_exists( 'bnc_wptouch_get_user_agents' ) )
|
86 |
return $browsers;
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: donncha, automattic, kraftbj
|
3 |
Tags: performance,caching,wp-cache,wp-super-cache,cache
|
4 |
Tested up to: 4.8
|
5 |
-
Stable tag: 1.
|
6 |
Requires at least: 3.0
|
7 |
|
8 |
A very fast caching engine for WordPress that produces static html files.
|
@@ -10,59 +10,62 @@ A very fast caching engine for WordPress that produces static html files.
|
|
10 |
== Description ==
|
11 |
This plugin generates static html files from your dynamic WordPress blog. After a html file is generated your webserver will serve that file instead of processing the comparatively heavier and more expensive WordPress PHP scripts.
|
12 |
|
13 |
-
The static html files will be served to the vast majority of your users
|
14 |
|
15 |
1. Users who are not logged in.
|
16 |
2. Users who have not left a comment on your blog.
|
17 |
3. Or users who have not viewed a password protected post.
|
18 |
|
19 |
-
99% of your visitors will be served static html files.
|
20 |
-
|
21 |
-
If for some reason "supercaching" doesn't work on your server then don't worry. Caching will still be performed, but every request will require loading the PHP engine. In normal circumstances this isn't bad at all. Visitors to your site will notice no slowdown or difference. Supercache really comes into it's own if your server is underpowered, or you're experiencing heavy traffic.
|
22 |
-
Super Cached html files will be served more quickly than PHP generated cached files but in every day use, the difference isn't noticeable.
|
23 |
|
24 |
The plugin serves cached files in 3 ways (ranked by speed):
|
25 |
|
26 |
-
1.
|
27 |
-
2.
|
28 |
-
3.
|
29 |
|
30 |
-
If you're
|
31 |
|
32 |
= Recommended Settings =
|
33 |
-
Advanced users will probably want to use mod_rewrite caching, but PHP caching is almost as good and recommended for everyone else. Enable the following:
|
34 |
|
35 |
-
1.
|
36 |
2. Compress pages.
|
37 |
3. Don't cache pages for known users.
|
38 |
4. Cache rebuild.
|
39 |
5. CDN support.
|
40 |
6. Extra homepage checks.
|
41 |
|
42 |
-
Garbage collection is the act of cleaning up cache files that are out of date and stale. There's no correct value for the expiry time but a good starting point is 1800 seconds
|
43 |
|
44 |
-
|
45 |
|
46 |
Likewise, preload as many posts as you can and enable "Preload Mode". Garbage collection will still occur but it won't affect the preloaded files. If you don't care about sidebar widgets updating often set the preload interval to 2880 minutes (2 days) so all your posts aren't recached very often. When the preload occurs the cache files for the post being refreshed is deleted and then regenerated. Afterwards a garbage collection of all old files is performed to clean out stale cache files.
|
47 |
-
|
48 |
|
49 |
-
See the [WP Super Cache homepage](https://wordpress.org/plugins/wp-super-cache/) for further information. [Developer documentation](
|
50 |
|
51 |
There's a [GIT repository](https://github.com/Automattic/wp-super-cache) too if you want to contribute a patch.
|
52 |
|
53 |
The [changelog](http://svn.wp-plugins.org/wp-super-cache/trunk/Changelog.txt) is a good place to start if you want to know what has changed since you last downloaded the plugin.
|
54 |
|
55 |
-
Interested in translating WP Super Cache to your language?
|
56 |
|
57 |
The cache directory, usually wp-content/cache/ is only for temporary files. Do not ever put important files or symlinks to important files or directories in that directory. They will be deleted if the plugin has write access to them.
|
58 |
|
59 |
== Upgrade Notice ==
|
60 |
|
61 |
-
= 1.
|
62 |
-
|
63 |
|
64 |
== Changelog ==
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
= 1.4.9 =
|
67 |
* Fixed bug when not running sem_remove after sem_release. See https://github.com/Automattic/wp-super-cache/issues/85
|
68 |
* Fixed a PHP error impacting PHP 7.1.
|
@@ -363,13 +366,16 @@ To manually uninstall:
|
|
363 |
Go to Settings->WP Super Cache and look for the "Cache Tester" form on the easy settings page. Click "Test Cache" and the plugin will request the front page of the site twice, comparing a timestamp on each to make sure they match.
|
364 |
|
365 |
If you want to do it manually, enable debugging in the plugin settings page and load the log file in a new browser tab. Then view your blog while logged in and logged out. You should see activity in the log. View the source of any page on your site. When a page is first created, you'll see the text "Dynamic page generated in XXXX seconds." and "Cached page generated by WP-Super-Cache on YYYY-MM-DD HH:MM:SS" at the end of the source code. On reload, a cached page will show the same timestamp so wait a few seconds before checking.
|
366 |
-
|
367 |
If the plugin rules are missing from your .htaccess file, the plugin will attempt to serve the super cached page if it's found. The header "WP-Super-Cache: Served supercache file from PHP" if this happens.
|
368 |
|
369 |
-
=
|
370 |
|
371 |
-
|
372 |
-
|
|
|
|
|
|
|
373 |
|
374 |
= Will comments and other dynamic parts of my blog update immediately? =
|
375 |
|
@@ -383,11 +389,11 @@ No, it will do the opposite. Super Cache files are compressed and stored that wa
|
|
383 |
|
384 |
Note: this functionality is disabled by default. You will have to enable it on the Advanced Settings page.
|
385 |
|
386 |
-
There are 2 ways of doing this. You can use Javascript to draw the part of the page you want to keep dynamic. That's what Google Adsense and many widgets from external sites do and is the recommended way. Or you can use a WP Super Cache filter to do the job but you can't use mod_rewrite mode caching. You have to
|
387 |
|
388 |
WP Super Cache 1.4 introduced a cacheaction filter called wpsc_cachedata. The cached page to be displayed goes through this filter and allows modification of the page. If the page contains a placeholder tag the filter can be used to replace that tag with your dynamically generated html.
|
389 |
The function that hooks on to the wpsc_cachedata filter should be put in a file in the WP Super Cache plugins folder unless you use the late_init feature. An example plugin is included. Edit [dynamic-cache-test.php](http://svn.wp-plugins.org/wp-super-cache/trunk/plugins/dynamic-cache-test.php) to see the example code.
|
390 |
-
There are two example functions there. There's a simple function that replaces a string (or tag) you define when the cached page is served. The other example function uses an output buffer to generate the dynamic content. Due to a limitation in how PHP works the output buffer code MUST run before the wpsc_cachedata filter is hit, at least for when a page is cached. It doesn't matter when serving cached pages. See [this post](
|
391 |
To execute WordPress functions you must enable the 'Late init' feature on the advanced settings page.
|
392 |
|
393 |
= How do I use WordPress functions in cached dynamic pages? =
|
@@ -399,17 +405,17 @@ Cached files are served before almost all of WordPress is loaded. While that's g
|
|
399 |
|
400 |
This plugin caches entire pages but some plugins think they can run PHP code every time a page loads. To fix this, the plugin needs to use Javascript/AJAX methods or the wpsc_cachedata filter described in the previous answer to update or display dynamic information.
|
401 |
|
402 |
-
= Why do my WP Super Cache
|
403 |
|
404 |
WordPress deletes the plugin folder when it updates a plugin. This is the same with WP Super Cache so any modified files in wp-super-cache/plugins/ will be deleted. You can define the variable $wp_cache_plugins_dir in wp-config.php or wp-content/wp-cache-config.php and point it at a directory outside of the wp-super-cache folder. The plugin will look there for it's plugins.
|
405 |
|
406 |
= What does the Cache Rebuild feature do? =
|
407 |
|
408 |
-
When a visitor leaves a comment the cached file for that page is deleted and the next visitor recreates the cached page. A page takes time to load so what happens if it receives 100 visitors during this time? There won't be a cached page so WordPress will serve a fresh page for each user and the plugin will try to create a cached page for each of those 100 visitors causing a huge load on your server. This feature stops this happening. The cached page is not cleared when a comment is left. It is marked for rebuilding instead. The next visitor within the next 10 seconds will regenerate the cached page while the old page is served to the other 99 visitors. The page is eventually loaded by the first visitor and the cached page updated. See [this post](
|
409 |
|
410 |
= Why doesn't the plugin cache requests by search engine bots by default? =
|
411 |
|
412 |
-
Those bots usually only visit each page once and if the page is not popular there's no point creating a cache file that will sit idle on your server. However
|
413 |
|
414 |
= A category page is showing instead of my homepage =
|
415 |
|
@@ -418,19 +424,19 @@ A tiny proportion of websites will have problems with the following configuratio
|
|
418 |
1. Uses a static page for the front page.
|
419 |
2. Uses /%category%/%postname%/ permalink structure.
|
420 |
|
421 |
-
Sometimes a category page is cached as the homepage of the site instead of the static page. I can't [replicate the problem](http://wordpress.org/support/topic/237415/page/2?replies=38) but a simple solution is to
|
422 |
|
423 |
= Why do I get warnings about caching from http://ismyblogworking.com/ =
|
424 |
|
425 |
"Your blog doesn't support client caching (no 304 response to If-modified-since)."
|
426 |
"Your feed doesn't support caching (no 304 response to If-modified-since)"
|
427 |
|
428 |
-
Supercache doesn't support 304 header checks in
|
429 |
Try the Cacheability Engine at http://www.ircache.net/cgi-bin/cacheability.py or http://redbot.org/ for further analysis.
|
430 |
|
431 |
= How should I best use the utm_source tracking tools in Google Analytics with this plugin? =
|
432 |
|
433 |
-
That tracking adds a query string to each url linked from various sources like Twitter and feedreaders. Unfortunately it stops pages being supercached. See [Joost's comment here](
|
434 |
|
435 |
= The plugin complains that wp-content is writable! htdocs is writable! =
|
436 |
|
@@ -459,7 +465,7 @@ The only real limit are limits defined by your server. For example, EXT2 and EXT
|
|
459 |
|
460 |
= How do I serve cached mobile pages to clients on small screens like phones and tablets? =
|
461 |
|
462 |
-
|
463 |
|
464 |
* [Jetpack's Mobile Theme Module](http://wordpress.org/plugins/jetpack)
|
465 |
* [WPTouch](http://wordpress.org/plugins/wptouch/)
|
@@ -492,7 +498,7 @@ If things don't work when you installed the plugin here are a few things to chec
|
|
492 |
`127.0.0.1 myhostname.com`
|
493 |
17. If old pages are being served to your visitors via the supercache, you may be missing Apache modules (or their equivalents if you don't use Apache). 3 modules are required: mod_mime, mod_headers and mod_expires. The last two are especially important for making sure browsers load new versions of existing pages on your site.
|
494 |
18. The error message, "WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed!" appears at the end of every page. Open the file wp-content/advanced-cache.php in your favourite editor. Is the path to wp-cache-phase1.php correct? This file will normally be in wp-content/plugins/wp-super-cache/. If it is not correct the caching engine will not load.
|
495 |
-
19. Caching doesn't work. The timestamp on my blog keeps changing when I reload. Check that the path in your .htaccess rules matches where the supercache directory is. You may have to hardcode it.
|
496 |
20. If supercache cache files are generated but not served, check the permissions on all your wp-content/cache/supercache folders (and each of wp-content cache and supercache folders) and wp-content/cache/.htaccess. If your PHP runs as a different user to Apache and permissions are strict Apache may not be able to read the PHP generated cache files. To fix you must add the following line to your wp-config.php (Add it above the WP_CACHE define.) Then clear your cache.
|
497 |
|
498 |
`umask( 0022 );`
|
@@ -513,6 +519,20 @@ If that doesn't work, add this line to your wp-config.php:
|
|
513 |
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.
|
514 |
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.
|
515 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
516 |
|
517 |
== CDN ==
|
518 |
|
@@ -522,6 +542,10 @@ A Content Delivery Network (CDN) is usually a network of computers situated arou
|
|
522 |
|
523 |
Configure this on the "CDN" tab of the plugin settings page. This is an advanced technique and requires a basic understanding of how your webserver or CDNs work. Please be sure to clear the file cache after you configure the CDN.
|
524 |
|
|
|
|
|
|
|
|
|
525 |
== Custom Caching ==
|
526 |
It is now possible to hook into the caching process using the add_cacheaction() function.
|
527 |
|
@@ -535,34 +559,7 @@ There is one regular WordPress filter too. Use the "do_createsupercache" filter
|
|
535 |
to customize the checks made before caching. The filter accepts one parameter.
|
536 |
The output of WP-Cache's wp_cache_get_cookies_values() function.
|
537 |
|
538 |
-
See plugins/searchengine.php as an example I use for my [No Adverts for Friends](
|
539 |
-
|
540 |
-
== Links ==
|
541 |
-
[WP Widget Cache](http://wordpress.org/plugins/wp-widget-cache/) is another caching plugin for WordPress. This plugin caches the output of widgets and may significantly speed up dynamic page generation times.
|
542 |
|
543 |
== Updates ==
|
544 |
-
Updates to the plugin will be posted here, to [Holy Shmoly!](
|
545 |
-
|
546 |
-
== Thanks ==
|
547 |
-
I would sincerely like to thank [John Pozadzides](http://onemansblog.com/) for giving me the idea for this, for writing the "How it works" section and for testing the plugin through 2 front page appearances on digg.com
|
548 |
-
|
549 |
-
Thanks to James Farmer and Andrew Billits of [Edu Blogs](http://edublogs.org/) fame who helped me make this more WordPress MU friendly.
|
550 |
-
|
551 |
-
Translators who did a great job converting the text of the plugin to their native language. Thank you!
|
552 |
-
|
553 |
-
* [Gianni Diurno](http://gidibao.net/) (Italian)
|
554 |
-
* [Omi](http://equipajedemano.info/) (Spanish)
|
555 |
-
* [tomchen1989](http://emule-fans.com/) and [Christopher Meng](http://cicku.me) (Simplified Chinese)
|
556 |
-
* Tai (Japanese)
|
557 |
-
* [Vitaly](http://pressword.com.ua/wordpress/) (Ukranian)
|
558 |
-
* [Pseric](http://pseric.com/) and [Priv](http://priv.tw/blog) (Traditional Chinese)
|
559 |
-
* [Ma�tre M�](http://maitremo.fr/) (French)
|
560 |
-
* [Mathias Roth](http://trade-service.eu/) (German)
|
561 |
-
* Bar�� �nver (Turkish)
|
562 |
-
* [Elvis Fweb](http://wp.turkenichev.ru/) (Russian)
|
563 |
-
* Fredrik Fors�ll (Swedish)
|
564 |
-
* [Alyona Lompar](http://wwww.webhostinggeeks.com/) (Ukranian)
|
565 |
-
* [Nata Strazda](http://www.webhostingrating.com/) (Lithuanian)
|
566 |
-
* [Alexander Alexandrov](http://www.designcontest.com/) (Belarusian)
|
567 |
-
* [Michail Bogdanov](http://www.webhostinghub.com/) (Romanian)
|
568 |
-
* [Anja Skrba](http://science.webhostinggeeks.com/wordpress-super-cache) (Serbo-Croatian)
|
2 |
Contributors: donncha, automattic, kraftbj
|
3 |
Tags: performance,caching,wp-cache,wp-super-cache,cache
|
4 |
Tested up to: 4.8
|
5 |
+
Stable tag: 1.5.0
|
6 |
Requires at least: 3.0
|
7 |
|
8 |
A very fast caching engine for WordPress that produces static html files.
|
10 |
== Description ==
|
11 |
This plugin generates static html files from your dynamic WordPress blog. After a html file is generated your webserver will serve that file instead of processing the comparatively heavier and more expensive WordPress PHP scripts.
|
12 |
|
13 |
+
The static html files will be served to the vast majority of your users:
|
14 |
|
15 |
1. Users who are not logged in.
|
16 |
2. Users who have not left a comment on your blog.
|
17 |
3. Or users who have not viewed a password protected post.
|
18 |
|
19 |
+
99% of your visitors will be served static html files. One cached file can be served thousands of times. Other visitors will be served custom cached files tailored to their visit. If they are logged in, or have left comments those details will be displayed and cached for them.
|
|
|
|
|
|
|
20 |
|
21 |
The plugin serves cached files in 3 ways (ranked by speed):
|
22 |
|
23 |
+
1. Expert. The fastest method is by using Apache mod_rewrite (or whatever similar module your web server supports) to serve "supercached" static html files. This completely bypasses PHP and is extremely quick. If your server is hit by a deluge of traffic it is more likely to cope as the requests are "lighter". This does require the Apache mod_rewrite module (which is probably installed if you have custom permalinks) and a modification of your .htaccess file which is risky and may take down your site if modified incorrectly.
|
24 |
+
2. Simple. Supercached static files can be served by PHP and this is the recommended way of using the plugin. The plugin will serve a "supercached" file if it exists and it's almost as fast as the mod_rewrite method. It's easier to configure as the .htaccess file doesn't need to be changed. You still need a custom permalink. You can keep portions of your page dynamic in this caching mode.
|
25 |
+
3. WP-Cache caching. This is mainly used to cache pages for known users, URLs with parameters and feeds. Known users are logged in users, visitors who leave comments or those who should be shown custom per-user data. It's the most flexible caching method and slightly slower. WP-Cache caching will also cache visits by unknown users if supercaching is disabled. You can have dynamic parts to your page in this mode too. This mode is always enabled but you can disable caching for known users, URLs with parameters, or feeds separately. Set the constant "DISABLE_SUPERCACHE" to 1 in your wp-config.php if you want to only use WP-Cache caching.
|
26 |
|
27 |
+
If you're not comfortable with editing PHP files then use simple mode. It's easy to set up and very fast.
|
28 |
|
29 |
= Recommended Settings =
|
|
|
30 |
|
31 |
+
1. Simple caching.
|
32 |
2. Compress pages.
|
33 |
3. Don't cache pages for known users.
|
34 |
4. Cache rebuild.
|
35 |
5. CDN support.
|
36 |
6. Extra homepage checks.
|
37 |
|
38 |
+
Garbage collection is the act of cleaning up cache files that are out of date and stale. There's no correct value for the expiry time but a good starting point is 1800 seconds.
|
39 |
|
40 |
+
Consider deleting the contents of the "Rejected User Agents" text box and allow search engines to cache files for you.
|
41 |
|
42 |
Likewise, preload as many posts as you can and enable "Preload Mode". Garbage collection will still occur but it won't affect the preloaded files. If you don't care about sidebar widgets updating often set the preload interval to 2880 minutes (2 days) so all your posts aren't recached very often. When the preload occurs the cache files for the post being refreshed is deleted and then regenerated. Afterwards a garbage collection of all old files is performed to clean out stale cache files.
|
43 |
+
Cached files will still be deleted when posts are made or edited or comments made when preloading is enabled.
|
44 |
|
45 |
+
See the [WP Super Cache homepage](https://wordpress.org/plugins/wp-super-cache/) for further information. [Developer documentation](https://odd.blog/wp-super-cache-developers/) is also available for those who need to interact with the cache or write plugins.
|
46 |
|
47 |
There's a [GIT repository](https://github.com/Automattic/wp-super-cache) too if you want to contribute a patch.
|
48 |
|
49 |
The [changelog](http://svn.wp-plugins.org/wp-super-cache/trunk/Changelog.txt) is a good place to start if you want to know what has changed since you last downloaded the plugin.
|
50 |
|
51 |
+
Interested in translating WP Super Cache to your language? See the [translation page](https://translate.wordpress.org/projects/wp-plugins/wp-super-cache) for the plugin.
|
52 |
|
53 |
The cache directory, usually wp-content/cache/ is only for temporary files. Do not ever put important files or symlinks to important files or directories in that directory. They will be deleted if the plugin has write access to them.
|
54 |
|
55 |
== Upgrade Notice ==
|
56 |
|
57 |
+
= 1.5.0 =
|
58 |
+
Added REST API settings endpoints, simplified settings, reorganised cache files. Lots of bug fixes.
|
59 |
|
60 |
== Changelog ==
|
61 |
|
62 |
+
= 1.5.0 =
|
63 |
+
* REST API settings endpoints.
|
64 |
+
* Simplified settings page.
|
65 |
+
* WP-Cache files reorganised.
|
66 |
+
* Caching of more http headers.
|
67 |
+
* Lots of bug fixes.
|
68 |
+
|
69 |
= 1.4.9 =
|
70 |
* Fixed bug when not running sem_remove after sem_release. See https://github.com/Automattic/wp-super-cache/issues/85
|
71 |
* Fixed a PHP error impacting PHP 7.1.
|
366 |
Go to Settings->WP Super Cache and look for the "Cache Tester" form on the easy settings page. Click "Test Cache" and the plugin will request the front page of the site twice, comparing a timestamp on each to make sure they match.
|
367 |
|
368 |
If you want to do it manually, enable debugging in the plugin settings page and load the log file in a new browser tab. Then view your blog while logged in and logged out. You should see activity in the log. View the source of any page on your site. When a page is first created, you'll see the text "Dynamic page generated in XXXX seconds." and "Cached page generated by WP-Super-Cache on YYYY-MM-DD HH:MM:SS" at the end of the source code. On reload, a cached page will show the same timestamp so wait a few seconds before checking.
|
369 |
+
If Supercaching is disabled and you have compression enabled, the text "Compression = gzip" will be added. If compression is disabled and the page is served as a static html file, the text "super cache" will be added. The only other way to check if your cached file was served by PHP script or from the static cache is by looking at the HTTP headers. PHP cached pages will have the header "WP-Super-Cache: Served supercache file from PHP". WPCache cached files will have the header, "WP-Super-Cache: Served WPCache cache file". You should also check your cache directory in wp-content/cache/supercache/hostname/ for static cache files.
|
370 |
If the plugin rules are missing from your .htaccess file, the plugin will attempt to serve the super cached page if it's found. The header "WP-Super-Cache: Served supercache file from PHP" if this happens.
|
371 |
|
372 |
+
= How do I disable Supercaching? =
|
373 |
|
374 |
+
If you only want to use the WP-Cache engine then edit your wp-config.php or create an mu-plugin that sets the constant 'DISABLE_SUPERCACHE' to 1.
|
375 |
+
|
376 |
+
= WP-Cache vs Supercache files =
|
377 |
+
|
378 |
+
All cache files are stored in wp-content/cache/supercache/HOSTNAME/ where HOSTNANE is your domain name. The files are stored in directories matching your site's permalink structure. Supercache files are index.html or some variant of that, depending on what type of visitor hit the blog. Other files are named wp-cache-XXXXXXXXXXXXXXXXX.php. Associated meta filesnames start with "meta". Those files contain information about the cached file. These files are generated by the "WPCache caching" engine in the plugin.
|
379 |
|
380 |
= Will comments and other dynamic parts of my blog update immediately? =
|
381 |
|
389 |
|
390 |
Note: this functionality is disabled by default. You will have to enable it on the Advanced Settings page.
|
391 |
|
392 |
+
There are 2 ways of doing this. You can use Javascript to draw the part of the page you want to keep dynamic. That's what Google Adsense and many widgets from external sites do and is the recommended way. Or you can use a WP Super Cache filter to do the job but you can't use mod_rewrite mode caching. You have to use the "simple" delivery method or disable supercaching.
|
393 |
|
394 |
WP Super Cache 1.4 introduced a cacheaction filter called wpsc_cachedata. The cached page to be displayed goes through this filter and allows modification of the page. If the page contains a placeholder tag the filter can be used to replace that tag with your dynamically generated html.
|
395 |
The function that hooks on to the wpsc_cachedata filter should be put in a file in the WP Super Cache plugins folder unless you use the late_init feature. An example plugin is included. Edit [dynamic-cache-test.php](http://svn.wp-plugins.org/wp-super-cache/trunk/plugins/dynamic-cache-test.php) to see the example code.
|
396 |
+
There are two example functions there. There's a simple function that replaces a string (or tag) you define when the cached page is served. The other example function uses an output buffer to generate the dynamic content. Due to a limitation in how PHP works the output buffer code MUST run before the wpsc_cachedata filter is hit, at least for when a page is cached. It doesn't matter when serving cached pages. See [this post](https://odd.blog/y/6j) for a more technical and longer explanation.
|
397 |
To execute WordPress functions you must enable the 'Late init' feature on the advanced settings page.
|
398 |
|
399 |
= How do I use WordPress functions in cached dynamic pages? =
|
405 |
|
406 |
This plugin caches entire pages but some plugins think they can run PHP code every time a page loads. To fix this, the plugin needs to use Javascript/AJAX methods or the wpsc_cachedata filter described in the previous answer to update or display dynamic information.
|
407 |
|
408 |
+
= Why do my WP Super Cache plugins disappear when I upgrade the plugin? =
|
409 |
|
410 |
WordPress deletes the plugin folder when it updates a plugin. This is the same with WP Super Cache so any modified files in wp-super-cache/plugins/ will be deleted. You can define the variable $wp_cache_plugins_dir in wp-config.php or wp-content/wp-cache-config.php and point it at a directory outside of the wp-super-cache folder. The plugin will look there for it's plugins.
|
411 |
|
412 |
= What does the Cache Rebuild feature do? =
|
413 |
|
414 |
+
When a visitor leaves a comment the cached file for that page is deleted and the next visitor recreates the cached page. A page takes time to load so what happens if it receives 100 visitors during this time? There won't be a cached page so WordPress will serve a fresh page for each user and the plugin will try to create a cached page for each of those 100 visitors causing a huge load on your server. This feature stops this happening. The cached page is not cleared when a comment is left. It is marked for rebuilding instead. The next visitor within the next 10 seconds will regenerate the cached page while the old page is served to the other 99 visitors. The page is eventually loaded by the first visitor and the cached page updated. See [this post](https://odd.blog/2009/01/23/wp-super-cache-089/) for more.
|
415 |
|
416 |
= Why doesn't the plugin cache requests by search engine bots by default? =
|
417 |
|
418 |
+
Those bots usually only visit each page once and if the page is not popular there's no point creating a cache file that will sit idle on your server. However you can allow these visits to be cached by removing the list of bots from "Rejected User Agents" on the Advanced settings page.
|
419 |
|
420 |
= A category page is showing instead of my homepage =
|
421 |
|
424 |
1. Uses a static page for the front page.
|
425 |
2. Uses /%category%/%postname%/ permalink structure.
|
426 |
|
427 |
+
Sometimes a category page is cached as the homepage of the site instead of the static page. I can't [replicate the problem](http://wordpress.org/support/topic/237415/page/2?replies=38) but a simple solution is to use the "Simple" mode. You can also enable "Extra homepage checks" on the Advanced Settings page.
|
428 |
|
429 |
= Why do I get warnings about caching from http://ismyblogworking.com/ =
|
430 |
|
431 |
"Your blog doesn't support client caching (no 304 response to If-modified-since)."
|
432 |
"Your feed doesn't support caching (no 304 response to If-modified-since)"
|
433 |
|
434 |
+
Supercache doesn't support 304 header checks in Expert mode but does support it in Simple mode. This is caching done by your browser, not the server. It is a check your browser does to ask the server if an updated version of the current page is available. If not, it doesn't download the old version again. The page is still cached by your server, just not by your visitors' browsers.
|
435 |
Try the Cacheability Engine at http://www.ircache.net/cgi-bin/cacheability.py or http://redbot.org/ for further analysis.
|
436 |
|
437 |
= How should I best use the utm_source tracking tools in Google Analytics with this plugin? =
|
438 |
|
439 |
+
That tracking adds a query string to each url linked from various sources like Twitter and feedreaders. Unfortunately it stops pages being supercached. See [Joost's comment here](https://odd.blog/remove-unused-utmsource-urls/#comment-672813) for how to turn it into an anchor tag which can be supercached.
|
440 |
|
441 |
= The plugin complains that wp-content is writable! htdocs is writable! =
|
442 |
|
465 |
|
466 |
= How do I serve cached mobile pages to clients on small screens like phones and tablets? =
|
467 |
|
468 |
+
Your theme is probably responsive which means it resizes the page to suit whatever device is displaying the page. If it's not responsive, you'll have to use a separate mobile plugin to render a page formatted for those visitors. The following plugins have been tested but YMMV depending on mobile client. You'll have to enable mobile browser support as well on the Advanced settings page.
|
469 |
|
470 |
* [Jetpack's Mobile Theme Module](http://wordpress.org/plugins/jetpack)
|
471 |
* [WPTouch](http://wordpress.org/plugins/wptouch/)
|
498 |
`127.0.0.1 myhostname.com`
|
499 |
17. If old pages are being served to your visitors via the supercache, you may be missing Apache modules (or their equivalents if you don't use Apache). 3 modules are required: mod_mime, mod_headers and mod_expires. The last two are especially important for making sure browsers load new versions of existing pages on your site.
|
500 |
18. The error message, "WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed!" appears at the end of every page. Open the file wp-content/advanced-cache.php in your favourite editor. Is the path to wp-cache-phase1.php correct? This file will normally be in wp-content/plugins/wp-super-cache/. If it is not correct the caching engine will not load.
|
501 |
+
19. Caching doesn't work. The timestamp on my blog keeps changing when I reload. Check that the path in your .htaccess rules matches where the supercache directory is. You may have to hardcode it. Try disabling supercache mode.
|
502 |
20. If supercache cache files are generated but not served, check the permissions on all your wp-content/cache/supercache folders (and each of wp-content cache and supercache folders) and wp-content/cache/.htaccess. If your PHP runs as a different user to Apache and permissions are strict Apache may not be able to read the PHP generated cache files. To fix you must add the following line to your wp-config.php (Add it above the WP_CACHE define.) Then clear your cache.
|
503 |
|
504 |
`umask( 0022 );`
|
519 |
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.
|
520 |
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.
|
521 |
|
522 |
+
== Preloading ==
|
523 |
+
|
524 |
+
You can generate cached files for the posts, categories and tags of your site by preloading. Preloading will visit each page of your site generating a cached page as it goes along, just like any other visitor to the site. Due to the sequential nature of this function, it can take some time to preload a complete site if there are many posts.
|
525 |
+
To make preloading more effective it can be useful to disable garbage collection so that older cache files are not deleted. This is done by enabling "Preload Mode" in the settings. Be aware however, that pages will go out of date eventually but that updates by submitting comments or editing posts will clear portions of the cache.
|
526 |
+
|
527 |
+
== Garbage Collection ==
|
528 |
+
|
529 |
+
Your cache directory fills up over time, which takes up space on your server. If space is limited or billed by capacity, or if you worry that the cached pages of your site will go stale then garbage collection has to be done. Garbage collection happens on a regular basis and deletes old files in the cache directory. On the advanced settings page you can specify:
|
530 |
+
1. Cache timeout. How long cache files are considered fresh for. After this time they are stale and can be deleted.
|
531 |
+
2. Scheduler. Setup how often garbage collection should be done.
|
532 |
+
3. Notification emails. You can be informed on garbage collection job progress.
|
533 |
+
There's no right or wrong settings for garbage collection. It depends on your own site.
|
534 |
+
If your site gets regular updates, or comments then set the timeout to 1800 seconds, and set the timer to 600 seconds.
|
535 |
+
If your site is mostly static you can disable garbage collection by entering 0 as the timeout, or use a really large timeout value.
|
536 |
|
537 |
== CDN ==
|
538 |
|
542 |
|
543 |
Configure this on the "CDN" tab of the plugin settings page. This is an advanced technique and requires a basic understanding of how your webserver or CDNs work. Please be sure to clear the file cache after you configure the CDN.
|
544 |
|
545 |
+
== REST API ==
|
546 |
+
|
547 |
+
There are now REST API endpoints for accessing the settings of this plugin. You'll need to be authenticated as an admin user with permission to view the settings page to use it. This has not been documented yet but you can find all the code that deals with this in the "rest" directory.
|
548 |
+
|
549 |
== Custom Caching ==
|
550 |
It is now possible to hook into the caching process using the add_cacheaction() function.
|
551 |
|
559 |
to customize the checks made before caching. The filter accepts one parameter.
|
560 |
The output of WP-Cache's wp_cache_get_cookies_values() function.
|
561 |
|
562 |
+
See plugins/searchengine.php as an example I use for my [No Adverts for Friends](https://odd.blog/no-adverts-for-friends/) plugin.
|
|
|
|
|
|
|
563 |
|
564 |
== Updates ==
|
565 |
+
Updates to the plugin will be posted here, to [Holy Shmoly!](https://odd.blog/) and the [WP Super Cache homepage](https://wordpress.org/plugins/wp-super-cache/) will always link to the newest version.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rest/class.wp-super-cache-rest-delete-cache.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WP_Super_Cache_Rest_Delete_Cache extends WP_REST_Controller {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Get a collection of items
|
7 |
+
*
|
8 |
+
* @param WP_REST_Request $request Full data about the request.
|
9 |
+
* @return WP_Error|WP_REST_Response
|
10 |
+
*/
|
11 |
+
public function callback( $request ) {
|
12 |
+
$params = $request->get_json_params();
|
13 |
+
|
14 |
+
if ( isset( $params['id'] ) && is_numeric( $params['id'] ) ) {
|
15 |
+
wpsc_delete_post_cache( $params['id'] );
|
16 |
+
|
17 |
+
} elseif ( !empty( $params['expired'] ) ) {
|
18 |
+
global $file_prefix;
|
19 |
+
wp_cache_clean_expired( $file_prefix );
|
20 |
+
|
21 |
+
} elseif ( isset( $params['url'] ) ) {
|
22 |
+
global $cache_path;
|
23 |
+
|
24 |
+
$directory = $cache_path . 'supercache/' . $params[ 'url' ];
|
25 |
+
wpsc_delete_files( $directory );
|
26 |
+
prune_super_cache( $directory . '/page', true );
|
27 |
+
|
28 |
+
} else {
|
29 |
+
global $file_prefix;
|
30 |
+
wp_cache_clean_cache( $file_prefix, !empty( $params['all'] ) );
|
31 |
+
}
|
32 |
+
|
33 |
+
return rest_ensure_response( array( 'Cache Cleared' => true ) );
|
34 |
+
}
|
35 |
+
}
|
rest/class.wp-super-cache-rest-get-cache.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WP_Super_Cache_Rest_Get_Cache extends WP_REST_Controller {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Get a collection of items
|
7 |
+
*
|
8 |
+
* @param WP_REST_Request $request Full data about the request.
|
9 |
+
* @return WP_Error|WP_REST_Response
|
10 |
+
*/
|
11 |
+
public function callback( $request ) {
|
12 |
+
global $valid_nonce;
|
13 |
+
|
14 |
+
$valid_nonce = true;
|
15 |
+
$_GET[ 'listfiles' ] = 1;
|
16 |
+
$sizes = wpsc_generate_sizes_array();
|
17 |
+
$supercachedir = get_supercache_dir();
|
18 |
+
$list = wpsc_dirsize( $supercachedir, $sizes );
|
19 |
+
$return_list = array();
|
20 |
+
|
21 |
+
foreach( $list as $type => $file_list ) {
|
22 |
+
foreach ( $file_list as $state => $value ) {
|
23 |
+
if ( is_array( $value ) ) {
|
24 |
+
foreach( $value as $filenames ) {
|
25 |
+
foreach( $filenames as $filename => $t ) {
|
26 |
+
if ( $type == 'wpcache' ) {
|
27 |
+
$filename = dirname( $filename );
|
28 |
+
}
|
29 |
+
if ( false == isset( $return_list[ $type ][ $state ] ) || false == in_array( $filename, $return_list[ $type ][ $state ] ) )
|
30 |
+
$return_list[ $type ][ $state ][] = $filename;
|
31 |
+
}
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
if ( isset ( $return_list[ $type ] ) ) {
|
37 |
+
$list[ $type ] = $return_list[ $type ];
|
38 |
+
}
|
39 |
+
|
40 |
+
unset( $return_list[ $type ] );
|
41 |
+
}
|
42 |
+
|
43 |
+
return rest_ensure_response( $list );
|
44 |
+
}
|
45 |
+
}
|
rest/class.wp-super-cache-rest-get-settings.php
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once __DIR__ . '/class.wp-super-cache-settings-map.php';
|
4 |
+
|
5 |
+
class WP_Super_Cache_Rest_Get_Settings extends WP_REST_Controller {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Get the settings.
|
9 |
+
*
|
10 |
+
* @param WP_REST_Request $request Full data about the request.
|
11 |
+
* @return WP_Error|WP_REST_Response
|
12 |
+
*/
|
13 |
+
public function callback( $request ) {
|
14 |
+
$settings = array();
|
15 |
+
|
16 |
+
global $wp_cache_config_file;
|
17 |
+
|
18 |
+
if ( defined( 'WPLOCKDOWN' ) ) {
|
19 |
+
$config_file = file_get_contents( $wp_cache_config_file );
|
20 |
+
if ( false === strpos( $config_file, "defined( 'WPLOCKDOWN' )" ) ) {
|
21 |
+
wp_cache_replace_line( '^.*WPLOCKDOWN', "if ( ! defined( 'WPLOCKDOWN' ) ) define( 'WPLOCKDOWN', " . $this->get_is_lock_down_enabled() . " );", $wp_cache_config_file );
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( function_exists( "opcache_invalidate" ) ) {
|
26 |
+
opcache_invalidate( $wp_cache_config_file );
|
27 |
+
}
|
28 |
+
include( $wp_cache_config_file );
|
29 |
+
|
30 |
+
foreach ( WP_Super_Cache_Settings_Map::$map as $name => $map ) {
|
31 |
+
if ( isset ( $map['get'] ) ) {
|
32 |
+
$get_method = $map['get'];
|
33 |
+
|
34 |
+
if ( method_exists( $this, $get_method ) ) {
|
35 |
+
$settings[ $name ] = $this->$get_method();
|
36 |
+
|
37 |
+
} elseif ( function_exists( $get_method ) ) {
|
38 |
+
$settings[ $name ] = $get_method();
|
39 |
+
}
|
40 |
+
|
41 |
+
} else if ( isset ( $map['option'] ) ) {
|
42 |
+
$settings[ $name ] = get_option( $map['option'] );
|
43 |
+
|
44 |
+
} elseif ( isset( $map['global'] ) ) {
|
45 |
+
$global_var = $map['global'];
|
46 |
+
$settings[ $name ] = $$global_var;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
return $this->prepare_item_for_response( $settings, $request );
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @return string
|
55 |
+
*/
|
56 |
+
public function get_cache_path_url() {
|
57 |
+
global $cache_path;
|
58 |
+
|
59 |
+
return site_url( str_replace( ABSPATH, '', "{$cache_path}" ) );
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @return string
|
64 |
+
*/
|
65 |
+
public function get_cache_type() {
|
66 |
+
global $wp_cache_config_file;
|
67 |
+
if ( function_exists( "opcache_invalidate" ) ) {
|
68 |
+
opcache_invalidate( $wp_cache_config_file );
|
69 |
+
}
|
70 |
+
include( $wp_cache_config_file );
|
71 |
+
|
72 |
+
if ( $super_cache_enabled ) {
|
73 |
+
if ( $wp_cache_mod_rewrite == 1 ) {
|
74 |
+
return 'mod_rewrite';
|
75 |
+
} else {
|
76 |
+
return 'PHP';
|
77 |
+
}
|
78 |
+
} else {
|
79 |
+
return 'wpcache';
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Prepare the item for the REST response
|
85 |
+
*
|
86 |
+
* @param mixed $item WordPress representation of the item.
|
87 |
+
* @param WP_REST_Request $request Request object.
|
88 |
+
* @return mixed
|
89 |
+
*/
|
90 |
+
public function prepare_item_for_response( $item, $request ) {
|
91 |
+
$settings = array();
|
92 |
+
|
93 |
+
$integers = array( 'cache_max_time', 'preload_interval' );
|
94 |
+
$string_arrays = array( 'cache_stats', 'cache_acceptable_files', 'cache_rejected_uri', 'cache_rejected_user_agent',
|
95 |
+
'cache_direct_pages' );
|
96 |
+
foreach( $item as $key => $value ) {
|
97 |
+
if ( is_array( $value ) && false == in_array( $key, $string_arrays ) ) {
|
98 |
+
array_walk( $value, array( $this, 'make_array_bool' ) );
|
99 |
+
|
100 |
+
} elseif ( ( $value === 0 || $value === 1 ) && false == in_array( $key, $integers ) ) {
|
101 |
+
$value = (bool)$value;
|
102 |
+
}
|
103 |
+
|
104 |
+
$settings[ $key ] = $value;
|
105 |
+
}
|
106 |
+
|
107 |
+
$strings_to_bool = array( 'ossdl_https', 'refresh_current_only_on_comments' );
|
108 |
+
foreach( $strings_to_bool as $key ) {
|
109 |
+
if ( isset( $settings[ $key ] ) ) {
|
110 |
+
$settings[ $key ] = (bool)$settings[ $key ];
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
return rest_ensure_response( $settings );
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* @param mixed $value
|
119 |
+
* @param string $key
|
120 |
+
*/
|
121 |
+
public function make_array_bool( &$value, $key ) {
|
122 |
+
if ( $value == 0 || $value == 1 ) {
|
123 |
+
$value = (bool) $value;
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* @return bool
|
129 |
+
*/
|
130 |
+
protected function get_is_submit_enabled() {
|
131 |
+
global $wp_cache_config_file;
|
132 |
+
return is_writeable_ACLSafe( $wp_cache_config_file );
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* @return bool
|
137 |
+
*/
|
138 |
+
protected function get_is_preload_enabled() {
|
139 |
+
return false === defined( 'DISABLESUPERCACHEPRELOADING' );
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* @return false|int
|
144 |
+
*/
|
145 |
+
protected function get_next_gc() {
|
146 |
+
return wp_next_scheduled( 'wp_cache_gc' );
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* @return int
|
151 |
+
*/
|
152 |
+
protected function get_is_preload_active() {
|
153 |
+
if ( wp_next_scheduled( 'wp_cache_preload_hook' ) || wp_next_scheduled( 'wp_cache_full_preload_hook' ) ) {
|
154 |
+
return true;
|
155 |
+
} else {
|
156 |
+
return false;
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* @return int
|
162 |
+
*/
|
163 |
+
protected function get_minimum_preload_interval() {
|
164 |
+
global $wpdb;
|
165 |
+
$posts_count = wp_count_posts();
|
166 |
+
$count = $posts_count->publish;
|
167 |
+
if ( $count > 1000 ) {
|
168 |
+
$min_refresh_interval = 720;
|
169 |
+
} else {
|
170 |
+
$min_refresh_interval = 30;
|
171 |
+
}
|
172 |
+
|
173 |
+
return $min_refresh_interval;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* @return int
|
178 |
+
*/
|
179 |
+
protected function get_is_lock_down_enabled() {
|
180 |
+
if ( defined( 'WPLOCKDOWN' ) ) {
|
181 |
+
return constant( 'WPLOCKDOWN' ) ? 1 : 0;
|
182 |
+
}
|
183 |
+
|
184 |
+
return 0;
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* @return int
|
189 |
+
*/
|
190 |
+
protected function get_post_count() {
|
191 |
+
$posts_count = wp_count_posts();
|
192 |
+
return $posts_count->publish;
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* @return string
|
197 |
+
*/
|
198 |
+
protected function get_default_cache_path() {
|
199 |
+
return WP_CONTENT_DIR . '/wp-cache/';
|
200 |
+
}
|
201 |
+
}
|
rest/class.wp-super-cache-rest-get-stats.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WP_Super_Cache_Rest_Get_Stats extends WP_REST_Controller {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Get the cache stats for the site.
|
7 |
+
*
|
8 |
+
* @param WP_REST_Request $request Full data about the request.
|
9 |
+
* @return WP_Error|WP_REST_Response
|
10 |
+
*/
|
11 |
+
public function callback( $request ) {
|
12 |
+
global $valid_nonce;
|
13 |
+
$_GET[ 'listfiles' ] = 1;
|
14 |
+
$valid_nonce = true;
|
15 |
+
|
16 |
+
return rest_ensure_response( wp_cache_regenerate_cache_file_stats() );
|
17 |
+
}
|
18 |
+
}
|
rest/class.wp-super-cache-rest-get-status.php
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WP_Super_Cache_Rest_Get_Status extends WP_REST_Controller {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Get any status that might be visible.
|
7 |
+
*
|
8 |
+
* @param WP_REST_Request $request Full data about the request.
|
9 |
+
* @return WP_Error|WP_REST_Response
|
10 |
+
*/
|
11 |
+
public function callback( $request ) {
|
12 |
+
$status = array();
|
13 |
+
|
14 |
+
include_once( ABSPATH . 'wp-admin/includes/file.php' ); // get_home_path()
|
15 |
+
include_once( ABSPATH . 'wp-admin/includes/misc.php' ); // extract_from_markers()
|
16 |
+
$this->add_rewrite_status( $status );
|
17 |
+
$this->add_cache_disabled_status( $status );
|
18 |
+
$this->add_compression_status( $status );
|
19 |
+
$this->add_php_mod_rewrite_status( $status );
|
20 |
+
$this->add_preload_status( $status );
|
21 |
+
|
22 |
+
if ( empty( $status ) ) {
|
23 |
+
return rest_ensure_response( new stdclass() );
|
24 |
+
} else {
|
25 |
+
return rest_ensure_response( $status );
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @param array $status
|
31 |
+
*/
|
32 |
+
protected function add_preload_status( & $status ) {
|
33 |
+
global $wp_cache_config_file;
|
34 |
+
|
35 |
+
include( $wp_cache_config_file );
|
36 |
+
|
37 |
+
if ( false == $cache_enabled ) {
|
38 |
+
$status[ 'preload_disabled_cache_off' ] = true;
|
39 |
+
}
|
40 |
+
if ( false == $super_cache_enabled ) {
|
41 |
+
$status[ 'preload_disabled_supercache_off' ] = true;
|
42 |
+
}
|
43 |
+
if ( true === defined( 'DISABLESUPERCACHEPRELOADING' ) ) {
|
44 |
+
$status[ 'preload_disabled_by_admin' ] = true;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @param array $status
|
50 |
+
*/
|
51 |
+
protected function add_php_mod_rewrite_status( & $status ) {
|
52 |
+
global $wp_cache_config_file;
|
53 |
+
|
54 |
+
include( $wp_cache_config_file );
|
55 |
+
|
56 |
+
if ( $cache_enabled && !$wp_cache_mod_rewrite ) {
|
57 |
+
$scrules = trim( implode( "\n", extract_from_markers( trailingslashit( get_home_path() ) . '.htaccess', 'WPSuperCache' ) ) );
|
58 |
+
if ( $scrules != '' ) {
|
59 |
+
$status[ 'php_mod_rewrite' ] = true;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @param array $status
|
66 |
+
*/
|
67 |
+
protected function add_cache_disabled_status( & $status ) {
|
68 |
+
global $wp_cache_config_file;
|
69 |
+
|
70 |
+
if ( ! is_writeable_ACLSafe( $wp_cache_config_file ) ) {
|
71 |
+
$status['cache_disabled'] = true;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* @param array $status
|
77 |
+
*/
|
78 |
+
protected function add_compression_status( & $status ) {
|
79 |
+
if ( defined( 'WPSC_DISABLE_COMPRESSION' ) ) {
|
80 |
+
$status['compression_disabled_by_admin'] = true;
|
81 |
+
} elseif ( false == function_exists( 'gzencode' ) ) {
|
82 |
+
$status['compression_disabled_no_gzencode'] = true;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* @param array $status
|
88 |
+
*/
|
89 |
+
protected function add_rewrite_status( & $status ) {
|
90 |
+
global $home_path, $wp_cache_config_file;
|
91 |
+
|
92 |
+
include( $wp_cache_config_file );
|
93 |
+
|
94 |
+
// Return if the rewrite caching is disabled.
|
95 |
+
if ( ! $cache_enabled || ! $super_cache_enabled || ! $wp_cache_mod_rewrite ) {
|
96 |
+
return;
|
97 |
+
}
|
98 |
+
|
99 |
+
$scrules = implode( "\n", extract_from_markers( $home_path . '.htaccess', 'WPSuperCache' ) );
|
100 |
+
extract( wpsc_get_htaccess_info() );
|
101 |
+
|
102 |
+
if ( $scrules != $rules ) {
|
103 |
+
$status[ 'mod_rewrite_rules' ] = true;
|
104 |
+
}
|
105 |
+
$got_rewrite = apache_mod_loaded( 'mod_rewrite', true );
|
106 |
+
if ( $wp_cache_mod_rewrite && false == apply_filters( 'got_rewrite', $got_rewrite ) ) {
|
107 |
+
$status[ 'mod_rewrite_missing' ] = true;
|
108 |
+
}
|
109 |
+
|
110 |
+
if ( !is_writeable_ACLSafe( $home_path . ".htaccess" ) ) {
|
111 |
+
$status[ 'htaccess_ro' ] = true;
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
rest/class.wp-super-cache-rest-preload.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WP_Super_Cache_Rest_Preload extends WP_REST_Controller {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Update the cache settings.
|
7 |
+
*
|
8 |
+
* @param WP_REST_Request $request Full data about the request.
|
9 |
+
* @return WP_Error|WP_REST_Response
|
10 |
+
*/
|
11 |
+
public function callback( $request ) {
|
12 |
+
$parameters = $request->get_json_params();
|
13 |
+
|
14 |
+
if ( defined( 'DISABLESUPERCACHEPRELOADING' ) ) {
|
15 |
+
wp_cache_debug( 'WP_Super_Cache_Rest_Preload: preload disabled by admin' );
|
16 |
+
return rest_ensure_response( array( 'error' => 'preload disabled by admin' ) );
|
17 |
+
}
|
18 |
+
|
19 |
+
if ( isset( $parameters[ 'enable' ] ) ) {
|
20 |
+
if ( $parameters[ 'enable' ] == true ) {
|
21 |
+
wp_cache_debug( 'WP_Super_Cache_Rest_Preload: enable' );
|
22 |
+
wpsc_enable_preload();
|
23 |
+
return( rest_ensure_response( array( 'enabled' => true ) ) );
|
24 |
+
} else {
|
25 |
+
wp_cache_debug( 'WP_Super_Cache_Rest_Preload: cancel' );
|
26 |
+
wpsc_cancel_preload();
|
27 |
+
return( rest_ensure_response( array( 'enabled' => false ) ) );
|
28 |
+
}
|
29 |
+
}
|
30 |
+
}
|
31 |
+
}
|
rest/class.wp-super-cache-rest-test-cache.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WP_Super_Cache_Rest_Test_Cache extends WP_REST_Controller {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Get a collection of items
|
7 |
+
*
|
8 |
+
* @param WP_REST_Request $request Full data about the request.
|
9 |
+
* @return WP_Error|WP_REST_Response
|
10 |
+
*/
|
11 |
+
public function callback( $request ) {
|
12 |
+
global $cache_path;
|
13 |
+
|
14 |
+
$url = trailingslashit( get_bloginfo( 'url' ) );
|
15 |
+
|
16 |
+
$response = array( 'status' => 'UNKNOWN' );
|
17 |
+
$has_errors = false;
|
18 |
+
|
19 |
+
$attempts = array( 'prime', 'first', 'second' );
|
20 |
+
|
21 |
+
$c = 0;
|
22 |
+
foreach ( $attempts as $attempt_name ) {
|
23 |
+
$attempt = array();
|
24 |
+
$page[ $c ] = wp_remote_get( $url, array('timeout' => 60, 'blocking' => true ) );
|
25 |
+
|
26 |
+
if ( ! is_wp_error( $page[ $c ] ) ) {
|
27 |
+
$fp = fopen( $cache_path . $c . ".html", "w" );
|
28 |
+
fwrite( $fp, $page[ $c ][ 'body' ] );
|
29 |
+
fclose( $fp );
|
30 |
+
}
|
31 |
+
|
32 |
+
if ( is_wp_error( $page[ $c ] ) ) {
|
33 |
+
$has_errors = true;
|
34 |
+
$attempt['status'] = false;
|
35 |
+
$attempt['errors'] = $this->format_error( $page[ $c ] );
|
36 |
+
|
37 |
+
} elseif ( $page[ $c ]['response']['code'] != 200 ) {
|
38 |
+
$has_errors = true;
|
39 |
+
$attempt['status'] = false;
|
40 |
+
$attempt['errors'] = array( $page[ $c ]['response']['message'] );
|
41 |
+
|
42 |
+
// Don't run this step on prime cache.
|
43 |
+
} elseif ( 0 !== $c && 0 === preg_match( '/(Cached page generated by WP-Super-Cache on) ([0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*)/', $page[ $c ]['body'], $matches2 ) ) {
|
44 |
+
$has_errors = true;
|
45 |
+
$attempt['status'] = false;
|
46 |
+
$attempt['errors'] = array( __( 'Timestamps not found', 'wp-super-cache' ) );
|
47 |
+
|
48 |
+
} else {
|
49 |
+
$attempt['status'] = true;
|
50 |
+
}
|
51 |
+
|
52 |
+
|
53 |
+
$response[ 'attempts' ][ $attempt_name ] = $attempt;
|
54 |
+
$c++;
|
55 |
+
}
|
56 |
+
|
57 |
+
if (
|
58 |
+
false == $has_errors &&
|
59 |
+
preg_match( '/(Cached page generated by WP-Super-Cache on) ([0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*)/', $page[ 1 ][ 'body' ], $matches1 ) &&
|
60 |
+
preg_match( '/(Cached page generated by WP-Super-Cache on) ([0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*)/', $page[ 2 ][ 'body' ], $matches2 ) &&
|
61 |
+
$matches1[2] == $matches2[2]
|
62 |
+
) {
|
63 |
+
$response[ 'status' ] = true;
|
64 |
+
} else {
|
65 |
+
$response[ 'status' ] = false;
|
66 |
+
$response[ 'error' ] = array( __( 'Timestamps do not match', 'wp-super-cache' ) );
|
67 |
+
}
|
68 |
+
|
69 |
+
$error = '';
|
70 |
+
if ( $response[ 'status' ] == false ) {
|
71 |
+
if ( isset( $response[ 'error' ] ) ) {
|
72 |
+
$error = $response[ 'error' ];
|
73 |
+
} else {
|
74 |
+
foreach( $response[ 'attempts' ] as $attempt ) {
|
75 |
+
$error .= $attempt[ 'errors' ] . "\n";
|
76 |
+
}
|
77 |
+
}
|
78 |
+
return new WP_Error( 'test_error', $error, array( 'status' => 500 ) );
|
79 |
+
}
|
80 |
+
return rest_ensure_response( $response );
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* @param WP_Error $error
|
85 |
+
* @return array
|
86 |
+
*/
|
87 |
+
protected function format_error( WP_Error $error ) {
|
88 |
+
$messages = array();
|
89 |
+
foreach ( $error->get_error_codes() as $code ) {
|
90 |
+
foreach ( $error->get_error_messages( $code ) as $err ) {
|
91 |
+
$messages[] = $err;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
return $messages;
|
96 |
+
}
|
97 |
+
}
|
rest/class.wp-super-cache-rest-update-settings.php
ADDED
@@ -0,0 +1,654 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once __DIR__ . '/class.wp-super-cache-settings-map.php';
|
4 |
+
|
5 |
+
class WP_Super_Cache_Rest_Update_Settings extends WP_REST_Controller {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Update the cache settings.
|
9 |
+
*
|
10 |
+
* @param WP_REST_Request $request Full data about the request.
|
11 |
+
*
|
12 |
+
* @return WP_Error|WP_REST_Response
|
13 |
+
*/
|
14 |
+
public function callback( $request ) {
|
15 |
+
$parameters = $request->get_json_params();
|
16 |
+
|
17 |
+
// Override to force locking.
|
18 |
+
if ( defined( 'WPSC_DISABLE_LOCKING' ) ) {
|
19 |
+
$parameters['cache_disable_locking'] = 1;
|
20 |
+
}
|
21 |
+
|
22 |
+
// Set the nonce to valid, so that form sets will work later.
|
23 |
+
global $valid_nonce;
|
24 |
+
$valid_nonce = true;
|
25 |
+
|
26 |
+
$errors = array();
|
27 |
+
|
28 |
+
if ( isset( $parameters['easy'] ) ) {
|
29 |
+
$errors = $this->toggle_easy_caching( $parameters['easy'] );
|
30 |
+
|
31 |
+
} elseif ( isset( $parameters[ 'reset' ] ) ) {
|
32 |
+
$errors = $this->restore_default_settings( $parameters );
|
33 |
+
|
34 |
+
} else {
|
35 |
+
|
36 |
+
foreach ( $parameters as $name => $value ) {
|
37 |
+
if ( $has_error = $this->set_value_by_key( $value, $name ) ) {
|
38 |
+
if ( false == is_numeric( $has_error ) && false == is_bool( $has_error ) ) {
|
39 |
+
$errors[] = $has_error;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
$this->save_time_settings( $parameters );
|
45 |
+
$this->save_preload_settings();
|
46 |
+
$this->set_debug_settings( $parameters );
|
47 |
+
}
|
48 |
+
|
49 |
+
if ( count( $errors ) > 0 ) {
|
50 |
+
return rest_ensure_response( $errors );
|
51 |
+
|
52 |
+
} else {
|
53 |
+
$get_settings = new WP_Super_Cache_Rest_Get_Settings();
|
54 |
+
return $get_settings->callback( $request );
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Given a key and a value, set the value for that key, based on
|
60 |
+
* the configuration in the settings map.
|
61 |
+
*
|
62 |
+
* @param mixed $value
|
63 |
+
* @param string $key
|
64 |
+
*
|
65 |
+
* @return string|null
|
66 |
+
*/
|
67 |
+
protected function set_value_by_key( $value, $key ) {
|
68 |
+
|
69 |
+
$settings_map = WP_Super_Cache_Settings_Map::$map;
|
70 |
+
$error = null;
|
71 |
+
|
72 |
+
// If this parameter isn't in the map, then let's ignore it.
|
73 |
+
if ( ! isset( $settings_map[ $key ] ) ) {
|
74 |
+
return null;
|
75 |
+
}
|
76 |
+
|
77 |
+
$map = $settings_map[ $key ];
|
78 |
+
|
79 |
+
if ( isset( $map['set'] ) ) {
|
80 |
+
$set_method = $map['set'];
|
81 |
+
|
82 |
+
if ( method_exists( $this, $set_method ) ) {
|
83 |
+
if ( $has_error = $this->$set_method( $value, $key ) ) {
|
84 |
+
$error = $has_error;
|
85 |
+
}
|
86 |
+
|
87 |
+
} elseif ( function_exists( $set_method ) ) {
|
88 |
+
$set_method( $value );
|
89 |
+
}
|
90 |
+
|
91 |
+
} elseif ( isset( $map['global'] ) ) {
|
92 |
+
|
93 |
+
if ( method_exists( $this, 'set_' . $map['global'] ) ) {
|
94 |
+
$set_method = 'set_' . $map['global'];
|
95 |
+
|
96 |
+
if ( $has_error = $this->$set_method( $value ) ) {
|
97 |
+
$error = $has_error;
|
98 |
+
}
|
99 |
+
} else {
|
100 |
+
|
101 |
+
$this->set_global( $map['global'], $value );
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
return $error;
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* A generic method for setting globals.
|
110 |
+
*
|
111 |
+
* The setting must be added to the whitelist in order to be set this way.
|
112 |
+
*
|
113 |
+
* @param string $global_name
|
114 |
+
* @param mixed $value
|
115 |
+
*/
|
116 |
+
protected function set_global( $global_name, $value ) {
|
117 |
+
$whitelist = array(
|
118 |
+
'wp_super_cache_late_init',
|
119 |
+
'wp_cache_disable_utf8',
|
120 |
+
'wp_cache_no_cache_for_get',
|
121 |
+
'wp_supercache_304',
|
122 |
+
'wp_cache_mfunc_enabled',
|
123 |
+
'wp_cache_mobile_enabled',
|
124 |
+
'wp_cache_front_page_checks',
|
125 |
+
'wp_supercache_cache_list',
|
126 |
+
'wp_cache_hello_world',
|
127 |
+
'wp_cache_clear_on_post_edit',
|
128 |
+
'cache_rebuild_files',
|
129 |
+
'wp_cache_refresh_single_only',
|
130 |
+
'wp_cache_mutex_disabled',
|
131 |
+
'wpsc_save_headers',
|
132 |
+
);
|
133 |
+
|
134 |
+
if ( ! in_array( $global_name, $whitelist ) ) {
|
135 |
+
return false;
|
136 |
+
}
|
137 |
+
|
138 |
+
wp_cache_setting( $global_name, (int)$value );
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* @param mixed $value
|
144 |
+
*/
|
145 |
+
protected function set_wp_cache_location( $value ) {
|
146 |
+
global $cache_path;
|
147 |
+
|
148 |
+
if ( $value != '' && ( ! isset( $cache_path ) || $value != $cache_path ) ) {
|
149 |
+
$dir = realpath( trailingslashit( dirname( $value ) ) );
|
150 |
+
if ( $dir == false ) {
|
151 |
+
$dir = WP_CONTENT_DIR . '/cache/';
|
152 |
+
|
153 |
+
} else {
|
154 |
+
$dir = trailingslashit( $dir ) . trailingslashit( wpsc_deep_replace( array(
|
155 |
+
'..',
|
156 |
+
'\\'
|
157 |
+
), basename( $value ) ) );
|
158 |
+
}
|
159 |
+
|
160 |
+
$new_cache_path = $dir;
|
161 |
+
|
162 |
+
} else {
|
163 |
+
$new_cache_path = WP_CONTENT_DIR . '/cache/';
|
164 |
+
}
|
165 |
+
|
166 |
+
if ( $new_cache_path != $cache_path ) {
|
167 |
+
if ( file_exists( $new_cache_path ) == false ) {
|
168 |
+
rename( $cache_path, $new_cache_path );
|
169 |
+
}
|
170 |
+
|
171 |
+
$cache_path = $new_cache_path;
|
172 |
+
wp_cache_setting( 'cache_path', $cache_path );
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* @param mixed $value
|
178 |
+
*/
|
179 |
+
protected function set_cache_enabled( $value ) {
|
180 |
+
if ( $value != 1 ) {
|
181 |
+
wp_cache_disable();
|
182 |
+
|
183 |
+
return;
|
184 |
+
}
|
185 |
+
|
186 |
+
wp_cache_enable();
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* @param mixed $value
|
191 |
+
*/
|
192 |
+
protected function set_lock_down( $value ) {
|
193 |
+
$_POST[ 'wp_lock_down' ] = (int)$value;
|
194 |
+
wp_update_lock_down();
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* @param mixed $value
|
199 |
+
*/
|
200 |
+
protected function set_super_cache_enabled( $value ) {
|
201 |
+
global $wp_cache_mod_rewrite;
|
202 |
+
|
203 |
+
if ( is_numeric( $value ) == false ) {
|
204 |
+
$types = array( 'wpcache' => 0, 'mod_rewrite' => 1, 'PHP' => 2 );
|
205 |
+
if ( isset( $types[ $value ] ) ) {
|
206 |
+
$value = $types[ $value ];
|
207 |
+
} else {
|
208 |
+
return false;
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
if ( $value === 0 ) { // WPCache
|
213 |
+
wp_super_cache_disable();
|
214 |
+
|
215 |
+
} else {
|
216 |
+
wp_super_cache_enable();
|
217 |
+
$wp_cache_mod_rewrite = 0; // PHP recommended
|
218 |
+
|
219 |
+
if ( $value == 1 ) { // mod_rewrite
|
220 |
+
$wp_cache_mod_rewrite = 1;
|
221 |
+
add_mod_rewrite_rules();
|
222 |
+
|
223 |
+
} elseif( $value == 2 ) { // PHP
|
224 |
+
$wp_cache_mod_rewrite = 0;
|
225 |
+
remove_mod_rewrite_rules();
|
226 |
+
|
227 |
+
}
|
228 |
+
|
229 |
+
wp_cache_setting( 'wp_cache_mod_rewrite', $wp_cache_mod_rewrite );
|
230 |
+
}
|
231 |
+
return true;
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* @param mixed $value
|
236 |
+
*/
|
237 |
+
protected function set_wp_cache_not_logged_in( $value ) {
|
238 |
+
global $wp_cache_not_logged_in, $cache_path;
|
239 |
+
|
240 |
+
if ( 1 == $value ) {
|
241 |
+
if ( 0 == $wp_cache_not_logged_in && function_exists( 'prune_super_cache' ) ) {
|
242 |
+
prune_super_cache( $cache_path, true );
|
243 |
+
}
|
244 |
+
|
245 |
+
$wp_cache_not_logged_in = 1;
|
246 |
+
|
247 |
+
} else {
|
248 |
+
$wp_cache_not_logged_in = 0;
|
249 |
+
}
|
250 |
+
|
251 |
+
wp_cache_setting( 'wp_cache_not_logged_in', $wp_cache_not_logged_in );
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* @param mixed $value
|
256 |
+
*/
|
257 |
+
protected function set_wp_cache_make_known_anon( $value ) {
|
258 |
+
global $wp_cache_make_known_anon, $cache_path;
|
259 |
+
|
260 |
+
if ( 1 == $value ) {
|
261 |
+
if ( $wp_cache_make_known_anon == 0 && function_exists( 'prune_super_cache' ) ) {
|
262 |
+
prune_super_cache( $cache_path, true );
|
263 |
+
}
|
264 |
+
|
265 |
+
$wp_cache_make_known_anon = 1;
|
266 |
+
|
267 |
+
} else {
|
268 |
+
$wp_cache_make_known_anon = 0;
|
269 |
+
}
|
270 |
+
|
271 |
+
wp_cache_setting( 'wp_cache_make_known_anon', $wp_cache_make_known_anon );
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* @param mixed $value
|
276 |
+
*/
|
277 |
+
protected function set_wp_cache_object_cache( $value ) {
|
278 |
+
global $_wp_using_ext_object_cache, $wp_cache_object_cache, $cache_path;
|
279 |
+
|
280 |
+
if ( ! $_wp_using_ext_object_cache ) {
|
281 |
+
return;
|
282 |
+
}
|
283 |
+
|
284 |
+
if ( $value == 0 ) {
|
285 |
+
if ( function_exists( 'prune_super_cache' ) ) {
|
286 |
+
prune_super_cache( $cache_path, true );
|
287 |
+
}
|
288 |
+
|
289 |
+
$wp_cache_object_cache = 1;
|
290 |
+
|
291 |
+
} else {
|
292 |
+
$wp_cache_object_cache = 0;
|
293 |
+
}
|
294 |
+
|
295 |
+
wp_cache_setting( 'wp_cache_object_cache', $wp_cache_object_cache );
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* @param mixed $value
|
300 |
+
*
|
301 |
+
* @return null|string
|
302 |
+
*/
|
303 |
+
protected function set_cache_compression( $value ) {
|
304 |
+
global $cache_compression, $cache_path;
|
305 |
+
|
306 |
+
$new_cache_compression = 0;
|
307 |
+
if ( defined( 'WPSC_DISABLE_COMPRESSION' ) ) {
|
308 |
+
$cache_compression = 0;
|
309 |
+
wp_cache_setting( 'cache_compression', $cache_compression );
|
310 |
+
|
311 |
+
} else {
|
312 |
+
if ( 1 == $value ) {
|
313 |
+
$new_cache_compression = 1;
|
314 |
+
}
|
315 |
+
|
316 |
+
if ( 1 == ini_get( 'zlib.output_compression' ) || "on" == strtolower( ini_get( 'zlib.output_compression' ) ) ) {
|
317 |
+
return __( "You attempted to enable compression but `zlib.output_compression` is enabled. See #21 in the Troubleshooting section of the readme file.", 'wp-super-cache' );
|
318 |
+
}
|
319 |
+
|
320 |
+
if ( $new_cache_compression != $cache_compression ) {
|
321 |
+
$cache_compression = $new_cache_compression;
|
322 |
+
wp_cache_setting( 'cache_compression', $cache_compression );
|
323 |
+
if ( function_exists( 'prune_super_cache' ) ) {
|
324 |
+
prune_super_cache( $cache_path, true );
|
325 |
+
}
|
326 |
+
|
327 |
+
delete_option( 'super_cache_meta' );
|
328 |
+
}
|
329 |
+
}
|
330 |
+
|
331 |
+
return null;
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* @param array $cache_pages
|
336 |
+
*/
|
337 |
+
protected function set_wp_cache_pages( $cache_pages ) {
|
338 |
+
if ( ! is_array( $cache_pages ) ) {
|
339 |
+
return;
|
340 |
+
}
|
341 |
+
|
342 |
+
$_POST['wp_edit_rejected_pages'] = 1;
|
343 |
+
|
344 |
+
foreach ( $cache_pages as $page => $value ) {
|
345 |
+
if ( $value ) {
|
346 |
+
$_POST['wp_cache_pages'][ $page ] = 1;
|
347 |
+
}
|
348 |
+
}
|
349 |
+
|
350 |
+
wp_cache_update_rejected_pages();
|
351 |
+
}
|
352 |
+
|
353 |
+
/**
|
354 |
+
* @param mixed $value
|
355 |
+
*/
|
356 |
+
protected function set_cache_rejected_uri( $value ) {
|
357 |
+
$_REQUEST['wp_rejected_uri'] = implode( "\n", $value );
|
358 |
+
wp_cache_update_rejected_strings();
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* @param mixed $value
|
363 |
+
*/
|
364 |
+
protected function set_cache_acceptable_files( $value ) {
|
365 |
+
$_REQUEST['wp_accepted_files'] = implode( "\n", $value );
|
366 |
+
wp_cache_update_accepted_strings();
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* @param mixed $value
|
371 |
+
*/
|
372 |
+
protected function set_cache_rejected_user_agent( $value ) {
|
373 |
+
$_POST['wp_rejected_user_agent'] = implode( "\n", $value );
|
374 |
+
wp_cache_update_rejected_ua();
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* @param mixed $value
|
379 |
+
*/
|
380 |
+
protected function set_ossdl_cname( $value ) {
|
381 |
+
update_option( 'ossdl_cname', $value );
|
382 |
+
}
|
383 |
+
|
384 |
+
/**
|
385 |
+
* @param mixed $value
|
386 |
+
*/
|
387 |
+
protected function set_ossdl_off_cdn_url( $value ) {
|
388 |
+
update_option( 'ossdl_off_cdn_url', $value );
|
389 |
+
}
|
390 |
+
|
391 |
+
/**
|
392 |
+
* @param mixed $value
|
393 |
+
*/
|
394 |
+
protected function set_ossdl_off_include_dirs( $value ) {
|
395 |
+
update_option( 'ossdl_off_include_dirs', $value == '' ? 'wp-content,wp-includes' : $value );
|
396 |
+
}
|
397 |
+
|
398 |
+
/**
|
399 |
+
* @param mixed $value
|
400 |
+
*/
|
401 |
+
protected function set_ossdl_off_exclude( $value ) {
|
402 |
+
update_option( 'ossdl_off_exclude', $value );
|
403 |
+
}
|
404 |
+
|
405 |
+
/**
|
406 |
+
* @param mixed $value
|
407 |
+
*/
|
408 |
+
protected function set_ossdl_https( $value ) {
|
409 |
+
update_option( 'ossdl_https', $value ? 1 : 0 );
|
410 |
+
}
|
411 |
+
|
412 |
+
/**
|
413 |
+
* @param mixed $value
|
414 |
+
*/
|
415 |
+
protected function set_ossdlcdn( $value ) {
|
416 |
+
global $wp_cache_config_file;
|
417 |
+
|
418 |
+
$ossdlcdn = $value ? 1 : 0;
|
419 |
+
wp_cache_replace_line( '^ *\$ossdlcdn', "\$ossdlcdn = $ossdlcdn;", $wp_cache_config_file );
|
420 |
+
}
|
421 |
+
|
422 |
+
/**
|
423 |
+
* @param mixed $value
|
424 |
+
* @param string $name
|
425 |
+
*/
|
426 |
+
protected function set_time_setting( $value, $name ) {
|
427 |
+
$_POST[ $name ] = $value;
|
428 |
+
$_POST['_time_setting'] = true;
|
429 |
+
}
|
430 |
+
|
431 |
+
/**
|
432 |
+
* @param mixed $value
|
433 |
+
* @param string $name
|
434 |
+
*/
|
435 |
+
protected function set_preload_setting( $value, $name ) {
|
436 |
+
$_POST[ $name ] = $value;
|
437 |
+
$_POST['_preload_setting'] = true;
|
438 |
+
}
|
439 |
+
|
440 |
+
/**
|
441 |
+
* Easy caching is a mode that allows the user to press one button and
|
442 |
+
* enable a sensible default of settings.
|
443 |
+
*
|
444 |
+
* @param bool $enabled
|
445 |
+
*/
|
446 |
+
protected function toggle_easy_caching( $enabled = true ) {
|
447 |
+
global $cache_path, $wp_cache_shutdown_gc, $cache_schedule_type;
|
448 |
+
if ( $enabled ) {
|
449 |
+
$settings = array(
|
450 |
+
'wp_cache_mobile_enabled' => 1,
|
451 |
+
'is_cache_enabled' => 1,
|
452 |
+
'cache_rebuild_files' => 1,
|
453 |
+
'cache_compression' => 0,
|
454 |
+
);
|
455 |
+
wp_cache_enable();
|
456 |
+
if ( ! defined( 'DISABLE_SUPERCACHE' ) ) {
|
457 |
+
wp_cache_debug( 'DISABLE_SUPERCACHE is not set, super_cache enabled.' );
|
458 |
+
wp_super_cache_enable();
|
459 |
+
}
|
460 |
+
wpsc_set_default_gc();
|
461 |
+
|
462 |
+
} else {
|
463 |
+
wp_cache_disable();
|
464 |
+
$settings = array( 'is_cache_enabled' => 0 );
|
465 |
+
wp_clear_scheduled_hook( 'wp_cache_check_site_hook' );
|
466 |
+
wp_clear_scheduled_hook( 'wp_cache_gc' );
|
467 |
+
wp_clear_scheduled_hook( 'wp_cache_gc_watcher' );
|
468 |
+
}
|
469 |
+
|
470 |
+
foreach ( $settings as $key => $value ) {
|
471 |
+
$this->set_value_by_key( $value, $key );
|
472 |
+
}
|
473 |
+
|
474 |
+
if ( $cache_path != WP_CONTENT_DIR . '/cache/' ) {
|
475 |
+
$this->set_value_by_key( $cache_path, 'wp_cache_location' );
|
476 |
+
}
|
477 |
+
|
478 |
+
$advanced_settings = array(
|
479 |
+
'wp_super_cache_late_init',
|
480 |
+
'wp_cache_disable_utf8',
|
481 |
+
'wp_cache_no_cache_for_get',
|
482 |
+
'wp_supercache_304',
|
483 |
+
'wp_cache_mfunc_enabled',
|
484 |
+
'wp_cache_mobile_enabled',
|
485 |
+
'wp_cache_front_page_checks',
|
486 |
+
'wp_supercache_cache_list',
|
487 |
+
'wp_cache_hello_world',
|
488 |
+
'wp_cache_clear_on_post_edit',
|
489 |
+
'wp_cache_not_logged_in',
|
490 |
+
'wp_cache_make_known_anon',
|
491 |
+
'wp_cache_object_cache',
|
492 |
+
'wp_cache_refresh_single_only',
|
493 |
+
'cache_compression',
|
494 |
+
'wp_cache_mutex_disabled'
|
495 |
+
);
|
496 |
+
|
497 |
+
foreach ( $advanced_settings as $setting ) {
|
498 |
+
global ${$setting};
|
499 |
+
|
500 |
+
$value = ( isset( $$setting ) && $$setting == 1 ) ? 1 : 0;
|
501 |
+
$this->set_value_by_key( $value, $setting );
|
502 |
+
}
|
503 |
+
}
|
504 |
+
|
505 |
+
/**
|
506 |
+
* Runs at the end and saves the time settings.
|
507 |
+
*/
|
508 |
+
protected function save_time_settings( $parameters ) {
|
509 |
+
if ( ! isset( $_POST['_time_setting'] ) || true !== $_POST['_time_setting'] ) {
|
510 |
+
return;
|
511 |
+
}
|
512 |
+
|
513 |
+
$_POST['action'] = 'expirytime';
|
514 |
+
|
515 |
+
$all_time_settings = array(
|
516 |
+
'cache_max_time',
|
517 |
+
'cache_schedule_type',
|
518 |
+
'cache_scheduled_time',
|
519 |
+
'cache_schedule_interval',
|
520 |
+
'cache_time_interval',
|
521 |
+
'cache_gc_email_me'
|
522 |
+
);
|
523 |
+
|
524 |
+
foreach ( $all_time_settings as $time_setting ) {
|
525 |
+
global ${$time_setting};
|
526 |
+
if ( false == isset( $_POST[ $time_setting ] ) || $$time_setting == $_POST[ $time_setting ] ) {
|
527 |
+
$_POST[ $time_setting ] = $$time_setting; // fill in the potentially missing fields before updating GC settings.
|
528 |
+
}
|
529 |
+
}
|
530 |
+
|
531 |
+
if ( isset( $parameters['cache_gc_email_me'] ) && $parameters['cache_gc_email_me'] == 0 ) {
|
532 |
+
unset( $_POST['cache_gc_email_me'] );
|
533 |
+
}
|
534 |
+
$_POST[ 'wp_max_time' ] = $_POST[ 'cache_max_time' ];
|
535 |
+
|
536 |
+
wp_cache_time_update();
|
537 |
+
}
|
538 |
+
|
539 |
+
|
540 |
+
/**
|
541 |
+
* set the cached direct pages list.
|
542 |
+
*/
|
543 |
+
protected function set_cache_direct_pages( $list ) {
|
544 |
+
if ( is_array( $list ) == false ) {
|
545 |
+
return false;
|
546 |
+
}
|
547 |
+
|
548 |
+
$_POST[ 'direct_pages' ] = $list;
|
549 |
+
wpsc_update_direct_pages();
|
550 |
+
}
|
551 |
+
|
552 |
+
/**
|
553 |
+
* add an entry to the cached direct pages list.
|
554 |
+
*/
|
555 |
+
protected function new_direct_page( $value ) {
|
556 |
+
global $cached_direct_pages;
|
557 |
+
|
558 |
+
if ( isset( $_POST[ 'direct_pages' ] ) == false ) {
|
559 |
+
$_POST[ 'direct_pages' ] = $cached_direct_pages;
|
560 |
+
}
|
561 |
+
|
562 |
+
$_POST[ 'new_direct_page' ] = $value;
|
563 |
+
wpsc_update_direct_pages();
|
564 |
+
}
|
565 |
+
|
566 |
+
/**
|
567 |
+
* Runs at the end and saves the preload settings.
|
568 |
+
*/
|
569 |
+
protected function save_preload_settings() {
|
570 |
+
if ( ! isset( $_POST['_preload_setting'] ) || true !== $_POST['_preload_setting'] ) {
|
571 |
+
return;
|
572 |
+
}
|
573 |
+
|
574 |
+
$_POST['action'] = 'preload';
|
575 |
+
|
576 |
+
$all_preload_settings = array(
|
577 |
+
'preload_interval' => 'wp_cache_preload_interval',
|
578 |
+
'preload_on' => 'wp_cache_preload_on',
|
579 |
+
'preload_taxonomies' => 'wp_cache_preload_taxonomies',
|
580 |
+
'preload_email_volume' => 'wp_cache_preload_email_volume',
|
581 |
+
'preload_posts' => 'wp_cache_preload_posts',
|
582 |
+
);
|
583 |
+
|
584 |
+
foreach ( $all_preload_settings as $key => $original ) {
|
585 |
+
if ( ! isset( $_POST[ $key ] ) ) {
|
586 |
+
global ${$original};
|
587 |
+
$_POST[ $original ] = $$original;
|
588 |
+
} else {
|
589 |
+
$_POST[ $original ] = $_POST[ $key ];
|
590 |
+
if ( $key !== 'preload_interval' && ( $_POST[ $key ] === 0 || $_POST[ $key ] === false ) ) {
|
591 |
+
unset( $_POST[ $original ] );
|
592 |
+
}
|
593 |
+
|
594 |
+
}
|
595 |
+
}
|
596 |
+
|
597 |
+
wpsc_preload_settings();
|
598 |
+
}
|
599 |
+
|
600 |
+
/*
|
601 |
+
* Delete the plugin configuration file and restore the sample one.
|
602 |
+
*/
|
603 |
+
protected function restore_default_settings( $parameters ) {
|
604 |
+
global $wp_cache_config_file, $wp_cache_config_file_sample;
|
605 |
+
|
606 |
+
if ( file_exists( $wp_cache_config_file_sample ) ) {
|
607 |
+
copy( $wp_cache_config_file_sample, $wp_cache_config_file );
|
608 |
+
$cache_page_secret = md5( date( 'H:i:s' ) . mt_rand() );
|
609 |
+
wp_cache_setting( 'cache_page_secret', $cache_page_secret );
|
610 |
+
|
611 |
+
if ( function_exists( "opcache_invalidate" ) ) {
|
612 |
+
opcache_invalidate( $wp_cache_config_file );
|
613 |
+
}
|
614 |
+
}
|
615 |
+
wpsc_set_default_gc( true );
|
616 |
+
|
617 |
+
}
|
618 |
+
|
619 |
+
/**
|
620 |
+
* Update the debug settings.
|
621 |
+
*
|
622 |
+
* @param WP_REST_Request $request Full data about the request.
|
623 |
+
* @return WP_Error|WP_REST_Response
|
624 |
+
*/
|
625 |
+
public function set_debug_settings( $parameters ) {
|
626 |
+
|
627 |
+
$settings = array (
|
628 |
+
'wp_super_cache_debug',
|
629 |
+
'wp_cache_debug_ip',
|
630 |
+
'wp_super_cache_comments',
|
631 |
+
'wp_super_cache_front_page_check',
|
632 |
+
'wp_super_cache_front_page_clear',
|
633 |
+
'wp_super_cache_front_page_text',
|
634 |
+
'wp_super_cache_front_page_notification',
|
635 |
+
'wpsc_delete_log',
|
636 |
+
);
|
637 |
+
|
638 |
+
foreach( $settings as $setting ) {
|
639 |
+
if ( isset( $parameters[ $setting ] ) ) {
|
640 |
+
if ( $parameters[ $setting ] != false ) {
|
641 |
+
$_POST[ $setting ] = $parameters[ $setting ];
|
642 |
+
}
|
643 |
+
$_POST[ 'wp_cache_debug' ] = 1;
|
644 |
+
} else {
|
645 |
+
global $$setting;
|
646 |
+
$_POST[ $setting ] = $$setting;
|
647 |
+
}
|
648 |
+
}
|
649 |
+
global $valid_nonce;
|
650 |
+
$valid_nonce = true;
|
651 |
+
|
652 |
+
$settings = wpsc_update_debug_settings();
|
653 |
+
}
|
654 |
+
}
|
rest/class.wp-super-cache-settings-map.php
ADDED
@@ -0,0 +1,259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WP_Super_Cache_Settings_Map {
|
4 |
+
/**
|
5 |
+
* A map describing how settings transform from their external names
|
6 |
+
* into internal methods and globals.
|
7 |
+
*
|
8 |
+
* Key definitions:
|
9 |
+
*
|
10 |
+
* - get: A getter method or function that will be called to return the var
|
11 |
+
* - set: A setter method or function that will be called to set the var
|
12 |
+
* - option: An option name that will be used to get or set the var
|
13 |
+
* - global: A name of a global that can GET
|
14 |
+
*
|
15 |
+
* @var array
|
16 |
+
*/
|
17 |
+
public static $map = array(
|
18 |
+
'is_submit_enabled' => array(
|
19 |
+
'get' => 'get_is_submit_enabled',
|
20 |
+
'set' => '',
|
21 |
+
),
|
22 |
+
'is_preload_enabled' => array(
|
23 |
+
'get' => 'get_is_preload_enabled',
|
24 |
+
'set' => '',
|
25 |
+
),
|
26 |
+
'cache_lock_down' => array(
|
27 |
+
'get' => 'get_is_lock_down_enabled',
|
28 |
+
'set' => 'set_lock_down',
|
29 |
+
),
|
30 |
+
'cache_next_gc' => array(
|
31 |
+
'get' => 'get_next_gc',
|
32 |
+
'set' => '',
|
33 |
+
),
|
34 |
+
'cache_gc_email_me' => array(
|
35 |
+
'global' => 'cache_gc_email_me',
|
36 |
+
'set' => 'set_time_setting',
|
37 |
+
),
|
38 |
+
'cache_path_url' => array(
|
39 |
+
'get' => 'get_cache_path_url',
|
40 |
+
),
|
41 |
+
'cache_type' => array(
|
42 |
+
'get' => 'get_cache_type',
|
43 |
+
'set' => 'set_super_cache_enabled',
|
44 |
+
),
|
45 |
+
'is_preloading' => array(
|
46 |
+
'get' => 'wpsc_is_preloading',
|
47 |
+
'set' => '',
|
48 |
+
),
|
49 |
+
'post_count' => array(
|
50 |
+
'get' => 'get_post_count',
|
51 |
+
'set' => '',
|
52 |
+
),
|
53 |
+
'is_cache_enabled' => array(
|
54 |
+
'global' => 'cache_enabled',
|
55 |
+
'set' => 'set_cache_enabled',
|
56 |
+
),
|
57 |
+
'is_super_cache_enabled' => array(
|
58 |
+
'global' => 'super_cache_enabled',
|
59 |
+
'set' => 'set_super_cache_enabled',
|
60 |
+
),
|
61 |
+
'is_mobile_enabled' => array(
|
62 |
+
'global' => 'wp_cache_mobile_enabled',
|
63 |
+
),
|
64 |
+
'is_mfunc_enabled' => array(
|
65 |
+
'global' => 'wp_cache_mfunc_enabled',
|
66 |
+
),
|
67 |
+
'cache_list' => array(
|
68 |
+
'global' => 'wp_supercache_cache_list',
|
69 |
+
),
|
70 |
+
'clear_cache_on_post_edit' => array(
|
71 |
+
'global' => 'wp_cache_clear_on_post_edit',
|
72 |
+
),
|
73 |
+
'wpsc_save_headers' => array(
|
74 |
+
'global' => 'wpsc_save_headers',
|
75 |
+
),
|
76 |
+
'cache_rebuild' => array(
|
77 |
+
'global' => 'cache_rebuild_files',
|
78 |
+
),
|
79 |
+
'dont_cache_logged_in' => array(
|
80 |
+
'global' => 'wp_cache_not_logged_in',
|
81 |
+
),
|
82 |
+
'make_known_anon' => array(
|
83 |
+
'global' => 'wp_cache_make_known_anon',
|
84 |
+
),
|
85 |
+
'cache_path' => array(
|
86 |
+
'global' => 'cache_path',
|
87 |
+
'set' => 'set_wp_cache_location',
|
88 |
+
),
|
89 |
+
'default_cache_path' => array(
|
90 |
+
'get' => 'get_default_cache_path',
|
91 |
+
),
|
92 |
+
'use_object_cache' => array(
|
93 |
+
'global' => 'wp_cache_object_cache',
|
94 |
+
),
|
95 |
+
'refresh_current_only_on_comments' => array(
|
96 |
+
'global' => 'wp_cache_refresh_single_only',
|
97 |
+
),
|
98 |
+
'cache_compression' => array(
|
99 |
+
'global' => 'cache_compression',
|
100 |
+
'set' => 'set_cache_compression',
|
101 |
+
),
|
102 |
+
'cache_mod_rewrite' => array(
|
103 |
+
'global' => 'wp_cache_mod_rewrite',
|
104 |
+
),
|
105 |
+
'use_304_headers' => array(
|
106 |
+
'global' => 'wp_supercache_304',
|
107 |
+
),
|
108 |
+
'cache_late_init' => array(
|
109 |
+
'global' => 'wp_super_cache_late_init',
|
110 |
+
),
|
111 |
+
'front_page_checks' => array(
|
112 |
+
'global' => 'wp_cache_front_page_checks',
|
113 |
+
),
|
114 |
+
'cache_page_secret' => array(
|
115 |
+
'global' => 'cache_page_secret',
|
116 |
+
),
|
117 |
+
'disable_utf8' => array(
|
118 |
+
'global' => 'wp_cache_disable_utf8',
|
119 |
+
),
|
120 |
+
'no_cache_for_get' => array(
|
121 |
+
'global' => 'wp_cache_no_cache_for_get',
|
122 |
+
),
|
123 |
+
'cache_schedule_type' => array(
|
124 |
+
'global' => 'cache_schedule_type',
|
125 |
+
'set' => 'set_time_setting',
|
126 |
+
),
|
127 |
+
'cache_scheduled_time' => array(
|
128 |
+
'global' => 'cache_scheduled_time',
|
129 |
+
'set' => 'set_time_setting',
|
130 |
+
),
|
131 |
+
'cache_max_time' => array(
|
132 |
+
'global' => 'cache_max_time',
|
133 |
+
'set' => 'set_time_setting',
|
134 |
+
),
|
135 |
+
'cache_time_interval' => array(
|
136 |
+
'global' => 'cache_time_interval',
|
137 |
+
'set' => 'set_time_setting',
|
138 |
+
),
|
139 |
+
'shutdown_garbage_collector' => array(
|
140 |
+
'global' => 'wp_cache_shutdown_gc',
|
141 |
+
),
|
142 |
+
'pages' => array(
|
143 |
+
'global' => 'wp_cache_pages',
|
144 |
+
),
|
145 |
+
'minimum_preload_interval' => array(
|
146 |
+
'get' => 'get_minimum_preload_interval',
|
147 |
+
),
|
148 |
+
'preload_interval' => array(
|
149 |
+
'global' => 'wp_cache_preload_interval',
|
150 |
+
'set' => 'set_preload_setting',
|
151 |
+
),
|
152 |
+
'preload_posts' => array(
|
153 |
+
'global' => 'wp_cache_preload_posts',
|
154 |
+
'set' => 'set_preload_setting',
|
155 |
+
),
|
156 |
+
'preload_on' => array(
|
157 |
+
'global' => 'wp_cache_preload_on',
|
158 |
+
'set' => 'set_preload_setting',
|
159 |
+
),
|
160 |
+
'preload_active' => array(
|
161 |
+
'get' => 'get_is_preload_active',
|
162 |
+
),
|
163 |
+
'preload_taxonomies' => array(
|
164 |
+
'global' => 'wp_cache_preload_taxonomies',
|
165 |
+
'set' => 'set_preload_setting',
|
166 |
+
),
|
167 |
+
'preload_email_me' => array(
|
168 |
+
'global' => 'wp_cache_preload_email_me',
|
169 |
+
'set' => 'set_preload_setting',
|
170 |
+
),
|
171 |
+
'preload_email_volume' => array(
|
172 |
+
'global' => 'wp_cache_preload_email_volume',
|
173 |
+
'set' => 'set_preload_setting',
|
174 |
+
),
|
175 |
+
'cache_mobile_browsers' => array(
|
176 |
+
'global' => 'wp_cache_mobile_browsers',
|
177 |
+
),
|
178 |
+
'cache_mobile_prefixes' => array(
|
179 |
+
'global' => 'wp_cache_mobile_prefixes',
|
180 |
+
),
|
181 |
+
'cache_disable_locking' => array(
|
182 |
+
'global' => 'wp_cache_mutex_disabled',
|
183 |
+
),
|
184 |
+
'cache_hello_world' => array(
|
185 |
+
'global' => 'wp_cache_hello_world',
|
186 |
+
),
|
187 |
+
'cache_schedule_interval' => array(
|
188 |
+
'global' => 'cache_schedule_interval',
|
189 |
+
'set' => 'set_time_setting',
|
190 |
+
),
|
191 |
+
'cache_acceptable_files' => array(
|
192 |
+
'global' => 'cache_acceptable_files',
|
193 |
+
),
|
194 |
+
'cache_rejected_uri' => array(
|
195 |
+
'global' => 'cache_rejected_uri',
|
196 |
+
),
|
197 |
+
'cache_rejected_user_agent' => array(
|
198 |
+
'global' => 'cache_rejected_user_agent',
|
199 |
+
),
|
200 |
+
'cache_direct_pages' => array(
|
201 |
+
'global' => 'cached_direct_pages',
|
202 |
+
'set' => 'set_cache_direct_pages',
|
203 |
+
),
|
204 |
+
'new_direct_page' => array(
|
205 |
+
'set' => 'new_direct_page',
|
206 |
+
),
|
207 |
+
'ossdl_cname' => array(
|
208 |
+
'option' => 'ossdl_cname',
|
209 |
+
'set' => 'set_ossdl_cname',
|
210 |
+
),
|
211 |
+
'ossdl_https' => array(
|
212 |
+
'option' => 'ossdl_https',
|
213 |
+
'set' => 'set_ossdl_https',
|
214 |
+
),
|
215 |
+
'ossdl_off_cdn_url' => array(
|
216 |
+
'option' => 'ossdl_off_cdn_url',
|
217 |
+
'set' => 'set_ossdl_off_cdn_url',
|
218 |
+
),
|
219 |
+
'ossdl_off_exclude' => array(
|
220 |
+
'option' => 'ossdl_off_exclude',
|
221 |
+
'set' => 'set_ossdl_off_exclude',
|
222 |
+
),
|
223 |
+
'ossdl_off_include_dirs' => array(
|
224 |
+
'option' => 'ossdl_off_include_dirs',
|
225 |
+
'set' => 'set_ossdl_off_include_dirs',
|
226 |
+
),
|
227 |
+
'ossdlcdn' => array(
|
228 |
+
'global' => 'ossdlcdn',
|
229 |
+
'set' => 'set_ossdlcdn',
|
230 |
+
),
|
231 |
+
'wp_super_cache_debug' => array(
|
232 |
+
'global' => 'wp_super_cache_debug',
|
233 |
+
),
|
234 |
+
'wp_cache_debug_username' => array(
|
235 |
+
'global' => 'wp_cache_debug_username',
|
236 |
+
),
|
237 |
+
'wp_cache_debug_log' => array(
|
238 |
+
'global' => 'wp_cache_debug_log',
|
239 |
+
),
|
240 |
+
'wp_cache_debug_ip' => array(
|
241 |
+
'global' => 'wp_cache_debug_ip',
|
242 |
+
),
|
243 |
+
'wp_super_cache_comments' => array(
|
244 |
+
'global' => 'wp_super_cache_comments',
|
245 |
+
),
|
246 |
+
'wp_super_cache_front_page_check' => array(
|
247 |
+
'global' => 'wp_super_cache_front_page_check',
|
248 |
+
),
|
249 |
+
'wp_super_cache_front_page_clear' => array(
|
250 |
+
'global' => 'wp_super_cache_front_page_clear',
|
251 |
+
),
|
252 |
+
'wp_super_cache_front_page_text' => array(
|
253 |
+
'global' => 'wp_super_cache_front_page_text',
|
254 |
+
),
|
255 |
+
'wp_super_cache_front_page_notification' => array(
|
256 |
+
'global' => 'wp_super_cache_front_page_notification',
|
257 |
+
),
|
258 |
+
);
|
259 |
+
}
|
rest/load.php
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once __DIR__ . '/class.wp-super-cache-rest-get-settings.php';
|
4 |
+
require_once __DIR__ . '/class.wp-super-cache-rest-update-settings.php';
|
5 |
+
require_once __DIR__ . '/class.wp-super-cache-rest-get-stats.php';
|
6 |
+
require_once __DIR__ . '/class.wp-super-cache-rest-get-cache.php';
|
7 |
+
require_once __DIR__ . '/class.wp-super-cache-rest-get-status.php';
|
8 |
+
require_once __DIR__ . '/class.wp-super-cache-rest-test-cache.php';
|
9 |
+
require_once __DIR__ . '/class.wp-super-cache-rest-delete-cache.php';
|
10 |
+
require_once __DIR__ . '/class.wp-super-cache-rest-preload.php';
|
11 |
+
|
12 |
+
class WP_Super_Cache_Router {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Register the routes for the objects of the controller.
|
16 |
+
*
|
17 |
+
* GET /wp-super-cache/v1/settings
|
18 |
+
* POST /wp-super-cache/v1/settings
|
19 |
+
* GET /wp-super-cache/v1/stats
|
20 |
+
* GET /wp-super-cache/v1/cache
|
21 |
+
* POST /wp-super-cache/v1/cache
|
22 |
+
*/
|
23 |
+
public static function register_routes() {
|
24 |
+
$version = '1';
|
25 |
+
$namespace = 'wp-super-cache/v' . $version;
|
26 |
+
|
27 |
+
$get_settings = new WP_Super_Cache_Rest_Get_Settings();
|
28 |
+
$update_settings = new WP_Super_Cache_Rest_Update_Settings();
|
29 |
+
$get_stats = new WP_Super_Cache_Rest_Get_Stats();
|
30 |
+
$get_cache = new WP_Super_Cache_Rest_Get_Cache();
|
31 |
+
$test_cache = new WP_Super_Cache_Rest_Test_Cache();
|
32 |
+
$delete_cache = new WP_Super_Cache_Rest_Delete_Cache();
|
33 |
+
$preload_cache = new WP_Super_Cache_Rest_Preload();
|
34 |
+
$get_status = new WP_Super_Cache_Rest_Get_Status();
|
35 |
+
|
36 |
+
register_rest_route( $namespace, '/settings', array(
|
37 |
+
array(
|
38 |
+
'methods' => WP_REST_Server::READABLE,
|
39 |
+
'callback' => array( $get_settings, 'callback' ),
|
40 |
+
'permission_callback' => __CLASS__ . '::get_item_permissions_check',
|
41 |
+
'args' => array(),
|
42 |
+
),
|
43 |
+
array(
|
44 |
+
'methods' => WP_REST_Server::CREATABLE,
|
45 |
+
'callback' => array( $update_settings, 'callback' ),
|
46 |
+
'permission_callback' => __CLASS__ . '::update_item_permissions_check',
|
47 |
+
'args' => array(),
|
48 |
+
),
|
49 |
+
) );
|
50 |
+
|
51 |
+
register_rest_route( $namespace, '/status', array(
|
52 |
+
'methods' => WP_REST_Server::READABLE,
|
53 |
+
'callback' => array( $get_status, 'callback' ),
|
54 |
+
'permission_callback' => __CLASS__ . '::get_item_permissions_check',
|
55 |
+
) );
|
56 |
+
|
57 |
+
register_rest_route( $namespace, '/stats', array(
|
58 |
+
'methods' => WP_REST_Server::READABLE,
|
59 |
+
'callback' => array( $get_stats, 'callback' ),
|
60 |
+
'permission_callback' => __CLASS__ . '::get_item_permissions_check',
|
61 |
+
) );
|
62 |
+
|
63 |
+
register_rest_route( $namespace, '/cache', array(
|
64 |
+
array(
|
65 |
+
'methods' => WP_REST_Server::READABLE,
|
66 |
+
'callback' => array( $get_cache, 'callback' ),
|
67 |
+
'permission_callback' => __CLASS__ . '::get_item_permissions_check',
|
68 |
+
'args' => array(),
|
69 |
+
),
|
70 |
+
array(
|
71 |
+
'methods' => WP_REST_Server::CREATABLE,
|
72 |
+
'callback' => array( $delete_cache, 'callback' ),
|
73 |
+
'permission_callback' => __CLASS__ . '::delete_item_permissions_check',
|
74 |
+
'args' => array(),
|
75 |
+
),
|
76 |
+
) );
|
77 |
+
|
78 |
+
register_rest_route( $namespace, '/preload', array(
|
79 |
+
'methods' => WP_REST_Server::CREATABLE,
|
80 |
+
'callback' => array( $preload_cache, 'callback' ),
|
81 |
+
'permission_callback' => __CLASS__ . '::update_item_permissions_check',
|
82 |
+
) );
|
83 |
+
|
84 |
+
register_rest_route( $namespace, '/cache/test', array(
|
85 |
+
'methods' => WP_REST_Server::CREATABLE,
|
86 |
+
'callback' => array( $test_cache, 'callback' ),
|
87 |
+
'permission_callback' => __CLASS__ . '::create_item_permissions_check',
|
88 |
+
) );
|
89 |
+
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Check if a given request has access to get items
|
94 |
+
*
|
95 |
+
* @param WP_REST_Request $request Full data about the request.
|
96 |
+
* @return WP_Error|bool
|
97 |
+
*/
|
98 |
+
public static function get_items_permissions_check( $request ) {
|
99 |
+
return wpsupercache_site_admin();
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Check if a given request has access to get a specific item
|
104 |
+
*
|
105 |
+
* @param WP_REST_Request $request Full data about the request.
|
106 |
+
* @return WP_Error|bool
|
107 |
+
*/
|
108 |
+
public static function get_item_permissions_check( $request ) {
|
109 |
+
return self::get_items_permissions_check( $request );
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Check if a given request has access to create items
|
114 |
+
*
|
115 |
+
* @param WP_REST_Request $request Full data about the request.
|
116 |
+
* @return WP_Error|bool
|
117 |
+
*/
|
118 |
+
public static function create_item_permissions_check( $request ) {
|
119 |
+
return self::get_items_permissions_check( $request );
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Check if a given request has access to update a specific item
|
124 |
+
*
|
125 |
+
* @param WP_REST_Request $request Full data about the request.
|
126 |
+
* @return WP_Error|bool
|
127 |
+
*/
|
128 |
+
public static function update_item_permissions_check( $request ) {
|
129 |
+
return self::create_item_permissions_check( $request );
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Check if a given request has access to update a specific item
|
134 |
+
*
|
135 |
+
* @param WP_REST_Request $request Full data about the request.
|
136 |
+
* @return WP_Error|bool
|
137 |
+
*/
|
138 |
+
public static function delete_item_permissions_check( $request ) {
|
139 |
+
return self::update_item_permissions_check( $request );
|
140 |
+
}
|
141 |
+
|
142 |
+
}
|
143 |
+
|
144 |
+
add_action( 'rest_api_init', function() {
|
145 |
+
$wpsupercache_route = new WP_Super_Cache_Router;
|
146 |
+
$wpsupercache_route->register_routes();
|
147 |
+
} );
|
wp-cache-base.php
CHANGED
@@ -1,7 +1,10 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
$WPSC_HTTP_HOST =
|
|
|
|
|
|
|
5 |
|
6 |
// We want to be able to identify each blog in a WordPress MU install
|
7 |
$blogcacheid = '';
|
1 |
<?php
|
2 |
+
if ( false == isset( $_SERVER[ 'HTTP_HOST' ] ) ) {
|
3 |
+
$cache_enabled = false;
|
4 |
+
$WPSC_HTTP_HOST = '';
|
5 |
+
} else {
|
6 |
+
$WPSC_HTTP_HOST = htmlentities( $_SERVER[ 'HTTP_HOST' ] );
|
7 |
+
}
|
8 |
|
9 |
// We want to be able to identify each blog in a WordPress MU install
|
10 |
$blogcacheid = '';
|
wp-cache-config-sample.php
CHANGED
@@ -10,7 +10,7 @@ if ( ! defined('WPCACHEHOME') )
|
|
10 |
|
11 |
$cache_compression = 0; // Super cache compression
|
12 |
$cache_enabled = false;
|
13 |
-
$super_cache_enabled =
|
14 |
$cache_max_time = 3600; //in seconds
|
15 |
//$use_flock = true; // Set it true or false if you know what to use
|
16 |
$cache_path = WP_CONTENT_DIR . '/cache/';
|
@@ -79,4 +79,22 @@ $wp_cache_clear_on_post_edit = 0;
|
|
79 |
$wp_cache_hello_world = 0;
|
80 |
$wp_cache_mobile_enabled = 0;
|
81 |
$wp_cache_cron_check = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
?>
|
10 |
|
11 |
$cache_compression = 0; // Super cache compression
|
12 |
$cache_enabled = false;
|
13 |
+
$super_cache_enabled = true;
|
14 |
$cache_max_time = 3600; //in seconds
|
15 |
//$use_flock = true; // Set it true or false if you know what to use
|
16 |
$cache_path = WP_CONTENT_DIR . '/cache/';
|
79 |
$wp_cache_hello_world = 0;
|
80 |
$wp_cache_mobile_enabled = 0;
|
81 |
$wp_cache_cron_check = 0;
|
82 |
+
$wp_cache_mfunc_enabled = 0;
|
83 |
+
$wp_cache_make_known_anon = 0;
|
84 |
+
$wp_cache_refresh_single_only = 0;
|
85 |
+
$wp_cache_mod_rewrite = 0;
|
86 |
+
$wp_supercache_304 = 0;
|
87 |
+
$wp_cache_front_page_checks = 0;
|
88 |
+
$wp_cache_disable_utf8 = 0;
|
89 |
+
$wp_cache_no_cache_for_get = 0;
|
90 |
+
$cache_scheduled_time = "00:00";
|
91 |
+
$wp_cache_preload_interval = 600;
|
92 |
+
$cache_schedule_type = 'interval';
|
93 |
+
$wp_cache_preload_posts = 0;
|
94 |
+
$wp_cache_preload_on = 0;
|
95 |
+
$wp_cache_preload_taxonomies = 0;
|
96 |
+
$wp_cache_preload_email_me = 0;
|
97 |
+
$wp_cache_preload_email_volume = 'none';
|
98 |
+
$wp_cache_mobile_prefixes = '';
|
99 |
+
$cached_direct_pages = array();
|
100 |
?>
|
wp-cache-phase1.php
CHANGED
@@ -4,12 +4,16 @@
|
|
4 |
if( !defined('WP_CONTENT_DIR') )
|
5 |
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
|
6 |
|
7 |
-
if(
|
8 |
return false;
|
9 |
|
10 |
if( !defined( 'WPCACHEHOME' ) )
|
11 |
define('WPCACHEHOME', dirname(__FILE__).'/');
|
12 |
|
|
|
|
|
|
|
|
|
13 |
|
14 |
include( WPCACHEHOME . 'wp-cache-base.php');
|
15 |
|
@@ -42,6 +46,12 @@ if( is_array( $plugins ) ) {
|
|
42 |
}
|
43 |
}
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
if ( isset( $wp_cache_make_known_anon ) && $wp_cache_make_known_anon )
|
46 |
wp_supercache_cache_for_admins();
|
47 |
|
@@ -73,6 +83,9 @@ if ($cache_compression) {
|
|
73 |
}
|
74 |
|
75 |
add_cacheaction( 'supercache_filename_str', 'wp_cache_check_mobile' );
|
|
|
|
|
|
|
76 |
|
77 |
$wp_cache_request_uri = $_SERVER[ 'REQUEST_URI' ]; // Cache this in case any plugin modifies it.
|
78 |
|
@@ -109,7 +122,7 @@ function get_wp_cache_key( $url = false ) {
|
|
109 |
}
|
110 |
|
111 |
function wp_super_cache_init() {
|
112 |
-
global $wp_cache_key, $key, $blogcacheid, $
|
113 |
|
114 |
$wp_cache_key = get_wp_cache_key();
|
115 |
$key = $blogcacheid . md5( $wp_cache_key );
|
@@ -127,7 +140,10 @@ function wp_cache_serve_cache_file() {
|
|
127 |
global $wp_cache_object_cache, $cache_compression, $wp_cache_slash_check, $wp_supercache_304, $wp_cache_home_path, $wp_cache_no_cache_for_get;
|
128 |
global $wp_cache_disable_utf8, $wp_cache_mfunc_enabled;
|
129 |
|
130 |
-
|
|
|
|
|
|
|
131 |
|
132 |
if ( wp_cache_user_agent_is_rejected() ) {
|
133 |
wp_cache_debug( "No wp-cache file served as user agent rejected.", 5 );
|
@@ -139,6 +155,8 @@ function wp_cache_serve_cache_file() {
|
|
139 |
return false;
|
140 |
}
|
141 |
|
|
|
|
|
142 |
if ( $wp_cache_object_cache && wp_cache_get_cookies_values() == '' ) {
|
143 |
if ( !empty( $_GET ) ) {
|
144 |
wp_cache_debug( "Non empty GET request. Not serving request from object cache. " . json_encode( $_GET ), 1 );
|
@@ -157,7 +175,15 @@ function wp_cache_serve_cache_file() {
|
|
157 |
wp_cache_debug( "Meta array from object cache corrupt. Ignoring cache.", 1 );
|
158 |
return true;
|
159 |
}
|
160 |
-
} elseif ( file_exists( $cache_file ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
wp_cache_debug( "wp-cache file exists: $cache_file", 5 );
|
162 |
if ( !( $meta = json_decode( wp_cache_get_legacy_cache( $meta_pathname ), true ) ) ) {
|
163 |
wp_cache_debug( "couldn't load wp-cache meta file", 5 );
|
@@ -169,7 +195,8 @@ function wp_cache_serve_cache_file() {
|
|
169 |
@unlink( $cache_file );
|
170 |
return true;
|
171 |
}
|
172 |
-
} else {
|
|
|
173 |
// last chance, check if a supercache file exists. Just in case .htaccess rules don't work on this host
|
174 |
$filename = supercache_filename();
|
175 |
$file = get_current_url_supercache_dir() . $filename;
|
@@ -182,6 +209,9 @@ function wp_cache_serve_cache_file() {
|
|
182 |
} elseif ( wp_cache_get_cookies_values() != '' ) {
|
183 |
wp_cache_debug( "Cookies found. Cannot serve a supercache file. " . wp_cache_get_cookies_values() );
|
184 |
return false;
|
|
|
|
|
|
|
185 |
}
|
186 |
|
187 |
if ( isset( $wp_cache_mfunc_enabled ) == false )
|
@@ -223,28 +253,31 @@ function wp_cache_serve_cache_file() {
|
|
223 |
|
224 |
header( "Vary: Accept-Encoding, Cookie" );
|
225 |
header( "Cache-Control: max-age=3, must-revalidate" );
|
226 |
-
header( "WP-Super-Cache: Served supercache file from PHP" );
|
227 |
$size = function_exists( 'mb_strlen' ) ? mb_strlen( $cachefiledata, '8bit' ) : strlen( $cachefiledata );
|
228 |
if ( $wp_cache_gzip_encoding ) {
|
|
|
229 |
header( 'Content-Encoding: ' . $wp_cache_gzip_encoding );
|
230 |
header( 'Content-Length: ' . $size );
|
231 |
} elseif ( $wp_supercache_304 ) {
|
|
|
232 |
header( 'Content-Length: ' . $size );
|
|
|
|
|
233 |
}
|
234 |
|
235 |
// don't try to match modified dates if using dynamic code.
|
236 |
if ( $wp_cache_mfunc_enabled == 0 && $wp_supercache_304 ) {
|
237 |
if ( function_exists( 'apache_request_headers' ) ) {
|
238 |
$request = apache_request_headers();
|
239 |
-
$remote_mod_time = ( isset ( $request[ 'If-Modified-Since' ] ) ) ? $request[ 'If-Modified-Since' ] :
|
240 |
} else {
|
241 |
if ( isset( $_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ] ) )
|
242 |
$remote_mod_time = $_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ];
|
243 |
else
|
244 |
-
$remote_mod_time =
|
245 |
}
|
246 |
$local_mod_time = gmdate("D, d M Y H:i:s",filemtime( $file )).' GMT';
|
247 |
-
if ( $remote_mod_time
|
248 |
header("HTTP/1.0 304 Not Modified");
|
249 |
exit();
|
250 |
}
|
@@ -271,7 +304,7 @@ function wp_cache_serve_cache_file() {
|
|
271 |
if( strpos( $header, 'Last-Modified:' ) === false )
|
272 |
header($header);
|
273 |
}
|
274 |
-
header( 'WP-Super-Cache: Served
|
275 |
if ( $wp_cache_object_cache ) {
|
276 |
if ( $cache ) {
|
277 |
if ( $ungzip ) {
|
@@ -372,11 +405,15 @@ function wp_cache_get_cookies_values() {
|
|
372 |
return $string;
|
373 |
}
|
374 |
|
375 |
-
|
|
|
|
|
|
|
|
|
376 |
if ( defined( 'LOGGED_IN_COOKIE' ) )
|
377 |
$regex .= "|^" . preg_quote( constant( 'LOGGED_IN_COOKIE' ) );
|
378 |
else
|
379 |
-
$regex .= "|^wordpress_logged_in_";
|
380 |
$regex .= "/";
|
381 |
while ($key = key($_COOKIE)) {
|
382 |
if ( preg_match( $regex, $key ) ) {
|
@@ -615,11 +652,61 @@ function get_current_url_supercache_dir( $post_id = 0 ) {
|
|
615 |
return $dir;
|
616 |
}
|
617 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
618 |
function get_all_supercache_filenames( $dir = '' ) {
|
619 |
global $wp_cache_mobile_enabled, $cache_path;
|
620 |
|
621 |
$dir = realpath( $dir );
|
622 |
-
|
|
|
623 |
return array();
|
624 |
|
625 |
$filenames = array( 'index.html', 'index-https.html', 'index.html.php' );
|
@@ -650,6 +737,8 @@ function get_all_supercache_filenames( $dir = '' ) {
|
|
650 |
}
|
651 |
|
652 |
function supercache_filename() {
|
|
|
|
|
653 |
//Add support for https and http caching
|
654 |
$is_https = ( ( isset( $_SERVER[ 'HTTPS' ] ) && 'on' == strtolower( $_SERVER[ 'HTTPS' ] ) ) || ( isset( $_SERVER[ 'HTTP_X_FORWARDED_PROTO' ] ) && 'https' == strtolower( $_SERVER[ 'HTTP_X_FORWARDED_PROTO' ] ) ) ); //Also supports https requests coming from an nginx reverse proxy
|
655 |
$extra_str = $is_https ? '-https' : '';
|
@@ -659,6 +748,10 @@ function supercache_filename() {
|
|
659 |
} else {
|
660 |
$extra_str = do_cacheaction( 'supercache_filename_str', $extra_str );
|
661 |
}
|
|
|
|
|
|
|
|
|
662 |
$filename = 'index' . $extra_str . '.html';
|
663 |
|
664 |
return $filename;
|
@@ -699,6 +792,9 @@ function wp_supercache_cache_for_admins() {
|
|
699 |
if ( false == do_cacheaction( 'wp_supercache_remove_cookies', true ) )
|
700 |
return true;
|
701 |
|
|
|
|
|
|
|
702 |
$cookie_keys = array( 'wordpress_logged_in', 'comment_author_' );
|
703 |
if ( defined( 'LOGGED_IN_COOKIE' ) )
|
704 |
$cookie_keys[] = constant( 'LOGGED_IN_COOKIE' );
|
@@ -719,11 +815,15 @@ function wp_cache_confirm_delete( $dir ) {
|
|
719 |
global $cache_path, $blog_cache_dir;
|
720 |
// don't allow cache_path, blog cache dir, blog meta dir, supercache.
|
721 |
$dir = realpath( $dir );
|
|
|
|
|
|
|
|
|
722 |
if (
|
723 |
-
$dir == $
|
724 |
-
$dir == $blog_cache_dir ||
|
725 |
-
$dir == $blog_cache_dir . "meta/" ||
|
726 |
-
$dir == $cache_path . "supercache"
|
727 |
) {
|
728 |
return false;
|
729 |
} else {
|
@@ -743,4 +843,18 @@ function wpsc_deep_replace( $search, $subject ) {
|
|
743 |
return $subject;
|
744 |
}
|
745 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
746 |
?>
|
4 |
if( !defined('WP_CONTENT_DIR') )
|
5 |
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
|
6 |
|
7 |
+
if( !@include( WP_CONTENT_DIR . '/wp-cache-config.php' ) )
|
8 |
return false;
|
9 |
|
10 |
if( !defined( 'WPCACHEHOME' ) )
|
11 |
define('WPCACHEHOME', dirname(__FILE__).'/');
|
12 |
|
13 |
+
if ( defined( 'DISABLE_SUPERCACHE' ) ) {
|
14 |
+
wp_cache_debug( 'DISABLE_SUPERCACHE set, super_cache disabled.' );
|
15 |
+
$super_cache_enabled = 0;
|
16 |
+
}
|
17 |
|
18 |
include( WPCACHEHOME . 'wp-cache-base.php');
|
19 |
|
46 |
}
|
47 |
}
|
48 |
|
49 |
+
if ( $wp_cache_not_logged_in && wp_cache_get_cookies_values() ) {
|
50 |
+
wp_cache_debug( 'Caching disabled for logged in users on settings page.' );
|
51 |
+
define( 'DONOTCACHEPAGE', 1 );
|
52 |
+
return true;
|
53 |
+
}
|
54 |
+
|
55 |
if ( isset( $wp_cache_make_known_anon ) && $wp_cache_make_known_anon )
|
56 |
wp_supercache_cache_for_admins();
|
57 |
|
83 |
}
|
84 |
|
85 |
add_cacheaction( 'supercache_filename_str', 'wp_cache_check_mobile' );
|
86 |
+
if ( function_exists( 'add_filter' ) ) { // loaded since WordPress 4.6
|
87 |
+
add_filter( 'supercache_filename_str', 'wp_cache_check_mobile' );
|
88 |
+
}
|
89 |
|
90 |
$wp_cache_request_uri = $_SERVER[ 'REQUEST_URI' ]; // Cache this in case any plugin modifies it.
|
91 |
|
122 |
}
|
123 |
|
124 |
function wp_super_cache_init() {
|
125 |
+
global $wp_cache_key, $key, $blogcacheid, $file_prefix, $blog_cache_dir, $meta_file, $cache_file, $cache_filename, $meta_pathname;
|
126 |
|
127 |
$wp_cache_key = get_wp_cache_key();
|
128 |
$key = $blogcacheid . md5( $wp_cache_key );
|
140 |
global $wp_cache_object_cache, $cache_compression, $wp_cache_slash_check, $wp_supercache_304, $wp_cache_home_path, $wp_cache_no_cache_for_get;
|
141 |
global $wp_cache_disable_utf8, $wp_cache_mfunc_enabled;
|
142 |
|
143 |
+
if ( is_admin() ) {
|
144 |
+
wp_cache_debug( 'Not serving wp-admin requests.', 5 );
|
145 |
+
return false;
|
146 |
+
}
|
147 |
|
148 |
if ( wp_cache_user_agent_is_rejected() ) {
|
149 |
wp_cache_debug( "No wp-cache file served as user agent rejected.", 5 );
|
155 |
return false;
|
156 |
}
|
157 |
|
158 |
+
extract( wp_super_cache_init() );
|
159 |
+
|
160 |
if ( $wp_cache_object_cache && wp_cache_get_cookies_values() == '' ) {
|
161 |
if ( !empty( $_GET ) ) {
|
162 |
wp_cache_debug( "Non empty GET request. Not serving request from object cache. " . json_encode( $_GET ), 1 );
|
175 |
wp_cache_debug( "Meta array from object cache corrupt. Ignoring cache.", 1 );
|
176 |
return true;
|
177 |
}
|
178 |
+
} elseif ( file_exists( $cache_file ) || file_exists( get_current_url_supercache_dir() . 'meta-' . $cache_filename ) ) {
|
179 |
+
if ( file_exists( get_current_url_supercache_dir() . 'meta-' . $cache_filename ) ) {
|
180 |
+
$cache_file = get_current_url_supercache_dir() . $cache_filename;
|
181 |
+
$meta_pathname = get_current_url_supercache_dir() . 'meta-' . $cache_filename;
|
182 |
+
} elseif ( !file_exists( $cache_file ) ) {
|
183 |
+
wp_cache_debug( "wp_cache_serve_cache_file: found cache file but then it disappeared!" );
|
184 |
+
return false;
|
185 |
+
}
|
186 |
+
|
187 |
wp_cache_debug( "wp-cache file exists: $cache_file", 5 );
|
188 |
if ( !( $meta = json_decode( wp_cache_get_legacy_cache( $meta_pathname ), true ) ) ) {
|
189 |
wp_cache_debug( "couldn't load wp-cache meta file", 5 );
|
195 |
@unlink( $cache_file );
|
196 |
return true;
|
197 |
}
|
198 |
+
} else { // no $cache_file
|
199 |
+
global $wpsc_save_headers;
|
200 |
// last chance, check if a supercache file exists. Just in case .htaccess rules don't work on this host
|
201 |
$filename = supercache_filename();
|
202 |
$file = get_current_url_supercache_dir() . $filename;
|
209 |
} elseif ( wp_cache_get_cookies_values() != '' ) {
|
210 |
wp_cache_debug( "Cookies found. Cannot serve a supercache file. " . wp_cache_get_cookies_values() );
|
211 |
return false;
|
212 |
+
} elseif ( isset( $wpsc_save_headers ) && $wpsc_save_headers ) {
|
213 |
+
wp_cache_debug( "Saving headers. Cannot serve a supercache file." );
|
214 |
+
return false;
|
215 |
}
|
216 |
|
217 |
if ( isset( $wp_cache_mfunc_enabled ) == false )
|
253 |
|
254 |
header( "Vary: Accept-Encoding, Cookie" );
|
255 |
header( "Cache-Control: max-age=3, must-revalidate" );
|
|
|
256 |
$size = function_exists( 'mb_strlen' ) ? mb_strlen( $cachefiledata, '8bit' ) : strlen( $cachefiledata );
|
257 |
if ( $wp_cache_gzip_encoding ) {
|
258 |
+
header( "WP-Super-Cache: Served supercache gzip file from PHP" );
|
259 |
header( 'Content-Encoding: ' . $wp_cache_gzip_encoding );
|
260 |
header( 'Content-Length: ' . $size );
|
261 |
} elseif ( $wp_supercache_304 ) {
|
262 |
+
header( "WP-Super-Cache: Served supercache 304 file from PHP" );
|
263 |
header( 'Content-Length: ' . $size );
|
264 |
+
} else {
|
265 |
+
header( "WP-Super-Cache: Served supercache file from PHP" );
|
266 |
}
|
267 |
|
268 |
// don't try to match modified dates if using dynamic code.
|
269 |
if ( $wp_cache_mfunc_enabled == 0 && $wp_supercache_304 ) {
|
270 |
if ( function_exists( 'apache_request_headers' ) ) {
|
271 |
$request = apache_request_headers();
|
272 |
+
$remote_mod_time = ( isset ( $request[ 'If-Modified-Since' ] ) ) ? $request[ 'If-Modified-Since' ] : null;
|
273 |
} else {
|
274 |
if ( isset( $_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ] ) )
|
275 |
$remote_mod_time = $_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ];
|
276 |
else
|
277 |
+
$remote_mod_time = null;
|
278 |
}
|
279 |
$local_mod_time = gmdate("D, d M Y H:i:s",filemtime( $file )).' GMT';
|
280 |
+
if ( !is_null($remote_mod_time) && $remote_mod_time == $local_mod_time ) {
|
281 |
header("HTTP/1.0 304 Not Modified");
|
282 |
exit();
|
283 |
}
|
304 |
if( strpos( $header, 'Last-Modified:' ) === false )
|
305 |
header($header);
|
306 |
}
|
307 |
+
header( 'WP-Super-Cache: Served WPCache cache file' );
|
308 |
if ( $wp_cache_object_cache ) {
|
309 |
if ( $cache ) {
|
310 |
if ( $ungzip ) {
|
405 |
return $string;
|
406 |
}
|
407 |
|
408 |
+
if ( defined( 'COOKIEHASH' ) )
|
409 |
+
$cookiehash = preg_quote( constant( 'COOKIEHASH' ) );
|
410 |
+
else
|
411 |
+
$cookiehash = '';
|
412 |
+
$regex = "/^wp-postpass_$cookiehash|^comment_author_$cookiehash";
|
413 |
if ( defined( 'LOGGED_IN_COOKIE' ) )
|
414 |
$regex .= "|^" . preg_quote( constant( 'LOGGED_IN_COOKIE' ) );
|
415 |
else
|
416 |
+
$regex .= "|^wordpress_logged_in_$cookiehash";
|
417 |
$regex .= "/";
|
418 |
while ($key = key($_COOKIE)) {
|
419 |
if ( preg_match( $regex, $key ) ) {
|
652 |
return $dir;
|
653 |
}
|
654 |
|
655 |
+
/*
|
656 |
+
* Delete (or rebuild) all the files in one directory.
|
657 |
+
* Checks if it is in the cache directory but doesn't allow files in the following directories to be deleted:
|
658 |
+
* wp-content/cache/
|
659 |
+
* wp-content/cache/blogs/
|
660 |
+
* wp-content/cache/supercache/
|
661 |
+
*
|
662 |
+
*/
|
663 |
+
function wpsc_rebuild_files( $dir ) {
|
664 |
+
return wpsc_delete_files( $dir, false );
|
665 |
+
}
|
666 |
+
|
667 |
+
function wpsc_delete_files( $dir, $delete = true ) {
|
668 |
+
global $cache_path;
|
669 |
+
static $rp_cache_path = '';
|
670 |
+
static $protected = '';
|
671 |
+
|
672 |
+
// only do this once, this function will be called many times
|
673 |
+
if ( $rp_cache_path == '' ) {
|
674 |
+
$protected = array( $cache_path, $cache_path . "blogs/", $cache_path . 'supercache' );
|
675 |
+
foreach( $protected as $id => $directory ) {
|
676 |
+
$protected[ $id ] = trailingslashit( realpath( $directory ) );
|
677 |
+
}
|
678 |
+
$rp_cache_path = trailingslashit( realpath( $cache_path ) );
|
679 |
+
}
|
680 |
+
|
681 |
+
$dir = trailingslashit( realpath( $dir ) );
|
682 |
+
if ( substr( $dir, 0, strlen( $rp_cache_path ) ) != $rp_cache_path )
|
683 |
+
return false;
|
684 |
+
|
685 |
+
if ( in_array( $dir, $protected ) )
|
686 |
+
return false;
|
687 |
+
|
688 |
+
if ( is_dir( $dir ) && $dh = @opendir( $dir ) ) {
|
689 |
+
while ( ( $file = readdir( $dh ) ) !== false ) {
|
690 |
+
if ( $file != '.' && $file != '..' && $file != '.htaccess' && is_file( $dir . $file ) )
|
691 |
+
if ( $delete )
|
692 |
+
@unlink( $dir . $file );
|
693 |
+
else
|
694 |
+
@wp_cache_rebuild_or_delete( $dir . $file );
|
695 |
+
}
|
696 |
+
closedir( $dh );
|
697 |
+
|
698 |
+
if ( $delete )
|
699 |
+
@rmdir( $dir );
|
700 |
+
}
|
701 |
+
return true;
|
702 |
+
}
|
703 |
+
|
704 |
function get_all_supercache_filenames( $dir = '' ) {
|
705 |
global $wp_cache_mobile_enabled, $cache_path;
|
706 |
|
707 |
$dir = realpath( $dir );
|
708 |
+
$rp_cache_path = realpath( $cache_path );
|
709 |
+
if ( substr( $dir, 0, strlen( $rp_cache_path ) ) != $rp_cache_path )
|
710 |
return array();
|
711 |
|
712 |
$filenames = array( 'index.html', 'index-https.html', 'index.html.php' );
|
737 |
}
|
738 |
|
739 |
function supercache_filename() {
|
740 |
+
global $cached_direct_pages;
|
741 |
+
|
742 |
//Add support for https and http caching
|
743 |
$is_https = ( ( isset( $_SERVER[ 'HTTPS' ] ) && 'on' == strtolower( $_SERVER[ 'HTTPS' ] ) ) || ( isset( $_SERVER[ 'HTTP_X_FORWARDED_PROTO' ] ) && 'https' == strtolower( $_SERVER[ 'HTTP_X_FORWARDED_PROTO' ] ) ) ); //Also supports https requests coming from an nginx reverse proxy
|
744 |
$extra_str = $is_https ? '-https' : '';
|
748 |
} else {
|
749 |
$extra_str = do_cacheaction( 'supercache_filename_str', $extra_str );
|
750 |
}
|
751 |
+
|
752 |
+
if ( is_array( $cached_direct_pages ) && in_array( $_SERVER[ 'REQUEST_URI' ], $cached_direct_pages ) ) {
|
753 |
+
$extra_str = '';
|
754 |
+
}
|
755 |
$filename = 'index' . $extra_str . '.html';
|
756 |
|
757 |
return $filename;
|
792 |
if ( false == do_cacheaction( 'wp_supercache_remove_cookies', true ) )
|
793 |
return true;
|
794 |
|
795 |
+
if ( $_SERVER[ "REQUEST_METHOD" ] != 'GET' || strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-json/' ) !== false )
|
796 |
+
return true;
|
797 |
+
|
798 |
$cookie_keys = array( 'wordpress_logged_in', 'comment_author_' );
|
799 |
if ( defined( 'LOGGED_IN_COOKIE' ) )
|
800 |
$cookie_keys[] = constant( 'LOGGED_IN_COOKIE' );
|
815 |
global $cache_path, $blog_cache_dir;
|
816 |
// don't allow cache_path, blog cache dir, blog meta dir, supercache.
|
817 |
$dir = realpath( $dir );
|
818 |
+
$rp_cache_path = realpath( $cache_path );
|
819 |
+
if ( substr( $dir, 0, strlen( $rp_cache_path ) ) != $rp_cache_path )
|
820 |
+
return false;
|
821 |
+
|
822 |
if (
|
823 |
+
$dir == $rp_cache_path ||
|
824 |
+
$dir == realpath( $blog_cache_dir ) ||
|
825 |
+
$dir == realpath( $blog_cache_dir . "meta/" ) ||
|
826 |
+
$dir == realpath( $cache_path . "supercache" )
|
827 |
) {
|
828 |
return false;
|
829 |
} else {
|
843 |
return $subject;
|
844 |
}
|
845 |
|
846 |
+
function wpsc_get_protected_directories() {
|
847 |
+
global $cache_path, $blog_cache_dir;
|
848 |
+
return apply_filters( 'wpsc_protected_directories', array(
|
849 |
+
$cache_path . '.htaccess',
|
850 |
+
$cache_path . "index.html",
|
851 |
+
$blog_cache_dir,
|
852 |
+
$blog_cache_dir . "index.html",
|
853 |
+
$blog_cache_dir . 'meta',
|
854 |
+
$blog_cache_dir . 'meta/index.html',
|
855 |
+
$cache_path . 'supercache/index.html',
|
856 |
+
$cache_path . 'supercache' )
|
857 |
+
);
|
858 |
+
}
|
859 |
+
|
860 |
?>
|
wp-cache-phase2.php
CHANGED
@@ -1,9 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
function wp_cache_phase2() {
|
4 |
-
global $
|
5 |
-
global $cache_max_time, $wp_cache_request_uri, $super_cache_enabled, $wp_cache_object_cache, $cache_time_interval;
|
6 |
-
global $cache_enabled, $wp_cache_gmt_offset, $wp_cache_blog_charset, $cache_schedule_type, $cache_scheduled_time, $cache_schedule_interval;
|
7 |
|
8 |
if ( $cache_enabled == false ) {
|
9 |
wp_cache_debug( "Caching disabled! quiting!", 1 );
|
@@ -64,7 +62,7 @@ function wp_cache_phase2() {
|
|
64 |
wp_cache_debug( 'Created output buffer', 4 );
|
65 |
|
66 |
// restore old supercache file temporarily
|
67 |
-
if( $super_cache_enabled && $cache_rebuild_files ) {
|
68 |
$user_info = wp_cache_get_cookies_values();
|
69 |
$do_cache = apply_filters( 'do_createsupercache', $user_info );
|
70 |
if( $user_info == '' || $do_cache === true )
|
@@ -75,25 +73,88 @@ function wp_cache_phase2() {
|
|
75 |
}
|
76 |
|
77 |
function wpcache_do_rebuild( $dir ) {
|
78 |
-
global $do_rebuild_list;
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
return false;
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
continue;
|
88 |
-
$mtime = @filemtime($cache_file . '.needs-rebuild');
|
89 |
-
if( $mtime && (time() - $mtime) < 10 ) {
|
90 |
-
wp_cache_debug( "Rebuild file renamed to cache file temporarily: $cache_file", 3 );
|
91 |
-
@rename( $cache_file . '.needs-rebuild', $cache_file );
|
92 |
}
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
}
|
98 |
}
|
99 |
}
|
@@ -120,23 +181,81 @@ if ( !function_exists( 'wp_cache_user_agent_is_rejected' ) ) {
|
|
120 |
}
|
121 |
|
122 |
function wp_cache_get_response_headers() {
|
123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
$headers = apache_response_headers();
|
125 |
-
|
126 |
-
|
127 |
-
$headers = apache_response_headers();
|
128 |
-
}
|
129 |
-
} else if(function_exists('headers_list')) {
|
130 |
$headers = array();
|
131 |
-
foreach(headers_list() as $hdr) {
|
132 |
$header_parts = explode( ':', $hdr, 2 );
|
133 |
$header_name = isset( $header_parts[0] ) ? trim( $header_parts[0] ) : '';
|
134 |
$header_value = isset( $header_parts[1] ) ? trim( $header_parts[1] ) : '';
|
135 |
|
136 |
$headers[$header_name] = $header_value;
|
137 |
}
|
138 |
-
}
|
139 |
-
|
|
|
|
|
|
|
|
|
|
|
140 |
|
141 |
return $headers;
|
142 |
}
|
@@ -251,7 +370,7 @@ function wp_super_cache_query_vars() {
|
|
251 |
}
|
252 |
|
253 |
function wp_cache_ob_callback( $buffer ) {
|
254 |
-
global $wp_cache_pages, $wp_query, $wp_super_cache_query, $cache_acceptable_files, $wp_cache_no_cache_for_get, $wp_cache_object_cache, $wp_cache_request_uri, $do_rebuild_list;
|
255 |
$buffer = apply_filters( 'wp_cache_ob_callback_filter', $buffer );
|
256 |
|
257 |
$script = basename($_SERVER['PHP_SELF']);
|
@@ -317,6 +436,9 @@ function wp_cache_ob_callback( $buffer ) {
|
|
317 |
$cache_this_page = false;
|
318 |
}
|
319 |
|
|
|
|
|
|
|
320 |
if ( !isset( $wp_query ) )
|
321 |
wp_cache_debug( 'wp_cache_ob_callback: WARNING! $query not defined but the plugin has worked around that problem.', 4 );
|
322 |
|
@@ -326,17 +448,24 @@ function wp_cache_ob_callback( $buffer ) {
|
|
326 |
|
327 |
$buffer = wp_cache_get_ob( $buffer );
|
328 |
wp_cache_shutdown_callback();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
return $buffer;
|
330 |
} else {
|
331 |
if ( is_array( $do_rebuild_list ) && false == empty( $do_rebuild_list ) ) {
|
332 |
foreach( $do_rebuild_list as $dir => $n ) {
|
333 |
if ( wp_cache_confirm_delete( $dir ) ) {
|
334 |
wp_cache_debug( 'wp_cache_ob_callback clearing rebuilt files in ' . $dir );
|
335 |
-
|
336 |
-
foreach( $files_to_check as $cache_file ) {
|
337 |
-
$cache_file = $dir . $cache_file;
|
338 |
-
@unlink( $cache_file );
|
339 |
-
}
|
340 |
}
|
341 |
}
|
342 |
}
|
@@ -356,10 +485,17 @@ function wp_cache_append_tag( &$buffer ) {
|
|
356 |
|
357 |
$timestamp = gmdate('Y-m-d H:i:s', (time() + ( $wp_cache_gmt_offset * 3600)));
|
358 |
if ( $cache_enabled || $super_cache_enabled ) {
|
359 |
-
$
|
360 |
} else {
|
361 |
-
$
|
|
|
|
|
|
|
|
|
|
|
362 |
}
|
|
|
|
|
363 |
}
|
364 |
|
365 |
function wp_cache_add_to_buffer( &$buffer, $text ) {
|
@@ -371,6 +507,11 @@ function wp_cache_add_to_buffer( &$buffer, $text ) {
|
|
371 |
if ( $wp_super_cache_comments == 0 )
|
372 |
return false;
|
373 |
|
|
|
|
|
|
|
|
|
|
|
374 |
$buffer .= "\n<!-- $text -->";
|
375 |
}
|
376 |
|
@@ -390,11 +531,11 @@ function wp_cache_maybe_dynamic( &$buffer ) {
|
|
390 |
}
|
391 |
|
392 |
function wp_cache_get_ob(&$buffer) {
|
393 |
-
global $cache_enabled, $cache_path, $cache_filename, $
|
394 |
-
global $new_cache, $wp_cache_meta, $
|
395 |
-
global $wp_cache_gzip_encoding, $super_cache_enabled
|
396 |
global $wp_cache_404, $gzsize, $supercacheonly;
|
397 |
-
global $blog_cache_dir, $
|
398 |
global $wp_cache_not_logged_in, $wp_cache_object_cache, $cache_max_time;
|
399 |
global $wp_cache_is_home, $wp_cache_front_page_checks, $wp_cache_mfunc_enabled;
|
400 |
|
@@ -448,7 +589,7 @@ function wp_cache_get_ob(&$buffer) {
|
|
448 |
}
|
449 |
|
450 |
if ( $wp_cache_not_logged_in && is_feed() ) {
|
451 |
-
wp_cache_debug( "Feed detected. Writing
|
452 |
$wp_cache_not_logged_in = false;
|
453 |
}
|
454 |
|
@@ -504,6 +645,12 @@ function wp_cache_get_ob(&$buffer) {
|
|
504 |
|
505 |
if( @is_dir( $dir ) == false )
|
506 |
@wp_mkdir_p( $dir );
|
|
|
|
|
|
|
|
|
|
|
|
|
507 |
|
508 |
$fr = $fr2 = $gz = false;
|
509 |
// Open wp-cache cache file
|
@@ -567,9 +714,9 @@ function wp_cache_get_ob(&$buffer) {
|
|
567 |
if ( false == isset( $wp_super_cache_late_init ) || ( isset( $wp_super_cache_late_init ) && $wp_super_cache_late_init == 0 ) )
|
568 |
wp_cache_add_to_buffer( $buffer, 'Super Cache dynamic page detected but late init not set. See the readme.txt for further details.' );
|
569 |
|
570 |
-
if ( $fr ) { //
|
571 |
-
wp_cache_debug( "Writing dynamic buffer to
|
572 |
-
wp_cache_add_to_buffer( $buffer, "Dynamic
|
573 |
fputs( $fr, '<?php die(); ?>' . $buffer );
|
574 |
} elseif ( isset( $fr2 ) ) { // supercache active
|
575 |
wp_cache_debug( "Writing dynamic buffer to supercache file." );
|
@@ -632,16 +779,16 @@ function wp_cache_get_ob(&$buffer) {
|
|
632 |
$supercacheonly = false;
|
633 |
fclose($fr);
|
634 |
if ( filesize( $tmp_wpcache_filename ) == 0 ) {
|
635 |
-
wp_cache_debug( "Warning! The file $tmp_wpcache_filename was empty. Did not rename to {$
|
636 |
@unlink( $tmp_wpcache_filename );
|
637 |
} else {
|
638 |
-
if ( !@rename( $tmp_wpcache_filename, $
|
639 |
-
if ( false == is_dir( $
|
640 |
-
@wp_mkdir_p( $
|
641 |
-
@unlink( $
|
642 |
-
@rename( $tmp_wpcache_filename, $
|
643 |
}
|
644 |
-
wp_cache_debug( "Renamed temp wp-cache file to {$
|
645 |
$added_cache = 1;
|
646 |
}
|
647 |
}
|
@@ -700,7 +847,7 @@ function wp_cache_get_ob(&$buffer) {
|
|
700 |
}
|
701 |
|
702 |
function wp_cache_phase2_clean_cache($file_prefix) {
|
703 |
-
global $
|
704 |
|
705 |
if( !wp_cache_writers_entry() )
|
706 |
return false;
|
@@ -709,8 +856,8 @@ function wp_cache_phase2_clean_cache($file_prefix) {
|
|
709 |
while ( false !== ($file = @readdir($handle))) {
|
710 |
if ( strpos( $file, $file_prefix ) !== false ) {
|
711 |
if ( strpos( $file, '.html' ) ) {
|
712 |
-
// delete old
|
713 |
-
wp_cache_debug( "wp_cache_phase2_clean_cache: Deleting obsolete
|
714 |
@unlink( $blog_cache_dir . $file);
|
715 |
@unlink( $blog_cache_dir . 'meta/' . str_replace( '.html', '.meta', $file ) );
|
716 |
} else {
|
@@ -728,8 +875,25 @@ function wp_cache_phase2_clean_cache($file_prefix) {
|
|
728 |
}
|
729 |
|
730 |
function prune_super_cache( $directory, $force = false, $rename = false ) {
|
731 |
-
global $cache_max_time, $cache_path, $
|
732 |
static $log = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
733 |
|
734 |
if ( false == @file_exists( $directory ) ) {
|
735 |
wp_cache_debug( "prune_super_cache: exiting as file/dir does not exist: $directory" );
|
@@ -740,16 +904,10 @@ function prune_super_cache( $directory, $force = false, $rename = false ) {
|
|
740 |
|
741 |
$now = time();
|
742 |
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
$cache_path . $blog_cache_dir . "index.html",
|
747 |
-
$cache_path . $blog_cache_dir . 'meta',
|
748 |
-
$cache_path . $blog_cache_dir . 'meta/index.html',
|
749 |
-
$cache_path . 'supercache/index.html',
|
750 |
-
$cache_path . 'supercache' );
|
751 |
|
752 |
-
$oktodelete = false;
|
753 |
if (is_dir($directory)) {
|
754 |
if( $dh = @opendir( $directory ) ) {
|
755 |
$directory = trailingslashit( $directory );
|
@@ -812,20 +970,63 @@ function prune_super_cache( $directory, $force = false, $rename = false ) {
|
|
812 |
}
|
813 |
|
814 |
function wp_cache_rebuild_or_delete( $file ) {
|
815 |
-
global $cache_rebuild_files;
|
816 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
817 |
$file = substr( $file, 0, strpos( $file, '?' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
818 |
if( $cache_rebuild_files && substr( $file, -14 ) != '.needs-rebuild' ) {
|
819 |
if( @rename($file, $file . '.needs-rebuild') ) {
|
820 |
@touch( $file . '.needs-rebuild' );
|
821 |
wp_cache_debug( "rebuild_or_gc: rename file to {$file}.needs-rebuild", 2 );
|
822 |
} else {
|
823 |
@unlink( $file );
|
824 |
-
wp_cache_debug( "rebuild_or_gc: deleted $file", 2 );
|
825 |
}
|
826 |
} else {
|
827 |
-
@
|
828 |
-
|
|
|
|
|
|
|
829 |
}
|
830 |
}
|
831 |
|
@@ -844,7 +1045,7 @@ function wp_cache_phase2_clean_expired( $file_prefix, $force = false ) {
|
|
844 |
(@filemtime( $blog_cache_dir . $file) + $cache_max_time) <= $now ) {
|
845 |
@unlink( $blog_cache_dir . $file );
|
846 |
@unlink( $blog_cache_dir . 'meta/' . str_replace( '.html', '.meta', $file ) );
|
847 |
-
wp_cache_debug( "wp_cache_phase2_clean_expired: Deleting obsolete
|
848 |
continue;
|
849 |
}
|
850 |
if($file != '.' && $file != '..') {
|
@@ -868,21 +1069,24 @@ function wp_cache_phase2_clean_expired( $file_prefix, $force = false ) {
|
|
868 |
}
|
869 |
|
870 |
function wp_cache_shutdown_callback() {
|
871 |
-
global $
|
872 |
global $wp_cache_request_uri, $wp_cache_key, $wp_cache_object_cache, $cache_enabled, $wp_cache_blog_charset, $wp_cache_not_logged_in;
|
873 |
global $WPSC_HTTP_HOST;
|
874 |
|
|
|
|
|
|
|
|
|
|
|
875 |
$wp_cache_meta[ 'uri' ] = $WPSC_HTTP_HOST . preg_replace('/[ <>\'\"\r\n\t\(\)]/', '', $wp_cache_request_uri); // To avoid XSS attacks
|
876 |
$wp_cache_meta[ 'blog_id' ] = $blog_id;
|
877 |
$wp_cache_meta[ 'post' ] = wp_cache_post_id();
|
878 |
$wp_cache_meta[ 'key' ] = $wp_cache_key;
|
879 |
$wp_cache_meta = apply_filters( 'wp_cache_meta', $wp_cache_meta );
|
880 |
|
881 |
-
$
|
882 |
-
foreach
|
883 |
-
|
884 |
-
$wp_cache_meta[ 'headers' ][ $key ] = "$key: " . $response[$key];
|
885 |
-
}
|
886 |
}
|
887 |
|
888 |
wp_cache_debug( "wp_cache_shutdown_callback: collecting meta data.", 2 );
|
@@ -908,6 +1112,9 @@ function wp_cache_shutdown_callback() {
|
|
908 |
case 'rdf':
|
909 |
$value = "application/rdf+xml";
|
910 |
break;
|
|
|
|
|
|
|
911 |
case 'rss':
|
912 |
case 'rss2':
|
913 |
default:
|
@@ -933,24 +1140,26 @@ function wp_cache_shutdown_callback() {
|
|
933 |
}
|
934 |
|
935 |
$serial = '<?php die(); ?>' . json_encode( $wp_cache_meta );
|
|
|
|
|
|
|
|
|
936 |
if( wp_cache_writers_entry() ) {
|
937 |
-
wp_cache_debug( "Writing meta file: {$
|
938 |
if ( false == $wp_cache_object_cache ) {
|
939 |
-
$tmp_meta_filename = $
|
940 |
-
$
|
941 |
-
if( !$fr )
|
942 |
-
@wp_mkdir_p( $blog_cache_dir . 'meta' );
|
943 |
$fr = @fopen( $tmp_meta_filename, 'w');
|
944 |
if ( $fr ) {
|
945 |
fputs($fr, $serial);
|
946 |
fclose($fr);
|
947 |
@chmod( $tmp_meta_filename, 0666 & ~umask());
|
948 |
-
if( !@rename( $tmp_meta_filename, $
|
949 |
-
@unlink( $
|
950 |
-
@rename( $tmp_meta_filename, $
|
951 |
}
|
952 |
} else {
|
953 |
-
wp_cache_debug( "Problem writing meta file: {$
|
954 |
}
|
955 |
} elseif ( $cache_enabled ) {
|
956 |
$oc_key = get_oc_key() . ".meta";
|
@@ -961,7 +1170,7 @@ function wp_cache_shutdown_callback() {
|
|
961 |
wp_cache_writers_exit();
|
962 |
}
|
963 |
} else {
|
964 |
-
wp_cache_debug( "Did not write meta file: $meta_file *$supercacheonly* *$wp_cache_not_logged_in* *$new_cache*", 2 );
|
965 |
}
|
966 |
global $time_to_gc_cache;
|
967 |
if( isset( $time_to_gc_cache ) && $time_to_gc_cache == 1 ) {
|
@@ -1001,7 +1210,7 @@ function wp_cache_get_postid_from_comment( $comment_id, $status = 'NA' ) {
|
|
1001 |
define( 'DONOTDELETECACHE', 1 );
|
1002 |
return $postid;
|
1003 |
} elseif( $comment['comment_approved'] == '0' ) {
|
1004 |
-
if ( $comment[ '
|
1005 |
wp_cache_debug( "Moderated comment. Don't delete supercache file until comment approved.", 4 );
|
1006 |
$super_cache_enabled = 0; // don't remove the super cache static file until comment is approved
|
1007 |
define( 'DONOTDELETECACHE', 1 );
|
@@ -1102,7 +1311,7 @@ function wp_cache_post_edit($post_id) {
|
|
1102 |
|
1103 |
// Some users are inexplicibly seeing this error on scheduled posts.
|
1104 |
// define this constant to disable the post status check.
|
1105 |
-
if ( false == defined( 'WPSCFORCEUPDATE' ) && $post->post_status
|
1106 |
wp_cache_debug( "wp_cache_post_edit: draft post, not deleting any cache files. status: " . $post->post_status, 4 );
|
1107 |
return $post_id;
|
1108 |
}
|
@@ -1123,8 +1332,8 @@ function wp_cache_post_edit($post_id) {
|
|
1123 |
}
|
1124 |
}
|
1125 |
|
1126 |
-
function wp_cache_post_id_gc( $
|
1127 |
-
global $
|
1128 |
|
1129 |
if ( $wp_cache_object_cache )
|
1130 |
reset_oc_version();
|
@@ -1140,8 +1349,8 @@ function wp_cache_post_id_gc( $siteurl, $post_id, $all = 'all' ) {
|
|
1140 |
prune_super_cache( $dir, true, true );
|
1141 |
do_action( 'gc_cache', 'prune', $permalink );
|
1142 |
@rmdir( $dir );
|
1143 |
-
wp_cache_debug( "wp_cache_post_id_gc clearing cache in {$supercache_home}page/." );
|
1144 |
$supercache_home = get_supercache_dir();
|
|
|
1145 |
prune_super_cache( $supercache_home . 'page/', true );
|
1146 |
do_action( 'gc_cache', 'prune', 'page/' );
|
1147 |
} else {
|
@@ -1152,7 +1361,7 @@ function wp_cache_post_id_gc( $siteurl, $post_id, $all = 'all' ) {
|
|
1152 |
}
|
1153 |
|
1154 |
function wp_cache_post_change( $post_id ) {
|
1155 |
-
global $file_prefix, $cache_path, $blog_id, $super_cache_enabled, $blog_cache_dir, $
|
1156 |
static $last_processed = -1;
|
1157 |
|
1158 |
if ( $post_id == $last_processed ) {
|
@@ -1162,7 +1371,7 @@ function wp_cache_post_change( $post_id ) {
|
|
1162 |
$post = get_post( $post_id );
|
1163 |
// Some users are inexplicibly seeing this error on scheduled posts.
|
1164 |
// define this constant to disable the post status check.
|
1165 |
-
if ( false == defined( 'WPSCFORCEUPDATE' ) && is_object( $post ) && $post->post_status
|
1166 |
wp_cache_debug( "wp_cache_post_change: draft post, not deleting any cache files.", 4 );
|
1167 |
return $post_id;
|
1168 |
}
|
@@ -1191,20 +1400,13 @@ function wp_cache_post_change( $post_id ) {
|
|
1191 |
if ( $wp_cache_object_cache )
|
1192 |
reset_oc_version();
|
1193 |
|
1194 |
-
$permalink = trailingslashit( str_replace( get_option( 'siteurl' ), '', get_permalink( $post_id ) ) );
|
1195 |
-
|
1196 |
// Delete supercache files whenever a post change event occurs, even if supercache is currently disabled.
|
1197 |
$dir = get_supercache_dir();
|
1198 |
-
$siteurl = trailingslashit( strtolower( preg_replace( '/:.*$/', '', str_replace( 'https://', '', str_replace( 'http://', '', get_option( 'home' ) ) ) ) ) );
|
1199 |
// make sure the front page has a rebuild file
|
1200 |
-
wp_cache_post_id_gc( $
|
1201 |
if ( $all == true ) {
|
1202 |
-
wp_cache_debug( "Post change: supercache enabled: deleting cache files in " . $
|
1203 |
-
|
1204 |
-
foreach( $files_to_check as $cache_file ) {
|
1205 |
-
wp_cache_debug( "Post change: deleting cache file: " . $dir . $cache_file, 4 );
|
1206 |
-
prune_super_cache( $dir . $cache_file, true, true );
|
1207 |
-
}
|
1208 |
do_action( 'gc_cache', 'prune', 'homepage' );
|
1209 |
} else {
|
1210 |
wp_cache_debug( "wp_cache_post_change: not deleting all pages.", 4 );
|
@@ -1213,10 +1415,8 @@ function wp_cache_post_change( $post_id ) {
|
|
1213 |
wp_cache_debug( "Post change: deleting page_on_front and page_for_posts pages.", 4 );
|
1214 |
wp_cache_debug( "Post change: page_on_front " . get_option( 'page_on_front' ), 4 );
|
1215 |
$permalink = trailingslashit( str_replace( get_option( 'home' ), '', get_permalink( get_option( 'page_for_posts' ) ) ) );
|
1216 |
-
|
1217 |
-
|
1218 |
-
prune_super_cache( $dir . $permalink . $cache_file, true, true );
|
1219 |
-
}
|
1220 |
do_action( 'gc_cache', 'prune', $permalink );
|
1221 |
} else {
|
1222 |
wp_cache_debug( "wp_cache_post_change: not deleting front static page.", 4 );
|
@@ -1228,8 +1428,8 @@ function wp_cache_post_change( $post_id ) {
|
|
1228 |
while ( false !== ($file = readdir($handle))) {
|
1229 |
if ( strpos( $file, $file_prefix ) !== false ) {
|
1230 |
if ( strpos( $file, '.html' ) ) {
|
1231 |
-
// delete old
|
1232 |
-
wp_cache_debug( "wp_cache_post_change: Deleting obsolete
|
1233 |
@unlink( $blog_cache_dir . $file);
|
1234 |
@unlink( $blog_cache_dir . 'meta/' . str_replace( '.html', '.meta', $file ) );
|
1235 |
continue;
|
@@ -1248,11 +1448,8 @@ function wp_cache_post_change( $post_id ) {
|
|
1248 |
@unlink( $blog_cache_dir . 'meta/' . $file );
|
1249 |
@unlink( $blog_cache_dir . $file );
|
1250 |
if ( false == $supercache_files_deleted && $super_cache_enabled == true ) {
|
1251 |
-
|
1252 |
-
|
1253 |
-
foreach( $files_to_check as $cache_file ) {
|
1254 |
-
@wp_cache_rebuild_or_delete( $dir . trailingslashit( $permalink ) . $cache_file );
|
1255 |
-
}
|
1256 |
$supercache_files_deleted = true;
|
1257 |
do_action( 'gc_cache', 'rebuild', $permalink );
|
1258 |
}
|
@@ -1262,11 +1459,8 @@ function wp_cache_post_change( $post_id ) {
|
|
1262 |
@unlink( $blog_cache_dir . 'meta/' . $file );
|
1263 |
@unlink( $blog_cache_dir . $file );
|
1264 |
if ( $super_cache_enabled == true ) {
|
1265 |
-
|
1266 |
-
|
1267 |
-
foreach( $files_to_check as $cache_file ) {
|
1268 |
-
@wp_cache_rebuild_or_delete( $dir . trailingslashit( $meta[ 'uri' ] ) . $cache_file );
|
1269 |
-
}
|
1270 |
do_action( 'gc_cache', 'rebuild', trailingslashit( $meta[ 'uri' ] ) );
|
1271 |
}
|
1272 |
}
|
@@ -1282,7 +1476,7 @@ function wp_cache_post_change( $post_id ) {
|
|
1282 |
function wp_cache_microtime_diff($a, $b) {
|
1283 |
list($a_dec, $a_sec) = explode(' ', $a);
|
1284 |
list($b_dec, $b_sec) = explode(' ', $b);
|
1285 |
-
return $b_sec - $a_sec + $b_dec - $a_dec;
|
1286 |
}
|
1287 |
|
1288 |
function wp_cache_post_id() {
|
1 |
<?php
|
2 |
|
3 |
function wp_cache_phase2() {
|
4 |
+
global $wp_cache_gzip_encoding, $super_cache_enabled, $cache_rebuild_files, $cache_enabled, $wp_cache_gmt_offset, $wp_cache_blog_charset;
|
|
|
|
|
5 |
|
6 |
if ( $cache_enabled == false ) {
|
7 |
wp_cache_debug( "Caching disabled! quiting!", 1 );
|
62 |
wp_cache_debug( 'Created output buffer', 4 );
|
63 |
|
64 |
// restore old supercache file temporarily
|
65 |
+
if ( ( $_SERVER["REQUEST_METHOD"] != 'POST' && empty( $_POST ) ) && $super_cache_enabled && $cache_rebuild_files ) {
|
66 |
$user_info = wp_cache_get_cookies_values();
|
67 |
$do_cache = apply_filters( 'do_createsupercache', $user_info );
|
68 |
if( $user_info == '' || $do_cache === true )
|
73 |
}
|
74 |
|
75 |
function wpcache_do_rebuild( $dir ) {
|
76 |
+
global $do_rebuild_list, $cache_path, $wpsc_file_mtimes;
|
77 |
+
wp_cache_debug( "wpcache_do_rebuild: doing rebuild for $dir" );
|
78 |
+
|
79 |
+
if ( !is_dir( $dir ) ) {
|
80 |
+
wp_cache_debug( "wpcache_do_rebuild: exiting as directory is not a directory: $dir" );
|
81 |
+
return false;
|
82 |
+
}
|
83 |
+
|
84 |
+
$dir = trailingslashit( realpath( $dir ) );
|
85 |
+
|
86 |
+
if ( isset( $do_rebuild_list[ $dir ] ) ) {
|
87 |
+
wp_cache_debug( "wpcache_do_rebuild: directory already rebuilt: $dir" );
|
88 |
+
return false;
|
89 |
+
}
|
90 |
+
|
91 |
+
$protected = wpsc_get_protected_directories();
|
92 |
+
foreach( $protected as $id => $directory ) {
|
93 |
+
$protected[ $id ] = trailingslashit( realpath( $directory ) );
|
94 |
+
}
|
95 |
+
$rp_cache_path = trailingslashit( realpath( $cache_path ) );
|
96 |
+
|
97 |
+
if ( substr( $dir, 0, strlen( $rp_cache_path ) ) != $rp_cache_path ) {
|
98 |
+
wp_cache_debug( "wpcache_do_rebuild: exiting as directory not in cache_path: $dir" );
|
99 |
+
return false;
|
100 |
+
}
|
101 |
+
|
102 |
+
if ( in_array( $dir, $protected ) ) {
|
103 |
+
wp_cache_debug( "wpcache_do_rebuild: exiting as directory is protected: $dir" );
|
104 |
return false;
|
105 |
+
}
|
106 |
+
|
107 |
+
if ( !is_dir( $dir ) ) {
|
108 |
+
wp_cache_debug( "wpcache_do_rebuild: exiting as directory is not a directory: $dir" );
|
109 |
+
return false;
|
110 |
+
}
|
111 |
+
|
112 |
+
$dh = @opendir( $dir );
|
113 |
+
if ( false == $dh ) {
|
114 |
+
wp_cache_debug( "wpcache_do_rebuild: exiting as could not open directory for reading: $dir" );
|
115 |
+
return false;
|
116 |
+
}
|
117 |
+
|
118 |
+
$wpsc_file_mtimes = array();
|
119 |
+
while ( ( $file = readdir( $dh ) ) !== false ) {
|
120 |
+
if ( $file == '.' || $file == '..' || false == is_file( $dir . $file ) ) {
|
121 |
+
continue;
|
122 |
+
}
|
123 |
+
|
124 |
+
$cache_file = $dir . $file;
|
125 |
+
// if the file is index.html.needs-rebuild and index.html doesn't exist and
|
126 |
+
// if the rebuild file is less than 10 seconds old then remove the ".needs-rebuild"
|
127 |
+
// extension so index.html can be served to other visitors temporarily
|
128 |
+
// until index.html is generated again at the end of this page.
|
129 |
+
|
130 |
+
if ( substr( $cache_file, -14 ) != '.needs-rebuild' ) {
|
131 |
+
wp_cache_debug( "wpcache_do_rebuild: base file found: $cache_file" );
|
132 |
+
continue;
|
133 |
+
}
|
134 |
+
|
135 |
+
wp_cache_debug( "wpcache_do_rebuild: found rebuild file: $cache_file" );
|
136 |
+
|
137 |
+
if ( @file_exists( substr( $cache_file, 0, -14 ) ) ) {
|
138 |
+
wp_cache_debug( "wpcache_do_rebuild: rebuild file deleted because base file found: $cache_file" );
|
139 |
+
@unlink( $cache_file ); // delete the rebuild file because index.html already exists
|
140 |
continue;
|
|
|
|
|
|
|
|
|
141 |
}
|
142 |
+
|
143 |
+
$mtime = @filemtime( $cache_file );
|
144 |
+
if ( $mtime && ( time() - $mtime ) < 10 ) {
|
145 |
+
wp_cache_debug( "wpcache_do_rebuild: rebuild file is new: $cache_file" );
|
146 |
+
$base_file = substr( $cache_file, 0, -14 );
|
147 |
+
if ( false == @rename( $cache_file, $base_file ) ) { // rename the rebuild file
|
148 |
+
@unlink( $cache_file );
|
149 |
+
wp_cache_debug( "wpcache_do_rebuild: rebuild file rename failed. Deleted rebuild file: $cache_file" );
|
150 |
+
} else {
|
151 |
+
$do_rebuild_list[ $dir ] = 1;
|
152 |
+
$wpsc_file_mtimes[ $base_file ] = $mtime;
|
153 |
+
wp_cache_debug( "wpcache_do_rebuild: rebuild file renamed: $base_file" );
|
154 |
+
}
|
155 |
+
} else {
|
156 |
+
wp_cache_debug( "wpcache_do_rebuild: rebuild file deleted because it's too old: $cache_file" );
|
157 |
+
@unlink( $cache_file ); // delete the rebuild file because index.html already exists
|
158 |
}
|
159 |
}
|
160 |
}
|
181 |
}
|
182 |
|
183 |
function wp_cache_get_response_headers() {
|
184 |
+
static $known_headers = array(
|
185 |
+
'Access-Control-Allow-Origin',
|
186 |
+
'Accept-Ranges',
|
187 |
+
'Age',
|
188 |
+
'Allow',
|
189 |
+
'Cache-Control',
|
190 |
+
'Connection',
|
191 |
+
'Content-Encoding',
|
192 |
+
'Content-Language',
|
193 |
+
'Content-Length',
|
194 |
+
'Content-Location',
|
195 |
+
'Content-MD5',
|
196 |
+
'Content-Disposition',
|
197 |
+
'Content-Range',
|
198 |
+
'Content-Type',
|
199 |
+
'Date',
|
200 |
+
'ETag',
|
201 |
+
'Expires',
|
202 |
+
'Last-Modified',
|
203 |
+
'Link',
|
204 |
+
'Location',
|
205 |
+
'P3P',
|
206 |
+
'Pragma',
|
207 |
+
'Proxy-Authenticate',
|
208 |
+
"Referrer-Policy",
|
209 |
+
'Refresh',
|
210 |
+
'Retry-After',
|
211 |
+
'Server',
|
212 |
+
'Status',
|
213 |
+
'Strict-Transport-Security',
|
214 |
+
'Trailer',
|
215 |
+
'Transfer-Encoding',
|
216 |
+
'Upgrade',
|
217 |
+
'Vary',
|
218 |
+
'Via',
|
219 |
+
'Warning',
|
220 |
+
'WWW-Authenticate',
|
221 |
+
'X-Frame-Options',
|
222 |
+
'Public-Key-Pins',
|
223 |
+
'X-XSS-Protection',
|
224 |
+
'Content-Security-Policy',
|
225 |
+
"X-Pingback",
|
226 |
+
'X-Content-Security-Policy',
|
227 |
+
'X-WebKit-CSP',
|
228 |
+
'X-Content-Type-Options',
|
229 |
+
'X-Powered-By',
|
230 |
+
'X-UA-Compatible',
|
231 |
+
);
|
232 |
+
|
233 |
+
$known_headers = apply_filters( 'wpsc_known_headers', $known_headers );
|
234 |
+
|
235 |
+
if ( ! isset( $known_headers[ 'age' ] ) ) {
|
236 |
+
$known_headers = array_map( 'mb_strtolower', $known_headers );
|
237 |
+
}
|
238 |
+
|
239 |
+
$headers = array();
|
240 |
+
if ( function_exists( 'apache_response_headers' ) ) {
|
241 |
$headers = apache_response_headers();
|
242 |
+
}
|
243 |
+
if ( empty( $headers ) && function_exists( 'headers_list' ) ) {
|
|
|
|
|
|
|
244 |
$headers = array();
|
245 |
+
foreach( headers_list() as $hdr ) {
|
246 |
$header_parts = explode( ':', $hdr, 2 );
|
247 |
$header_name = isset( $header_parts[0] ) ? trim( $header_parts[0] ) : '';
|
248 |
$header_value = isset( $header_parts[1] ) ? trim( $header_parts[1] ) : '';
|
249 |
|
250 |
$headers[$header_name] = $header_value;
|
251 |
}
|
252 |
+
}
|
253 |
+
|
254 |
+
foreach( $headers as $key => $value ) {
|
255 |
+
if ( ! in_array( mb_strtolower( $key ), $known_headers ) ) {
|
256 |
+
unset( $headers[ $key ] );
|
257 |
+
}
|
258 |
+
}
|
259 |
|
260 |
return $headers;
|
261 |
}
|
370 |
}
|
371 |
|
372 |
function wp_cache_ob_callback( $buffer ) {
|
373 |
+
global $wp_cache_pages, $wp_query, $wp_super_cache_query, $cache_acceptable_files, $wp_cache_no_cache_for_get, $wp_cache_object_cache, $wp_cache_request_uri, $do_rebuild_list, $wpsc_file_mtimes, $wpsc_save_headers, $super_cache_enabled;
|
374 |
$buffer = apply_filters( 'wp_cache_ob_callback_filter', $buffer );
|
375 |
|
376 |
$script = basename($_SERVER['PHP_SELF']);
|
436 |
$cache_this_page = false;
|
437 |
}
|
438 |
|
439 |
+
if ( isset( $wpsc_save_headers ) && $wpsc_save_headers )
|
440 |
+
$super_cache_enabled = false; // use standard caching to record headers
|
441 |
+
|
442 |
if ( !isset( $wp_query ) )
|
443 |
wp_cache_debug( 'wp_cache_ob_callback: WARNING! $query not defined but the plugin has worked around that problem.', 4 );
|
444 |
|
448 |
|
449 |
$buffer = wp_cache_get_ob( $buffer );
|
450 |
wp_cache_shutdown_callback();
|
451 |
+
|
452 |
+
if ( isset( $wpsc_file_mtimes ) && is_array( $wpsc_file_mtimes ) && !empty( $wpsc_file_mtimes ) ) {
|
453 |
+
foreach( $wpsc_file_mtimes as $cache_file => $old_mtime ) {
|
454 |
+
if ( $old_mtime == @filemtime( $cache_file ) ) {
|
455 |
+
wp_cache_debug( "wp_cache_ob_callback deleting unmodified rebuilt cache file: $cache_file" );
|
456 |
+
if ( wp_cache_confirm_delete( $cache_file ) ) {
|
457 |
+
@unlink( $cache_file );
|
458 |
+
}
|
459 |
+
}
|
460 |
+
}
|
461 |
+
}
|
462 |
return $buffer;
|
463 |
} else {
|
464 |
if ( is_array( $do_rebuild_list ) && false == empty( $do_rebuild_list ) ) {
|
465 |
foreach( $do_rebuild_list as $dir => $n ) {
|
466 |
if ( wp_cache_confirm_delete( $dir ) ) {
|
467 |
wp_cache_debug( 'wp_cache_ob_callback clearing rebuilt files in ' . $dir );
|
468 |
+
wpsc_delete_files( $dir );
|
|
|
|
|
|
|
|
|
469 |
}
|
470 |
}
|
471 |
}
|
485 |
|
486 |
$timestamp = gmdate('Y-m-d H:i:s', (time() + ( $wp_cache_gmt_offset * 3600)));
|
487 |
if ( $cache_enabled || $super_cache_enabled ) {
|
488 |
+
$msg = "\n<!-- Cached page generated by WP-Super-Cache on $timestamp -->\n";
|
489 |
} else {
|
490 |
+
$msg = "\n<!-- Live page served on $timestamp -->\n";
|
491 |
+
}
|
492 |
+
|
493 |
+
if ( strpos( $buffer, '<html' ) === false ) {
|
494 |
+
wp_cache_debug( site_url( $_SERVER[ 'REQUEST_URI' ] ) . " - " . $msg );
|
495 |
+
return false;
|
496 |
}
|
497 |
+
|
498 |
+
$buffer .= $msg;
|
499 |
}
|
500 |
|
501 |
function wp_cache_add_to_buffer( &$buffer, $text ) {
|
507 |
if ( $wp_super_cache_comments == 0 )
|
508 |
return false;
|
509 |
|
510 |
+
if ( strpos( $buffer, '<html' ) === false ) {
|
511 |
+
wp_cache_debug( site_url( $_SERVER[ 'REQUEST_URI' ] ) . " - " . $text );
|
512 |
+
return false;
|
513 |
+
}
|
514 |
+
|
515 |
$buffer .= "\n<!-- $text -->";
|
516 |
}
|
517 |
|
531 |
}
|
532 |
|
533 |
function wp_cache_get_ob(&$buffer) {
|
534 |
+
global $cache_enabled, $cache_path, $cache_filename, $wp_start_time, $supercachedir;
|
535 |
+
global $new_cache, $wp_cache_meta, $cache_compression;
|
536 |
+
global $wp_cache_gzip_encoding, $super_cache_enabled;
|
537 |
global $wp_cache_404, $gzsize, $supercacheonly;
|
538 |
+
global $blog_cache_dir, $wp_supercache_cache_list;
|
539 |
global $wp_cache_not_logged_in, $wp_cache_object_cache, $cache_max_time;
|
540 |
global $wp_cache_is_home, $wp_cache_front_page_checks, $wp_cache_mfunc_enabled;
|
541 |
|
589 |
}
|
590 |
|
591 |
if ( $wp_cache_not_logged_in && is_feed() ) {
|
592 |
+
wp_cache_debug( "Feed detected. Writing wpcache cache files.", 5 );
|
593 |
$wp_cache_not_logged_in = false;
|
594 |
}
|
595 |
|
645 |
|
646 |
if( @is_dir( $dir ) == false )
|
647 |
@wp_mkdir_p( $dir );
|
648 |
+
$dir = realpath( $dir ) . '/';
|
649 |
+
$rp_cache_path = realpath( $cache_path );
|
650 |
+
if ( substr( $dir, 0, strlen( $rp_cache_path ) ) != $rp_cache_path ) {
|
651 |
+
wp_cache_debug( "wp_cache_get_ob: not caching as directory is not in cache_path: $dir" );
|
652 |
+
return $buffer;
|
653 |
+
}
|
654 |
|
655 |
$fr = $fr2 = $gz = false;
|
656 |
// Open wp-cache cache file
|
714 |
if ( false == isset( $wp_super_cache_late_init ) || ( isset( $wp_super_cache_late_init ) && $wp_super_cache_late_init == 0 ) )
|
715 |
wp_cache_add_to_buffer( $buffer, 'Super Cache dynamic page detected but late init not set. See the readme.txt for further details.' );
|
716 |
|
717 |
+
if ( $fr ) { // wpcache caching
|
718 |
+
wp_cache_debug( "Writing dynamic buffer to wpcache file." );
|
719 |
+
wp_cache_add_to_buffer( $buffer, "Dynamic WPCache Super Cache" );
|
720 |
fputs( $fr, '<?php die(); ?>' . $buffer );
|
721 |
} elseif ( isset( $fr2 ) ) { // supercache active
|
722 |
wp_cache_debug( "Writing dynamic buffer to supercache file." );
|
779 |
$supercacheonly = false;
|
780 |
fclose($fr);
|
781 |
if ( filesize( $tmp_wpcache_filename ) == 0 ) {
|
782 |
+
wp_cache_debug( "Warning! The file $tmp_wpcache_filename was empty. Did not rename to {$dir}/{$cache_filename}", 5 );
|
783 |
@unlink( $tmp_wpcache_filename );
|
784 |
} else {
|
785 |
+
if ( !@rename( $tmp_wpcache_filename, $dir . '/' . $cache_filename ) ) {
|
786 |
+
if ( false == is_dir( $dir ) )
|
787 |
+
@wp_mkdir_p( $dir );
|
788 |
+
@unlink( $dir . $cache_filename );
|
789 |
+
@rename( $tmp_wpcache_filename, $dir . '/' . $cache_filename );
|
790 |
}
|
791 |
+
wp_cache_debug( "Renamed temp wp-cache file to {$dir}/$cache_filename", 5 );
|
792 |
$added_cache = 1;
|
793 |
}
|
794 |
}
|
847 |
}
|
848 |
|
849 |
function wp_cache_phase2_clean_cache($file_prefix) {
|
850 |
+
global $wpdb, $blog_cache_dir;
|
851 |
|
852 |
if( !wp_cache_writers_entry() )
|
853 |
return false;
|
856 |
while ( false !== ($file = @readdir($handle))) {
|
857 |
if ( strpos( $file, $file_prefix ) !== false ) {
|
858 |
if ( strpos( $file, '.html' ) ) {
|
859 |
+
// delete old wpcache files immediately
|
860 |
+
wp_cache_debug( "wp_cache_phase2_clean_cache: Deleting obsolete wpcache cache+meta files: $file" );
|
861 |
@unlink( $blog_cache_dir . $file);
|
862 |
@unlink( $blog_cache_dir . 'meta/' . str_replace( '.html', '.meta', $file ) );
|
863 |
} else {
|
875 |
}
|
876 |
|
877 |
function prune_super_cache( $directory, $force = false, $rename = false ) {
|
878 |
+
global $cache_max_time, $cache_path, $blog_cache_dir;
|
879 |
static $log = 0;
|
880 |
+
static $rp_cache_path = '';
|
881 |
+
static $protected_directories = '';
|
882 |
+
|
883 |
+
if ( $rp_cache_path == '' ) {
|
884 |
+
$rp_cache_path = trailingslashit( realpath( $cache_path ) );
|
885 |
+
}
|
886 |
+
|
887 |
+
$dir = $directory;
|
888 |
+
$directory = realpath( $directory );
|
889 |
+
if ( $directory == '' ) {
|
890 |
+
wp_cache_debug( "prune_super_cache: exiting as file/directory does not exist : $dir" );
|
891 |
+
return false;
|
892 |
+
}
|
893 |
+
if ( substr( $directory, 0, strlen( $rp_cache_path ) ) != $rp_cache_path ) {
|
894 |
+
wp_cache_debug( "prune_super_cache: exiting as directory is not in cache path: *$directory* (was $dir before realpath)" );
|
895 |
+
return false;
|
896 |
+
}
|
897 |
|
898 |
if ( false == @file_exists( $directory ) ) {
|
899 |
wp_cache_debug( "prune_super_cache: exiting as file/dir does not exist: $directory" );
|
904 |
|
905 |
$now = time();
|
906 |
|
907 |
+
if ( $protected_directories == '' ) {
|
908 |
+
$protected_directories = wpsc_get_protected_directories();
|
909 |
+
}
|
|
|
|
|
|
|
|
|
|
|
910 |
|
|
|
911 |
if (is_dir($directory)) {
|
912 |
if( $dh = @opendir( $directory ) ) {
|
913 |
$directory = trailingslashit( $directory );
|
970 |
}
|
971 |
|
972 |
function wp_cache_rebuild_or_delete( $file ) {
|
973 |
+
global $cache_rebuild_files, $cache_path, $file_prefix;
|
974 |
+
static $rp_cache_path = '';
|
975 |
+
|
976 |
+
if ( $rp_cache_path == '' ) {
|
977 |
+
$rp_cache_path = trailingslashit( realpath( $cache_path ) );
|
978 |
+
}
|
979 |
+
|
980 |
+
if ( strpos( $file, '?' ) !== false )
|
981 |
$file = substr( $file, 0, strpos( $file, '?' ) );
|
982 |
+
|
983 |
+
$file = realpath( $file );
|
984 |
+
|
985 |
+
if ( substr( $file, 0, strlen( $rp_cache_path ) ) != $rp_cache_path ) {
|
986 |
+
wp_cache_debug( "rebuild_or_gc quitting because file is not in cache_path: $file" );
|
987 |
+
return false;
|
988 |
+
}
|
989 |
+
|
990 |
+
$protected = wpsc_get_protected_directories();
|
991 |
+
foreach( $protected as $id => $directory ) {
|
992 |
+
$protected[ $id ] = trailingslashit( realpath( $directory ) );
|
993 |
+
}
|
994 |
+
|
995 |
+
if ( in_array( $file, $protected ) ) {
|
996 |
+
wp_cache_debug( "rebuild_or_gc: file is protected: $file" );
|
997 |
+
return false;
|
998 |
+
}
|
999 |
+
|
1000 |
+
if ( substr( basename( $file ), 0, mb_strlen( $file_prefix ) ) == $file_prefix ) {
|
1001 |
+
@unlink( $file );
|
1002 |
+
wp_cache_debug( "rebuild_or_gc: deleted non-anonymous file: $file" );
|
1003 |
+
return false;
|
1004 |
+
}
|
1005 |
+
|
1006 |
+
if ( substr( basename( $file ), 0, 5 + mb_strlen( $file_prefix ) ) == 'meta-' . $file_prefix ) {
|
1007 |
+
@unlink( $file );
|
1008 |
+
wp_cache_debug( "rebuild_or_gc: deleted meta file: $file" );
|
1009 |
+
return false;
|
1010 |
+
}
|
1011 |
+
|
1012 |
+
if ( false == @file_exists( $file ) ) {
|
1013 |
+
wp_cache_debug( "rebuild_or_gc: file has disappeared: $file" );
|
1014 |
+
return false;
|
1015 |
+
}
|
1016 |
if( $cache_rebuild_files && substr( $file, -14 ) != '.needs-rebuild' ) {
|
1017 |
if( @rename($file, $file . '.needs-rebuild') ) {
|
1018 |
@touch( $file . '.needs-rebuild' );
|
1019 |
wp_cache_debug( "rebuild_or_gc: rename file to {$file}.needs-rebuild", 2 );
|
1020 |
} else {
|
1021 |
@unlink( $file );
|
1022 |
+
wp_cache_debug( "rebuild_or_gc: rename failed. deleted $file", 2 );
|
1023 |
}
|
1024 |
} else {
|
1025 |
+
$mtime = @filemtime( $file );
|
1026 |
+
if ( $mtime && ( time() - $mtime ) > 10 ) {
|
1027 |
+
@unlink( $file );
|
1028 |
+
wp_cache_debug( "rebuild_or_gc: rebuild file found. deleted because it was too old: $file", 2 );
|
1029 |
+
}
|
1030 |
}
|
1031 |
}
|
1032 |
|
1045 |
(@filemtime( $blog_cache_dir . $file) + $cache_max_time) <= $now ) {
|
1046 |
@unlink( $blog_cache_dir . $file );
|
1047 |
@unlink( $blog_cache_dir . 'meta/' . str_replace( '.html', '.meta', $file ) );
|
1048 |
+
wp_cache_debug( "wp_cache_phase2_clean_expired: Deleting obsolete wpcache cache+meta files: $file" );
|
1049 |
continue;
|
1050 |
}
|
1051 |
if($file != '.' && $file != '..') {
|
1069 |
}
|
1070 |
|
1071 |
function wp_cache_shutdown_callback() {
|
1072 |
+
global $cache_max_time, $meta_file, $new_cache, $wp_cache_meta, $known_headers, $blog_id, $wp_cache_gzip_encoding, $supercacheonly, $blog_cache_dir;
|
1073 |
global $wp_cache_request_uri, $wp_cache_key, $wp_cache_object_cache, $cache_enabled, $wp_cache_blog_charset, $wp_cache_not_logged_in;
|
1074 |
global $WPSC_HTTP_HOST;
|
1075 |
|
1076 |
+
if ( false == $new_cache ) {
|
1077 |
+
wp_cache_debug( "wp_cache_shutdown_callback: No cache file created. Returning." );
|
1078 |
+
return false;
|
1079 |
+
}
|
1080 |
+
|
1081 |
$wp_cache_meta[ 'uri' ] = $WPSC_HTTP_HOST . preg_replace('/[ <>\'\"\r\n\t\(\)]/', '', $wp_cache_request_uri); // To avoid XSS attacks
|
1082 |
$wp_cache_meta[ 'blog_id' ] = $blog_id;
|
1083 |
$wp_cache_meta[ 'post' ] = wp_cache_post_id();
|
1084 |
$wp_cache_meta[ 'key' ] = $wp_cache_key;
|
1085 |
$wp_cache_meta = apply_filters( 'wp_cache_meta', $wp_cache_meta );
|
1086 |
|
1087 |
+
$headers = wp_cache_get_response_headers();
|
1088 |
+
foreach( $headers as $key => $value ) {
|
1089 |
+
$wp_cache_meta[ 'headers' ][ $key ] = "$key: $value";
|
|
|
|
|
1090 |
}
|
1091 |
|
1092 |
wp_cache_debug( "wp_cache_shutdown_callback: collecting meta data.", 2 );
|
1112 |
case 'rdf':
|
1113 |
$value = "application/rdf+xml";
|
1114 |
break;
|
1115 |
+
case ( 'sitemap' || 'sitemap_n' ):
|
1116 |
+
$value = "text/xml";
|
1117 |
+
break;
|
1118 |
case 'rss':
|
1119 |
case 'rss2':
|
1120 |
default:
|
1140 |
}
|
1141 |
|
1142 |
$serial = '<?php die(); ?>' . json_encode( $wp_cache_meta );
|
1143 |
+
$dir = get_current_url_supercache_dir();
|
1144 |
+
if( @is_dir( $dir ) == false )
|
1145 |
+
@wp_mkdir_p( $dir );
|
1146 |
+
|
1147 |
if( wp_cache_writers_entry() ) {
|
1148 |
+
wp_cache_debug( "Writing meta file: {$dir}meta-{$meta_file}", 2 );
|
1149 |
if ( false == $wp_cache_object_cache ) {
|
1150 |
+
$tmp_meta_filename = $dir . uniqid( mt_rand(), true ) . '.tmp';
|
1151 |
+
$final_meta_filename = $dir . "meta-" . $meta_file;
|
|
|
|
|
1152 |
$fr = @fopen( $tmp_meta_filename, 'w');
|
1153 |
if ( $fr ) {
|
1154 |
fputs($fr, $serial);
|
1155 |
fclose($fr);
|
1156 |
@chmod( $tmp_meta_filename, 0666 & ~umask());
|
1157 |
+
if( !@rename( $tmp_meta_filename, $final_meta_filename ) ) {
|
1158 |
+
@unlink( $dir . $final_meta_filename );
|
1159 |
+
@rename( $tmp_meta_filename, $final_meta_filename );
|
1160 |
}
|
1161 |
} else {
|
1162 |
+
wp_cache_debug( "Problem writing meta file: {$final_meta_filename}" );
|
1163 |
}
|
1164 |
} elseif ( $cache_enabled ) {
|
1165 |
$oc_key = get_oc_key() . ".meta";
|
1170 |
wp_cache_writers_exit();
|
1171 |
}
|
1172 |
} else {
|
1173 |
+
wp_cache_debug( "Did not write meta file: meta-{$meta_file} *$supercacheonly* *$wp_cache_not_logged_in* *$new_cache*", 2 );
|
1174 |
}
|
1175 |
global $time_to_gc_cache;
|
1176 |
if( isset( $time_to_gc_cache ) && $time_to_gc_cache == 1 ) {
|
1210 |
define( 'DONOTDELETECACHE', 1 );
|
1211 |
return $postid;
|
1212 |
} elseif( $comment['comment_approved'] == '0' ) {
|
1213 |
+
if ( $comment[ 'comment_type' ] == '' ) {
|
1214 |
wp_cache_debug( "Moderated comment. Don't delete supercache file until comment approved.", 4 );
|
1215 |
$super_cache_enabled = 0; // don't remove the super cache static file until comment is approved
|
1216 |
define( 'DONOTDELETECACHE', 1 );
|
1311 |
|
1312 |
// Some users are inexplicibly seeing this error on scheduled posts.
|
1313 |
// define this constant to disable the post status check.
|
1314 |
+
if ( false == defined( 'WPSCFORCEUPDATE' ) && !in_array($post->post_status, array( 'publish', 'private' ) ) ) {
|
1315 |
wp_cache_debug( "wp_cache_post_edit: draft post, not deleting any cache files. status: " . $post->post_status, 4 );
|
1316 |
return $post_id;
|
1317 |
}
|
1332 |
}
|
1333 |
}
|
1334 |
|
1335 |
+
function wp_cache_post_id_gc( $post_id, $all = 'all' ) {
|
1336 |
+
global $wp_cache_object_cache;
|
1337 |
|
1338 |
if ( $wp_cache_object_cache )
|
1339 |
reset_oc_version();
|
1349 |
prune_super_cache( $dir, true, true );
|
1350 |
do_action( 'gc_cache', 'prune', $permalink );
|
1351 |
@rmdir( $dir );
|
|
|
1352 |
$supercache_home = get_supercache_dir();
|
1353 |
+
wp_cache_debug( "wp_cache_post_id_gc clearing cache in {$supercache_home}page/." );
|
1354 |
prune_super_cache( $supercache_home . 'page/', true );
|
1355 |
do_action( 'gc_cache', 'prune', 'page/' );
|
1356 |
} else {
|
1361 |
}
|
1362 |
|
1363 |
function wp_cache_post_change( $post_id ) {
|
1364 |
+
global $file_prefix, $cache_path, $blog_id, $super_cache_enabled, $blog_cache_dir, $wp_cache_refresh_single_only, $wp_cache_object_cache;
|
1365 |
static $last_processed = -1;
|
1366 |
|
1367 |
if ( $post_id == $last_processed ) {
|
1371 |
$post = get_post( $post_id );
|
1372 |
// Some users are inexplicibly seeing this error on scheduled posts.
|
1373 |
// define this constant to disable the post status check.
|
1374 |
+
if ( false == defined( 'WPSCFORCEUPDATE' ) && is_object( $post ) && !in_array($post->post_status, array( 'publish', 'private' ) ) ) {
|
1375 |
wp_cache_debug( "wp_cache_post_change: draft post, not deleting any cache files.", 4 );
|
1376 |
return $post_id;
|
1377 |
}
|
1400 |
if ( $wp_cache_object_cache )
|
1401 |
reset_oc_version();
|
1402 |
|
|
|
|
|
1403 |
// Delete supercache files whenever a post change event occurs, even if supercache is currently disabled.
|
1404 |
$dir = get_supercache_dir();
|
|
|
1405 |
// make sure the front page has a rebuild file
|
1406 |
+
wp_cache_post_id_gc( $post_id, $all );
|
1407 |
if ( $all == true ) {
|
1408 |
+
wp_cache_debug( "Post change: supercache enabled: deleting cache files in " . $dir );
|
1409 |
+
wpsc_rebuild_files( $dir );
|
|
|
|
|
|
|
|
|
1410 |
do_action( 'gc_cache', 'prune', 'homepage' );
|
1411 |
} else {
|
1412 |
wp_cache_debug( "wp_cache_post_change: not deleting all pages.", 4 );
|
1415 |
wp_cache_debug( "Post change: deleting page_on_front and page_for_posts pages.", 4 );
|
1416 |
wp_cache_debug( "Post change: page_on_front " . get_option( 'page_on_front' ), 4 );
|
1417 |
$permalink = trailingslashit( str_replace( get_option( 'home' ), '', get_permalink( get_option( 'page_for_posts' ) ) ) );
|
1418 |
+
wp_cache_debug( "Post change: Deleting files in: " . str_replace( '//', '/', $dir . $permalink ) );
|
1419 |
+
wpsc_rebuild_files( $dir . $permalink );
|
|
|
|
|
1420 |
do_action( 'gc_cache', 'prune', $permalink );
|
1421 |
} else {
|
1422 |
wp_cache_debug( "wp_cache_post_change: not deleting front static page.", 4 );
|
1428 |
while ( false !== ($file = readdir($handle))) {
|
1429 |
if ( strpos( $file, $file_prefix ) !== false ) {
|
1430 |
if ( strpos( $file, '.html' ) ) {
|
1431 |
+
// delete old wpcache files immediately
|
1432 |
+
wp_cache_debug( "wp_cache_post_change: Deleting obsolete wpcache cache+meta files: $file" );
|
1433 |
@unlink( $blog_cache_dir . $file);
|
1434 |
@unlink( $blog_cache_dir . 'meta/' . str_replace( '.html', '.meta', $file ) );
|
1435 |
continue;
|
1448 |
@unlink( $blog_cache_dir . 'meta/' . $file );
|
1449 |
@unlink( $blog_cache_dir . $file );
|
1450 |
if ( false == $supercache_files_deleted && $super_cache_enabled == true ) {
|
1451 |
+
wp_cache_debug( "Post change: deleting supercache files for {$permalink}" );
|
1452 |
+
wpsc_rebuild_files( $dir . $permalink );
|
|
|
|
|
|
|
1453 |
$supercache_files_deleted = true;
|
1454 |
do_action( 'gc_cache', 'rebuild', $permalink );
|
1455 |
}
|
1459 |
@unlink( $blog_cache_dir . 'meta/' . $file );
|
1460 |
@unlink( $blog_cache_dir . $file );
|
1461 |
if ( $super_cache_enabled == true ) {
|
1462 |
+
wp_cache_debug( "Post change: deleting supercache files for {$meta[ 'uri' ]}" );
|
1463 |
+
wpsc_rebuild_files( $dir . $meta[ 'uri' ] );
|
|
|
|
|
|
|
1464 |
do_action( 'gc_cache', 'rebuild', trailingslashit( $meta[ 'uri' ] ) );
|
1465 |
}
|
1466 |
}
|
1476 |
function wp_cache_microtime_diff($a, $b) {
|
1477 |
list($a_dec, $a_sec) = explode(' ', $a);
|
1478 |
list($b_dec, $b_sec) = explode(' ', $b);
|
1479 |
+
return (float)$b_sec - (float)$a_sec + (float)$b_dec - (float)$a_dec;
|
1480 |
}
|
1481 |
|
1482 |
function wp_cache_post_id() {
|
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.
|
7 |
Author: Automattic
|
8 |
Author URI: https://automattic.com/
|
9 |
License: GPL2+
|
@@ -63,9 +63,10 @@ if( !defined( 'WP_CACHE' ) || ( defined( 'WP_CACHE' ) && constant( 'WP_CACHE' )
|
|
63 |
}
|
64 |
|
65 |
include(WPCACHEHOME . 'wp-cache-base.php');
|
|
|
66 |
|
67 |
function wp_super_cache_text_domain() {
|
68 |
-
load_plugin_textdomain( 'wp-super-cache',
|
69 |
}
|
70 |
add_action( 'init', 'wp_super_cache_text_domain' );
|
71 |
|
@@ -164,6 +165,12 @@ function wpsupercache_activate() {
|
|
164 |
register_activation_hook( __FILE__, 'wpsupercache_activate' );
|
165 |
|
166 |
function wpsupercache_site_admin() {
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
if ( function_exists( 'is_super_admin' ) ) {
|
168 |
return is_super_admin();
|
169 |
} elseif ( function_exists( 'is_site_admin' ) ) {
|
@@ -175,12 +182,6 @@ function wpsupercache_site_admin() {
|
|
175 |
|
176 |
function wp_cache_add_pages() {
|
177 |
global $wpmu_version;
|
178 |
-
if ( function_exists( 'is_multisite' ) && is_multisite() && wpsupercache_site_admin() ) {
|
179 |
-
add_submenu_page( 'ms-admin.php', 'WP Super Cache', 'WP Super Cache', 'manage_options', 'wpsupercache', 'wp_cache_manager' );
|
180 |
-
} elseif ( isset( $wpmu_version ) && wpsupercache_site_admin() ) {
|
181 |
-
add_submenu_page( 'wpmu-admin.php', 'WP Super Cache', 'WP Super Cache', 'manage_options', 'wpsupercache', 'wp_cache_manager' );
|
182 |
-
}
|
183 |
-
|
184 |
if ( wpsupercache_site_admin() ) { // in single or MS mode add this menu item too, but only for superadmins in MS mode.
|
185 |
add_options_page( 'WP Super Cache', 'WP Super Cache', 'manage_options', 'wpsupercache', 'wp_cache_manager');
|
186 |
}
|
@@ -193,19 +194,19 @@ function wp_cache_network_pages() {
|
|
193 |
add_action( 'network_admin_menu', 'wp_cache_network_pages' );
|
194 |
|
195 |
function wp_cache_manager_error_checks() {
|
196 |
-
global $
|
197 |
global $dismiss_htaccess_warning, $dismiss_readable_warning, $dismiss_gc_warning, $wp_cache_shutdown_gc;
|
198 |
|
199 |
if ( !wpsupercache_site_admin() )
|
200 |
return false;
|
201 |
|
202 |
if ( version_compare( PHP_VERSION, '5.3.0', '<' ) && ( 1 == ini_get( 'safe_mode' ) || "on" == strtolower( ini_get( 'safe_mode' ) ) ) ) {
|
203 |
-
echo '<div
|
204 |
-
__( 'You may experience problems running this plugin because SAFE MODE is enabled.', 'wp-super-cache' ) . ' ';
|
205 |
|
206 |
|
207 |
if( !ini_get( 'safe_mode_gid' ) ) {
|
208 |
-
|
209 |
printf( __( 'You or an administrator may be able to make it work by changing the group owner of the plugin scripts to match that of the web server user. The group owner of the %s/cache/ directory must also be changed. See the <a href="http://php.net/features.safe-mode">safe mode manual page</a> for further details.', 'wp-super-cache' ), WP_CONTENT_DIR );
|
210 |
} else {
|
211 |
_e( 'You or an administrator must disable this. See the <a href="http://php.net/features.safe-mode">safe mode manual page</a> for further details. This cannot be disabled in a .htaccess file unfortunately. It must be done in the php.ini config file.', 'wp-super-cache' );
|
@@ -214,8 +215,8 @@ function wp_cache_manager_error_checks() {
|
|
214 |
}
|
215 |
|
216 |
if ( '' == get_option( 'permalink_structure' ) ) {
|
217 |
-
echo '<div
|
218 |
-
echo "<p>" . __( 'A custom url or permalink structure is required for this plugin to work correctly. Please go to the <a href="options-permalink.php">Permalinks Options Page</a> to configure your permalinks.' ) . "</p>";
|
219 |
echo '</div>';
|
220 |
return false;
|
221 |
}
|
@@ -227,7 +228,7 @@ function wp_cache_manager_error_checks() {
|
|
227 |
$hostname = substr( $hostname, 0, strpos( $hostname, '/' ) );
|
228 |
$ip = gethostbyname( $hostname );
|
229 |
if( substr( $ip, 0, 3 ) == '127' || substr( $ip, 0, 7 ) == '192.168' ) {
|
230 |
-
?><div
|
231 |
<p><?php printf( __( 'Your server thinks your hostname resolves to %s. Some services such as garbage collection by this plugin, and WordPress scheduled posts may not operate correctly.', 'wp-super-cache' ), $ip ); ?></p>
|
232 |
<p><?php printf( __( 'Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache' ), 'http://wordpress.org/plugins/wp-super-cache/faq/' ); ?></p>
|
233 |
</div>
|
@@ -241,7 +242,7 @@ function wp_cache_manager_error_checks() {
|
|
241 |
$cron = wp_remote_get($cron_url, array('timeout' => 0.01, 'blocking' => true));
|
242 |
if( is_array( $cron ) ) {
|
243 |
if( $cron[ 'response' ][ 'code' ] == '404' ) {
|
244 |
-
?><div
|
245 |
<p><?php _e( 'Unfortunately, WordPress cannot find the file wp-cron.php. This script is required for the correct operation of garbage collection by this plugin, WordPress scheduled posts as well as other critical activities.', 'wp-super-cache' ); ?></p>
|
246 |
<p><?php printf( __( 'Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache' ), 'http://wordpress.org/plugins/wp-super-cache/faq/' ); ?></p>
|
247 |
</div>
|
@@ -265,23 +266,23 @@ function wp_cache_manager_error_checks() {
|
|
265 |
}
|
266 |
|
267 |
if ( 1 == ini_get( 'zlib.output_compression' ) || "on" == strtolower( ini_get( 'zlib.output_compression' ) ) ) {
|
268 |
-
?><div
|
269 |
<p><?php _e( 'PHP is compressing the data sent to the visitors of your site. Disabling this is recommended as the plugin caches the compressed output once instead of compressing the same page over and over again. Also see #21 in the Troubleshooting section. See <a href="http://php.net/manual/en/zlib.configuration.php">this page</a> for instructions on modifying your php.ini.', 'wp-super-cache' ); ?></p></div><?php
|
270 |
}
|
271 |
|
272 |
if( $cache_enabled == true && $super_cache_enabled == true && $wp_cache_mod_rewrite && !got_mod_rewrite() ) {
|
273 |
-
?><div
|
274 |
-
<p><?php _e( 'It appears that mod_rewrite is not installed. Sometimes this check isn’t 100% reliable, especially if you are not using Apache. Please verify that the mod_rewrite module is loaded. It is required for serving Super Cache static files. You will still be able to
|
275 |
}
|
276 |
|
277 |
if( !is_writeable_ACLSafe( $wp_cache_config_file ) ) {
|
278 |
if ( !defined( 'SUBMITDISABLED' ) )
|
279 |
define( "SUBMITDISABLED", 'disabled style="color: #aaa" ' );
|
280 |
-
?><div
|
281 |
<p><?php printf( __( 'The WP Super Cache configuration file is <code>%s/wp-cache-config.php</code> and cannot be modified. That file must be writeable by the web server to make any changes.', 'wp-super-cache' ), WP_CONTENT_DIR ); ?>
|
282 |
<?php _e( 'A simple way of doing that is by changing the permissions temporarily using the CHMOD command or through your ftp client. Make sure it’s globally writeable and it should be fine.', 'wp-super-cache' ); ?></p>
|
283 |
<p><?php _e( '<a href="http://codex.wordpress.org/Changing_File_Permissions">This page</a> explains how to change file permissions.', 'wp-super-cache' ); ?></p>
|
284 |
-
<?php _e( 'Writeable:', 'wp-super-cache' ); ?> <code>chmod 666 <?php echo WP_CONTENT_DIR; ?>/wp-cache-config.php</code
|
285 |
<?php _e( 'Read-only:', 'wp-super-cache' ); ?> <code>chmod 644 <?php echo WP_CONTENT_DIR; ?>/wp-cache-config.php</code></p>
|
286 |
</div><?php
|
287 |
} elseif ( !defined( 'SUBMITDISABLED' ) ) {
|
@@ -300,7 +301,7 @@ function wp_cache_manager_error_checks() {
|
|
300 |
$gc_flag = get_gc_flag();
|
301 |
if ( $dismiss_gc_warning == 0 ) {
|
302 |
if ( false == maybe_stop_gc( $gc_flag ) && false == wp_next_scheduled( 'wp_cache_gc' ) ) {
|
303 |
-
?><div
|
304 |
<p><?php _e( 'Garbage collection by this plugin clears out expired and old cached pages on a regular basis. Use <a href="#expirytime">this form</a> to enable it.', 'wp-super-cache' ); ?> </p>
|
305 |
<form action="" method="POST">
|
306 |
<input type="hidden" name="action" value="dismiss_gc_warning" />
|
@@ -327,7 +328,7 @@ function wp_cache_manager_error_checks() {
|
|
327 |
$wp_content_stat = stat(WP_CONTENT_DIR . '/');
|
328 |
$wp_content_mode = decoct( $wp_content_stat[ 'mode' ] & 0777 );
|
329 |
if( substr( $wp_content_mode, -2 ) == '77' ) {
|
330 |
-
?><div
|
331 |
<p><?php printf( __( 'You should change the permissions on %s and make it more restrictive. Use your ftp client, or the following command to fix things:', 'wp-super-cache' ), WP_CONTENT_DIR ); ?> <code>chmod 755 <?php echo WP_CONTENT_DIR; ?>/</code></p>
|
332 |
<p><?php _e( '<a href="http://codex.wordpress.org/Changing_File_Permissions">This page</a> explains how to change file permissions.', 'wp-super-cache' ); ?></p>
|
333 |
<form action="" method="POST">
|
@@ -345,26 +346,26 @@ function wp_cache_manager_error_checks() {
|
|
345 |
if ( function_exists( "is_main_site" ) && true == is_main_site() ) {
|
346 |
$home_path = trailingslashit( get_home_path() );
|
347 |
$scrules = implode( "\n", extract_from_markers( $home_path.'.htaccess', 'WPSuperCache' ) );
|
348 |
-
if ( $cache_enabled && $wp_cache_mod_rewrite && !$wp_cache_mobile_enabled && strpos( $scrules, addcslashes(
|
349 |
-
echo '<div
|
350 |
echo "<p>" . __( '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' ) . "</p><p>" . __( 'This will have no affect on ordinary users but mobile users will see uncached pages.', 'wp-super-cache' ) . "</p></div>";
|
351 |
} elseif ( $wp_cache_mod_rewrite && $cache_enabled && $wp_cache_mobile_enabled && $scrules != '' && (
|
352 |
-
(
|
353 |
-
(
|
354 |
) {
|
355 |
?>
|
356 |
-
<div
|
357 |
<p><?php _e( 'The rewrite rules required by this plugin have changed or are missing. ', 'wp-super-cache' ); ?>
|
358 |
-
<?php _e( 'Mobile support requires extra rules in your .htaccess file, or you can set the plugin to
|
359 |
-
<ol><li> <?php _e( 'Set the plugin to
|
360 |
<li> <?php _e( 'Scroll down the Advanced Settings page and click the <strong>Update Mod_Rewrite Rules</strong> button.', 'wp-super-cache' ); ?></li>
|
361 |
<li> <?php printf( __( 'Delete the plugin mod_rewrite rules in %s.htaccess enclosed by <code># BEGIN WPSuperCache</code> and <code># END WPSuperCache</code> and let the plugin regenerate them by reloading this page.', 'wp-super-cache' ), $home_path ); ?></li>
|
362 |
<li> <?php printf( __( 'Add the rules yourself. Edit %s.htaccess and find the block of code enclosed by the lines <code># BEGIN WPSuperCache</code> and <code># END WPSuperCache</code>. There are two sections that look very similar. Just below the line <code>%%{HTTP:Cookie} !^.*(comment_author_|%s|wp-postpass_).*$</code> add these lines: (do it twice, once for each section)', 'wp-super-cache' ), $home_path, wpsc_get_logged_in_cookie() ); ?></p>
|
363 |
-
<div style='padding: 2px; margin: 2px; border: 1px solid #333; width:400px; overflow: scroll'><pre><?php echo "RewriteCond %{HTTP_user_agent} !^.*(" . addcslashes(
|
364 |
}
|
365 |
|
366 |
if ( $cache_enabled && $super_cache_enabled && $wp_cache_mod_rewrite && $scrules == '' ) {
|
367 |
-
?><div
|
368 |
<p><?php _e( 'The rewrite rules required by this plugin have changed or are missing. ', 'wp-super-cache' ); ?>
|
369 |
<?php _e( 'Scroll down the Advanced Settings page and click the <strong>Update Mod_Rewrite Rules</strong> button.', 'wp-super-cache' ); ?></p></div><?php
|
370 |
}
|
@@ -379,8 +380,8 @@ function wp_cache_manager_error_checks() {
|
|
379 |
}
|
380 |
}
|
381 |
if( isset( $missing_mods) && is_array( $missing_mods ) ) {
|
382 |
-
?><div
|
383 |
-
<p><?php __( 'The following Apache modules are missing. The plugin will work in
|
384 |
echo "<ul>";
|
385 |
foreach( $missing_mods as $req => $desc ) {
|
386 |
echo "<li> $req - $desc</li>";
|
@@ -399,8 +400,7 @@ function wp_cache_manager_error_checks() {
|
|
399 |
if ( isset( $disable_supercache_htaccess_warning ) == false )
|
400 |
$disable_supercache_htaccess_warning = false;
|
401 |
if ( $dismiss_htaccess_warning == 0 && $wp_cache_mod_rewrite && $super_cache_enabled && $disable_supercache_htaccess_warning == false && get_option( 'siteurl' ) != get_option( 'home' ) ) {
|
402 |
-
|
403 |
-
?><div id="message" class="updated fade"><h3><?php _e( '.htaccess file may need to be moved', 'wp-super-cache' ); ?></h3>
|
404 |
<p><?php _e( 'It appears you have WordPress installed in a sub directory as described <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">here</a>. Unfortunately, WordPress writes to the .htaccess in the install directory, not where your site is served from.<br />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' ); ?></p>
|
405 |
<form action="" method="POST">
|
406 |
<input type="hidden" name="action" value="dismiss_htaccess_warning" />
|
@@ -427,10 +427,7 @@ function admin_bar_delete_page() {
|
|
427 |
return false; // Directory not found. Probably not cached.
|
428 |
if ( false == wp_cache_confirm_delete( $path ) || substr( $path, 0, strlen( get_supercache_dir() ) ) != get_supercache_dir() )
|
429 |
die( "Could not delete directory" );
|
430 |
-
|
431 |
-
foreach( $files as $cache_file )
|
432 |
-
prune_super_cache( $path . $cache_file, true );
|
433 |
-
|
434 |
wp_redirect( preg_replace( '/[ <>\'\"\r\n\t\(\)]/', '', $_GET[ 'path' ] ) );
|
435 |
die();
|
436 |
}
|
@@ -440,7 +437,7 @@ if ( isset( $_GET[ 'action' ] ) && $_GET[ 'action' ] == 'delcachepage' )
|
|
440 |
|
441 |
function wp_cache_manager_updates() {
|
442 |
global $wp_cache_mobile_enabled, $wp_cache_mfunc_enabled, $wp_supercache_cache_list, $wp_cache_config_file, $wp_cache_hello_world, $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_not_logged_in, $wp_cache_make_known_anon, $cache_path, $wp_cache_object_cache, $_wp_using_ext_object_cache, $wp_cache_refresh_single_only, $cache_compression, $wp_cache_mod_rewrite, $wp_supercache_304, $wp_super_cache_late_init, $wp_cache_front_page_checks, $cache_page_secret, $wp_cache_disable_utf8, $wp_cache_no_cache_for_get;
|
443 |
-
global $cache_schedule_type, $
|
444 |
|
445 |
if ( !wpsupercache_site_admin() )
|
446 |
return false;
|
@@ -458,8 +455,8 @@ function wp_cache_manager_updates() {
|
|
458 |
$_POST[ 'action' ] = 'scupdates';
|
459 |
if( isset( $_POST[ 'wp_cache_easy_on' ] ) && $_POST[ 'wp_cache_easy_on' ] == 1 ) {
|
460 |
$_POST[ 'wp_cache_mobile_enabled' ] = 1;
|
461 |
-
$_POST[ '
|
462 |
-
$_POST[ 'super_cache_enabled' ] =
|
463 |
$_POST[ 'cache_rebuild_files' ] = 1;
|
464 |
unset( $_POST[ 'cache_compression' ] );
|
465 |
if ( $cache_path != WP_CONTENT_DIR . '/cache/' )
|
@@ -479,13 +476,12 @@ function wp_cache_manager_updates() {
|
|
479 |
}
|
480 |
|
481 |
} else {
|
482 |
-
unset( $_POST[ '
|
483 |
-
$_POST[ 'super_cache_enabled' ] = 0;
|
484 |
wp_clear_scheduled_hook( 'wp_cache_check_site_hook' );
|
485 |
wp_clear_scheduled_hook( 'wp_cache_gc' );
|
486 |
wp_clear_scheduled_hook( 'wp_cache_gc_watcher' );
|
487 |
}
|
488 |
-
$advanced_settings = array( 'wp_super_cache_late_init', 'wp_cache_disable_utf8', 'wp_cache_no_cache_for_get', 'wp_supercache_304', 'wp_cache_mfunc_enabled', 'wp_cache_mobile_enabled', 'wp_cache_front_page_checks', 'wp_supercache_cache_list', 'wp_cache_hello_world', 'wp_cache_clear_on_post_edit', 'wp_cache_not_logged_in', 'wp_cache_make_known_anon','wp_cache_object_cache', 'wp_cache_refresh_single_only', 'cache_compression'
|
489 |
foreach( $advanced_settings as $setting ) {
|
490 |
if ( isset( $$setting ) && $$setting == 1 ) {
|
491 |
$_POST[ $setting ] = 1;
|
@@ -568,25 +564,27 @@ function wp_cache_manager_updates() {
|
|
568 |
}
|
569 |
wp_cache_replace_line('^ *\$wp_supercache_cache_list', "\$wp_supercache_cache_list = " . $wp_supercache_cache_list . ";", $wp_cache_config_file);
|
570 |
|
571 |
-
if ( isset( $_POST[ '
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
wp_cache_enable(); // logged in cache
|
578 |
-
wp_super_cache_disable();
|
579 |
-
}
|
580 |
-
if( $_POST[ 'super_cache_enabled' ] == 1 ) {
|
581 |
-
$wp_cache_mod_rewrite = 1; // we need this because supercached files can be served by PHP too.
|
582 |
-
} else {
|
583 |
-
$wp_cache_mod_rewrite = 0; // cache files served by PHP
|
584 |
-
}
|
585 |
-
wp_cache_replace_line('^ *\$wp_cache_mod_rewrite', '$wp_cache_mod_rewrite = ' . $wp_cache_mod_rewrite . ";", $wp_cache_config_file);
|
586 |
}
|
587 |
} else {
|
588 |
wp_cache_disable();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
589 |
}
|
|
|
590 |
|
591 |
if( isset( $_POST[ 'wp_cache_hello_world' ] ) ) {
|
592 |
$wp_cache_hello_world = 1;
|
@@ -609,6 +607,13 @@ function wp_cache_manager_updates() {
|
|
609 |
}
|
610 |
wp_cache_replace_line('^ *\$cache_rebuild_files', "\$cache_rebuild_files = " . $cache_rebuild_files . ";", $wp_cache_config_file);
|
611 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
612 |
if( isset( $_POST[ 'wp_cache_mutex_disabled' ] ) ) {
|
613 |
$wp_cache_mutex_disabled = 0;
|
614 |
} else {
|
@@ -651,7 +656,7 @@ function wp_cache_manager_updates() {
|
|
651 |
} else {
|
652 |
$wp_cache_refresh_single_only = 0;
|
653 |
}
|
654 |
-
|
655 |
|
656 |
if ( defined( 'WPSC_DISABLE_COMPRESSION' ) ) {
|
657 |
$cache_compression = 0;
|
@@ -663,7 +668,7 @@ function wp_cache_manager_updates() {
|
|
663 |
$new_cache_compression = 0;
|
664 |
}
|
665 |
if ( 1 == ini_get( 'zlib.output_compression' ) || "on" == strtolower( ini_get( 'zlib.output_compression' ) ) ) {
|
666 |
-
echo '<div
|
667 |
} else {
|
668 |
if ( $new_cache_compression != $cache_compression ) {
|
669 |
$cache_compression = $new_cache_compression;
|
@@ -682,9 +687,10 @@ if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'wpsupercache' )
|
|
682 |
function wp_cache_manager() {
|
683 |
global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world;
|
684 |
global $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_mobile_enabled, $wp_cache_mobile_browsers, $wp_cache_no_cache_for_get;
|
685 |
-
global $
|
686 |
global $wp_super_cache_front_page_check, $wp_cache_object_cache, $_wp_using_ext_object_cache, $wp_cache_refresh_single_only, $wp_cache_mobile_prefixes;
|
687 |
-
global $
|
|
|
688 |
|
689 |
if ( !wpsupercache_site_admin() )
|
690 |
return false;
|
@@ -712,6 +718,9 @@ function wp_cache_manager() {
|
|
712 |
$mobile_groups = apply_filters( 'cached_mobile_groups', array() ); // Group mobile user agents by capabilities. Lump them all together by default
|
713 |
// mobile_groups = array( 'apple' => array( 'ipod', 'iphone' ), 'nokia' => array( 'nokia5800', 'symbianos' ) );
|
714 |
|
|
|
|
|
|
|
715 |
if ( false == apply_filters( 'wp_super_cache_error_checking', true ) )
|
716 |
return false;
|
717 |
|
@@ -754,6 +763,7 @@ jQuery(document).ready(function(){
|
|
754 |
#nav h2 {
|
755 |
border-bottom: 1px solid #ccc;
|
756 |
padding-bottom: 0;
|
|
|
757 |
}
|
758 |
table.wpsc-settings-table {
|
759 |
clear: both;
|
@@ -771,13 +781,14 @@ table.wpsc-settings-table {
|
|
771 |
$wp_cache_mod_rewrite = 1;
|
772 |
}
|
773 |
|
774 |
-
if ( !isset( $_GET[ 'tab' ] ) )
|
775 |
-
$_GET[ 'tab' ] = '';
|
776 |
-
|
777 |
-
if ( $_GET[ 'tab' ] == '' && $cache_enabled && ( $wp_cache_mod_rewrite || $super_cache_enabled == false ) ) {
|
778 |
$_GET[ 'tab' ] = 'settings';
|
779 |
-
echo '<div
|
|
|
|
|
|
|
780 |
}
|
|
|
781 |
wpsc_admin_tabs();
|
782 |
|
783 |
if ( isset( $wp_super_cache_front_page_check ) && $wp_super_cache_front_page_check == 1 && !wp_next_scheduled( 'wp_cache_check_site_hook' ) ) {
|
@@ -797,10 +808,12 @@ table.wpsc-settings-table {
|
|
797 |
}
|
798 |
$home_path = parse_url( site_url() );
|
799 |
$home_path = trailingslashit( array_key_exists( 'path', $home_path ) ? $home_path[ 'path' ] : '' );
|
800 |
-
if (! isset( $wp_cache_home_path ) )
|
801 |
$wp_cache_home_path = '/';
|
|
|
|
|
802 |
if ( "$home_path" != "$wp_cache_home_path" )
|
803 |
-
|
804 |
|
805 |
|
806 |
if( $wp_cache_mobile_enabled == 1 ) {
|
@@ -823,95 +836,30 @@ table.wpsc-settings-table {
|
|
823 |
echo '<a name="preload"></a>';
|
824 |
if ( $super_cache_enabled == true && false == defined( 'DISABLESUPERCACHEPRELOADING' ) ) {
|
825 |
global $wp_cache_preload_interval, $wp_cache_preload_on, $wp_cache_preload_taxonomies, $wp_cache_preload_email_me, $wp_cache_preload_email_volume, $wp_cache_preload_posts, $wpdb;
|
826 |
-
$
|
|
|
827 |
if ( $count > 1000 ) {
|
828 |
$min_refresh_interval = 720;
|
829 |
} else {
|
830 |
$min_refresh_interval = 30;
|
831 |
}
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
$wp_cache_preload_posts = (int)$_POST[ 'posts_to_cache' ];
|
837 |
-
}
|
838 |
-
wp_cache_replace_line('^ *\$wp_cache_preload_posts', "\$wp_cache_preload_posts = '$wp_cache_preload_posts';", $wp_cache_config_file);
|
839 |
-
|
840 |
-
if ( isset( $_POST[ 'preload' ] ) && $_POST[ 'preload' ] == __( 'Cancel Cache Preload', 'wp-super-cache' ) ) {
|
841 |
-
$next_preload = wp_next_scheduled( 'wp_cache_preload_hook' );
|
842 |
-
if ( $next_preload ) {
|
843 |
-
update_option( 'preload_cache_counter', array( 'c' => 0, 't' => time() ) );
|
844 |
-
wp_unschedule_event( $next_preload, 'wp_cache_preload_hook' );
|
845 |
-
}
|
846 |
-
$fp = @fopen( $cache_path . "stop_preload.txt", 'w' );
|
847 |
-
@fclose( $fp );
|
848 |
-
echo "<p><strong>" . __( 'Scheduled preloading of cache almost cancelled. It may take up to a minute for it to cancel completely.', 'wp-super-cache' ) . "</strong></p>";
|
849 |
-
} elseif ( isset( $_POST[ 'custom_preload_interval' ] ) && ( $_POST[ 'custom_preload_interval' ] == 0 || $_POST[ 'custom_preload_interval' ] >= $min_refresh_interval ) ) {
|
850 |
-
// if preload interval changes than unschedule any preload jobs and schedule any new one.
|
851 |
-
$_POST[ 'custom_preload_interval' ] = (int)$_POST[ 'custom_preload_interval' ];
|
852 |
-
if ( $wp_cache_preload_interval != $_POST[ 'custom_preload_interval' ] ) {
|
853 |
-
$next_preload = wp_next_scheduled( 'wp_cache_full_preload_hook' );
|
854 |
-
if ( $next_preload ) {
|
855 |
-
update_option( 'preload_cache_counter', array( 'c' => 0, 't' => time() ) );
|
856 |
-
add_option( 'preload_cache_stop', 1 );
|
857 |
-
wp_unschedule_event( $next_preload, 'wp_cache_full_preload_hook' );
|
858 |
-
if ( $wp_cache_preload_interval == 0 ) {
|
859 |
-
echo "<p><strong>" . __( 'Scheduled preloading of cache cancelled.', 'wp-super-cache' ) . "</strong></p>";
|
860 |
-
}
|
861 |
-
}
|
862 |
-
if ( $_POST[ 'custom_preload_interval' ] != 0 )
|
863 |
-
wp_schedule_single_event( time() + ( $_POST[ 'custom_preload_interval' ] * 60 ), 'wp_cache_full_preload_hook' );
|
864 |
-
}
|
865 |
-
$wp_cache_preload_interval = (int)$_POST[ 'custom_preload_interval' ];
|
866 |
-
wp_cache_replace_line('^ *\$wp_cache_preload_interval', "\$wp_cache_preload_interval = $wp_cache_preload_interval;", $wp_cache_config_file);
|
867 |
-
if ( isset( $_POST[ 'preload_email_me' ] ) ) {
|
868 |
-
$wp_cache_preload_email_me = 1;
|
869 |
-
} else {
|
870 |
-
$wp_cache_preload_email_me = 0;
|
871 |
-
}
|
872 |
-
wp_cache_replace_line('^ *\$wp_cache_preload_email_me', "\$wp_cache_preload_email_me = $wp_cache_preload_email_me;", $wp_cache_config_file);
|
873 |
-
if ( isset( $_POST[ 'wp_cache_preload_email_volume' ] ) && in_array( $_POST[ 'wp_cache_preload_email_volume' ], array( 'less', 'medium', 'many' ) ) ) {
|
874 |
-
$wp_cache_preload_email_volume = $_POST[ 'wp_cache_preload_email_volume' ];
|
875 |
-
} else {
|
876 |
-
$wp_cache_preload_email_volume = 'medium';
|
877 |
-
}
|
878 |
-
wp_cache_replace_line('^ *\$wp_cache_preload_email_volume', "\$wp_cache_preload_email_volume = '$wp_cache_preload_email_volume';", $wp_cache_config_file);
|
879 |
-
if ( isset( $_POST[ 'preload_taxonomies' ] ) ) {
|
880 |
-
$wp_cache_preload_taxonomies = 1;
|
881 |
-
} else {
|
882 |
-
$wp_cache_preload_taxonomies = 0;
|
883 |
-
}
|
884 |
-
wp_cache_replace_line('^ *\$wp_cache_preload_taxonomies', "\$wp_cache_preload_taxonomies = $wp_cache_preload_taxonomies;", $wp_cache_config_file);
|
885 |
-
if ( isset( $_POST[ 'preload_on' ] ) ) {
|
886 |
-
$wp_cache_preload_on = 1;
|
887 |
-
} else {
|
888 |
-
$wp_cache_preload_on = 0;
|
889 |
-
}
|
890 |
-
wp_cache_replace_line('^ *\$wp_cache_preload_on', "\$wp_cache_preload_on = $wp_cache_preload_on;", $wp_cache_config_file);
|
891 |
-
if ( isset( $_POST[ 'preload' ] ) && $_POST[ 'preload' ] == __( 'Preload Cache Now', 'wp-super-cache' ) ) {
|
892 |
-
@unlink( $cache_path . "preload_mutex.tmp" );
|
893 |
-
update_option( 'preload_cache_counter', array( 'c' => 0, 't' => time() ) );
|
894 |
-
wp_schedule_single_event( time() + 10, 'wp_cache_preload_hook' );
|
895 |
-
echo "<p><strong>" . __( 'Scheduled preloading of cache in 10 seconds.' ) . "</strong></p>";
|
896 |
-
} elseif ( (int)$_POST[ 'custom_preload_interval' ] ) {
|
897 |
-
@unlink( $cache_path . "preload_mutex.tmp" );
|
898 |
-
update_option( 'preload_cache_counter', array( 'c' => 0, 't' => time() ) );
|
899 |
-
wp_schedule_single_event( time() + ( (int)$_POST[ 'custom_preload_interval' ] * 60 ), 'wp_cache_full_preload_hook' );
|
900 |
-
echo "<p><strong>" . sprintf( __( 'Scheduled preloading of cache in %d minutes', 'wp-super-cache' ), (int)$_POST[ 'custom_preload_interval' ] ) . "</strong></p>";
|
901 |
-
}
|
902 |
}
|
903 |
}
|
904 |
echo '<p>' . __( 'This will cache every published post and page on your site. It will create supercache static files so unknown visitors (including bots) will hit a cached page. This will probably help your Google ranking as they are using speed as a metric when judging websites now.', 'wp-super-cache' ) . '</p>';
|
905 |
echo '<p>' . __( 'Preloading creates lots of files however. Caching is done from the newest post to the oldest so please consider only caching the newest if you have lots (10,000+) of posts. This is especially important on shared hosting.', 'wp-super-cache' ) . '</p>';
|
906 |
-
echo '<p>' . __( 'In ’Preload Mode’ regular garbage collection will
|
907 |
echo '<form name="cache_filler" action="" method="POST">';
|
908 |
echo '<input type="hidden" name="action" value="preload" />';
|
909 |
echo '<input type="hidden" name="page" value="wpsupercache" />';
|
910 |
-
echo '<p>' . sprintf( __( 'Refresh preloaded cache files every %s minutes. (0 to disable, minimum %d minutes.)', 'wp-super-cache' ), "<input type='text' size=4 name='
|
911 |
if ( $count > 100 ) {
|
912 |
$step = (int)( $count / 10 );
|
913 |
|
914 |
-
$select = "<select name='
|
915 |
$select .= "<option value='all' ";
|
916 |
if ( !isset( $wp_cache_preload_posts ) || $wp_cache_preload_posts == 'all' ) {
|
917 |
$checked = 'selectect=1 ';
|
@@ -935,35 +883,33 @@ table.wpsc-settings-table {
|
|
935 |
$select .= "</select>";
|
936 |
echo '<p>' . sprintf( __( 'Preload %s posts.', 'wp-super-cache' ), $select ) . '</p>';
|
937 |
} else {
|
938 |
-
echo '<input type="hidden" name="
|
939 |
}
|
940 |
|
941 |
-
echo '<input type="checkbox" name="
|
942 |
echo $wp_cache_preload_on == 1 ? 'checked=1' : '';
|
943 |
-
echo ' /> ' . __( 'Preload mode (garbage collection
|
944 |
-
echo '<input type="checkbox" name="
|
945 |
echo $wp_cache_preload_taxonomies == 1 ? 'checked=1' : '';
|
946 |
echo ' /> ' . __( 'Preload tags, categories and other taxonomies.', 'wp-super-cache' ) . '<br />';
|
947 |
-
echo '
|
948 |
-
echo $wp_cache_preload_email_me == 1 ? 'checked=1' : '';
|
949 |
-
echo ' /> ' . __( 'Send me status emails when files are refreshed.', 'wp-super-cache' ) . '<br />';
|
950 |
if ( !isset( $wp_cache_preload_email_volume ) )
|
951 |
-
$wp_cache_preload_email_volume = '
|
952 |
-
echo '
|
953 |
-
|
954 |
-
echo '
|
955 |
-
echo '
|
956 |
-
|
957 |
-
echo
|
958 |
-
echo ' <input name="wp_cache_preload_email_volume" type="radio" value="less" class="tog" ';
|
959 |
-
checked( 'less', $wp_cache_preload_email_volume );
|
960 |
-
echo '/> ' . __( 'Less emails, 1 at the start and 1 at the end of preloading all posts.', 'wp-super-cache' ) . '<br >';
|
961 |
|
962 |
$currently_preloading = false;
|
963 |
|
964 |
next_preload_message( 'wp_cache_preload_hook', __( 'Refresh of cache in %d hours %d minutes and %d seconds.', 'wp-super-cache' ), 60 );
|
965 |
next_preload_message( 'wp_cache_full_preload_hook', __( 'Full refresh of cache in %d hours %d minutes and %d seconds.', 'wp-super-cache' ) );
|
966 |
|
|
|
|
|
|
|
967 |
$preload_counter = get_option( 'preload_cache_counter' );
|
968 |
if ( isset( $preload_counter[ 'first' ] ) ) // converted from int to array
|
969 |
update_option( 'preload_cache_counter', array( 'c' => $preload_counter[ 'c' ], 't' => time() ) );
|
@@ -975,15 +921,24 @@ table.wpsc-settings-table {
|
|
975 |
echo "<p>" . sprintf( __( "<strong>Page last cached:</strong> %s", 'wp-super-cache' ), $url ) . "</p>";
|
976 |
}
|
977 |
}
|
978 |
-
echo '<div class="submit"><input class="button-primary" type="submit" name="preload" value="' . __( 'Update Settings', 'wp-super-cache' ) . '"
|
979 |
-
|
980 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
981 |
}
|
982 |
echo '</div>';
|
983 |
wp_nonce_field('wp-cache');
|
984 |
echo '</form>';
|
985 |
} else {
|
986 |
-
echo '<p>' . __( 'Preloading of cache disabled. Please
|
987 |
}
|
988 |
break;
|
989 |
case 'plugins':
|
@@ -1000,17 +955,20 @@ table.wpsc-settings-table {
|
|
1000 |
echo '<input type="hidden" name="action" value="scupdates" />';
|
1001 |
?><table class="form-table">
|
1002 |
<tr valign="top">
|
1003 |
-
<th scope="row"><label for="
|
1004 |
<td>
|
1005 |
<fieldset>
|
1006 |
-
<legend class="hidden"
|
1007 |
-
<label><input type='
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
|
|
|
|
|
|
1014 |
</fieldset>
|
1015 |
</td>
|
1016 |
</tr>
|
@@ -1019,6 +977,8 @@ table.wpsc-settings-table {
|
|
1019 |
<td>
|
1020 |
<fieldset>
|
1021 |
<legend class="hidden">Miscellaneous</legend>
|
|
|
|
|
1022 |
<?php if ( false == defined( 'WPSC_DISABLE_COMPRESSION' ) ) { ?>
|
1023 |
<?php if ( false == function_exists( 'gzencode' ) ) { ?>
|
1024 |
<em><?php _e( 'Warning! Compression is disabled as gzencode() function was not found.', 'wp-super-cache' ); ?></em><br />
|
@@ -1028,7 +988,7 @@ table.wpsc-settings-table {
|
|
1028 |
<?php }
|
1029 |
}
|
1030 |
?>
|
1031 |
-
<label><input type='checkbox' name='
|
1032 |
<label><input type='checkbox' name='cache_rebuild_files' <?php if ( $cache_rebuild_files ) echo "checked"; ?> value='1'> <?php _e( 'Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated.', 'wp-super-cache' ); echo " <em>(" . __( "Recommended", "wp-super-cache" ) . ")</em>"; ?></label><br />
|
1033 |
<?php
|
1034 |
$disable_304 = true;
|
@@ -1044,7 +1004,6 @@ table.wpsc-settings-table {
|
|
1044 |
?><em><?php _e( '304 support is disabled by default because some hosts have had problems with the headers used in the past.', 'wp-super-cache' ); ?></em><br /><?php
|
1045 |
}
|
1046 |
?>
|
1047 |
-
<label><input type='checkbox' name='wp_cache_no_cache_for_get' <?php if( $wp_cache_no_cache_for_get ) echo "checked"; ?> value='1'> <?php _e( 'Don’t cache pages with GET parameters. (?x=y at the end of a url)', 'wp-super-cache' ); ?></label><br />
|
1048 |
<label><input type='checkbox' name='wp_cache_make_known_anon' <?php if( $wp_cache_make_known_anon ) echo "checked"; ?> value='1'> <?php _e( 'Make known users anonymous so they’re served supercached static files.', 'wp-super-cache' ); ?></label><br />
|
1049 |
<label><input type='checkbox' name='wp_cache_hello_world' <?php if( $wp_cache_hello_world ) echo "checked"; ?> value='1'> <?php printf( __( 'Proudly tell the world your server is <a href="%s">Stephen Fry proof</a>! (places a message in your blog’s footer)', 'wp-super-cache' ), 'https://twitter.com/#!/HibbsLupusTrust/statuses/136429993059291136' ); ?></label><br />
|
1050 |
</legend>
|
@@ -1056,10 +1015,10 @@ table.wpsc-settings-table {
|
|
1056 |
<td>
|
1057 |
<fieldset>
|
1058 |
<legend class="hidden">Advanced</legend>
|
1059 |
-
<label><input type='checkbox' name='wp_cache_mfunc_enabled' <?php if( $wp_cache_mfunc_enabled ) echo "checked"; ?> value='1' <?php if ( $wp_cache_mod_rewrite ) { echo "disabled='disabled'"; } ?>> <?php _e( 'Enable dynamic caching.
|
1060 |
<label><input type='checkbox' name='wp_cache_mobile_enabled' <?php if( $wp_cache_mobile_enabled ) echo "checked"; ?> value='1'> <?php _e( 'Mobile device support. (External plugin or theme required. See the <a href="http://wordpress.org/plugins/wp-super-cache/faq/">FAQ</a> for further details.)', 'wp-super-cache' ); ?></label><br />
|
1061 |
<?php if ( $wp_cache_mobile_enabled ) {
|
1062 |
-
echo '<blockquote><h4>' . __( 'Mobile Browsers', 'wp-super-cache' ) . '</h4>' .
|
1063 |
} ?>
|
1064 |
<label><input type='checkbox' name='wp_cache_disable_utf8' <?php if( $wp_cache_disable_utf8 ) echo "checked"; ?> value='1'> <?php _e( 'Remove UTF8/blog charset support from .htaccess file. Only necessary if you see odd characters or punctuation looks incorrect. Requires rewrite rules update.', 'wp-super-cache' ); ?></label><br />
|
1065 |
<label><input type='checkbox' name='wp_cache_clear_on_post_edit' <?php if( $wp_cache_clear_on_post_edit ) echo "checked"; ?> value='1'> <?php _e( 'Clear all cache files when a post or page is published or updated.', 'wp-super-cache' ); ?></label><br />
|
@@ -1069,7 +1028,7 @@ table.wpsc-settings-table {
|
|
1069 |
<?php if( false == defined( 'WPSC_DISABLE_LOCKING' ) ) { ?>
|
1070 |
<label><input type='checkbox' name='wp_cache_mutex_disabled' <?php if( !$wp_cache_mutex_disabled ) echo "checked"; ?> value='0'> <?php _e( 'Coarse file locking. You do not need this as it will slow down your website.', 'wp-super-cache' ); ?></label><br />
|
1071 |
<?php } ?>
|
1072 |
-
<label><input type='checkbox' name='wp_super_cache_late_init' <?php if( $wp_super_cache_late_init ) echo "checked"; ?> value='1'> <?php _e( 'Late init. Display cached files after WordPress has loaded.
|
1073 |
<?php if ( $_wp_using_ext_object_cache ) {
|
1074 |
?><label><input type='checkbox' name='wp_cache_object_cache' <?php if( $wp_cache_object_cache ) echo "checked"; ?> value='1'> <?php echo __( 'Use object cache to store cached files.', 'wp-super-cache' ) . ' ' . __( '(Experimental)', 'wp-super-cache' ); ?></label><?php
|
1075 |
}?>
|
@@ -1091,9 +1050,9 @@ table.wpsc-settings-table {
|
|
1091 |
<?php if ( get_site_option( 'wp_super_cache_index_detected' ) && strlen( $cache_path ) > strlen( ABSPATH ) && ABSPATH == substr( $cache_path, 0, strlen( ABSPATH ) ) ) {
|
1092 |
$msg = __( 'The plugin detected a bare directory index in your cache directory, which would let visitors see your cache files directly and might expose private posts.', 'wp-super-cache' );
|
1093 |
if ( $super_cache_enabled && $wp_cache_mod_rewrite == 1 ) {
|
1094 |
-
$msg .= ' ' . __( 'You are using
|
1095 |
} else {
|
1096 |
-
$msg .= ' <strong>' . sprintf( __( 'index.html files have been added in key directories, but unless directory indexes are disabled, it is probably better to store the cache files outside of the web root of %s' ), ABSPATH ) . '</strong>';
|
1097 |
}
|
1098 |
echo "<li>$msg</li>";
|
1099 |
} ?>
|
@@ -1112,7 +1071,7 @@ table.wpsc-settings-table {
|
|
1112 |
<ol>
|
1113 |
<li><?php _e( 'Uninstall this plugin on the plugins page. It will automatically clean up after itself. If manual intervention is required, then simple instructions are provided.', 'wp-super-cache' ); ?></li>
|
1114 |
<li><?php printf( __( 'If uninstalling this plugin, make sure the directory <em>%s</em> is writeable by the webserver so the files <em>advanced-cache.php</em> and <em>cache-config.php</em> can be deleted automatically. (Making sure those files are writeable is probably a good idea!)', 'wp-super-cache' ), WP_CONTENT_DIR ); ?></li>
|
1115 |
-
<li><?php printf( __( 'Please see the <a href="%1$s/wp-super-cache/readme.txt">readme.txt</a> for instructions on uninstalling this script. Look for the heading, "How to uninstall WP Super Cache".', 'wp-super-cache' ),
|
1116 |
echo "<li><em>" . sprintf( __( 'Need help? Check the <a href="%1$s">Super Cache readme file</a>. It includes installation documentation, a FAQ and Troubleshooting tips. The <a href="%2$s">support forum</a> is also available. Your question may already have been answered.', 'wp-super-cache' ), 'http://wordpress.org/plugins/wp-super-cache/', 'http://wordpress.org/tags/wp-super-cache?forum_id=10' ) . "</em></li>";
|
1117 |
echo "</ol>";
|
1118 |
|
@@ -1158,7 +1117,7 @@ table.wpsc-settings-table {
|
|
1158 |
if ( $cache_enabled && !$wp_cache_mod_rewrite ) {
|
1159 |
$scrules = trim( implode( "\n", extract_from_markers( trailingslashit( get_home_path() ) . '.htaccess', 'WPSuperCache' ) ) );
|
1160 |
if ( $scrules != '' ) {
|
1161 |
-
echo "<p><strong>" . __( 'Notice:
|
1162 |
}
|
1163 |
}
|
1164 |
echo "<div class='submit'><input class='button-primary' type='submit' " . SUBMITDISABLED . " value='" . __( 'Update Status', 'wp-super-cache' ) . "' /></div></form>";
|
@@ -1169,62 +1128,43 @@ table.wpsc-settings-table {
|
|
1169 |
$url = trailingslashit( get_bloginfo( 'url' ) );
|
1170 |
if ( isset( $_POST[ 'httponly' ] ) )
|
1171 |
$url = str_replace( 'https://', 'http://', $url );
|
1172 |
-
|
1173 |
-
|
1174 |
-
$
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
}
|
1189 |
-
// Get the second copy
|
1190 |
-
echo "<p>" . sprintf( __( 'Fetching second copy of %s: ', 'wp-super-cache' ), $url );
|
1191 |
-
$page2 = wp_remote_get( $url, array('timeout' => 60, 'blocking' => true ) );
|
1192 |
-
if ( !is_wp_error( $page2 ) ) {
|
1193 |
-
$fp = fopen( $cache_path . "2.html", "w" );
|
1194 |
-
fwrite( $fp, $page2[ 'body' ] );
|
1195 |
-
fclose( $fp );
|
1196 |
-
echo '<span style="color: #0a0; font-weight: bold;">' . __( 'OK', 'wp-super-cache' ) . "</span> (<a href='" . WP_CONTENT_URL . "/cache/2.html'>2.html</a>)</p>";
|
1197 |
-
} else {
|
1198 |
-
echo '<span style="color: #a00; font-weight: bold;">' . __( 'FAILED', 'wp-super-cache' ) . "</span></p>";
|
1199 |
-
}
|
1200 |
-
|
1201 |
-
if ( is_wp_error( $page ) || is_wp_error( $page2 ) || $page[ 'response' ][ 'code' ] != 200 || $page2[ 'response' ][ 'code' ] != 200 ) {
|
1202 |
-
echo '<p><span style="color: #a00; font-weight: bold;">' . __( 'One or more page requests failed:', 'wp-super-cache' ) . '</span></p>';
|
1203 |
-
$error = false;
|
1204 |
-
if ( is_wp_error( $page ) ) {
|
1205 |
-
$error = $page;
|
1206 |
-
} elseif ( is_wp_error( $page2 ) ) {
|
1207 |
-
$error = $page2;
|
1208 |
-
}
|
1209 |
-
if ( $error ) {
|
1210 |
$errors = '';
|
1211 |
$messages = '';
|
1212 |
-
foreach ( $
|
1213 |
-
$severity = $
|
1214 |
-
foreach ( $
|
1215 |
-
$errors .= '
|
1216 |
}
|
1217 |
}
|
1218 |
-
if (
|
1219 |
-
echo
|
1220 |
-
} else {
|
1221 |
-
echo '<ul><li>' . sprintf( __( 'Page %d: %d (%s)', 'wp-super-cache' ), 1, $page[ 'response' ][ 'code' ], $page[ 'response' ][ 'message' ] ) . '</li>';
|
1222 |
-
echo '<li>' . sprintf( __( 'Page %d: %d (%s)', 'wp-super-cache' ), 2, $page2[ 'response' ][ 'code' ], $page2[ 'response' ][ 'message' ] ) . '</li></ul>';
|
1223 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1224 |
}
|
1225 |
|
1226 |
-
if (
|
1227 |
-
preg_match( '/(Cached page generated by WP-Super-Cache on) ([0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*)/', $
|
1228 |
echo '<p>' . sprintf( __( 'Page 1: %s', 'wp-super-cache' ), $matches1[ 2 ] ) . '</p>';
|
1229 |
echo '<p>' . sprintf( __( 'Page 2: %s', 'wp-super-cache' ), $matches2[ 2 ] ) . '</p>';
|
1230 |
echo '<p><span style="color: #0a0; font-weight: bold;">' . __( 'The timestamps on both pages match!', 'wp-super-cache' ) . '</span></p>';
|
@@ -1235,14 +1175,18 @@ table.wpsc-settings-table {
|
|
1235 |
echo '<li>' . __( 'Enable logging on the Debug page here. That should help you track down the problem.', 'wp-super-cache' ) . '</li>';
|
1236 |
echo '<li>' . __( 'You should check Page 1 and Page 2 above for errors. Your local server configuration may not allow your website to access itself.', 'wp-super-cache' ) . '</li>';
|
1237 |
echo "</ol>";
|
1238 |
-
|
1239 |
}
|
1240 |
}
|
1241 |
echo '<form name="cache_tester" action="" method="post">';
|
1242 |
echo '<input type="hidden" name="action" value="test" />';
|
1243 |
if ( isset( $_SERVER['HTTPS' ] ) && 'on' == strtolower( $_SERVER['HTTPS' ] ) )
|
1244 |
echo "<input type='checkbox' name='httponly' checked='checked' value='1' /> " . __( 'Send non-secure (non https) request for homepage', 'wp-super-cache' );
|
1245 |
-
|
|
|
|
|
|
|
|
|
|
|
1246 |
wp_nonce_field('wp-cache');
|
1247 |
echo '</form>';
|
1248 |
}
|
@@ -1257,18 +1201,20 @@ table.wpsc-settings-table {
|
|
1257 |
if ( ( defined( 'VHOST' ) || defined( 'SUBDOMAIN_INSTALL' ) || defined( 'SUNRISE' ) || ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) == true ) ) && wpsupercache_site_admin() ) {
|
1258 |
echo '<form name="wp_cache_content_delete" action="#listfiles" method="post">';
|
1259 |
echo '<input type="hidden" name="wp_delete_all_cache" />';
|
1260 |
-
echo '<div class="submit"
|
1261 |
wp_nonce_field('wp-cache');
|
1262 |
echo "</form><br />\n";
|
1263 |
}
|
1264 |
?>
|
1265 |
<h3 class="clear"><?php _e( 'Recommended Links and Plugins', 'wp-super-cache' ); ?></h3>
|
1266 |
<p><?php _e( 'Caching is only one part of making a website faster. Here are some other plugins that will help:', 'wp-super-cache' ); ?></p>
|
|
|
|
|
1267 |
<li><?php printf( __( '<a href="%s">Yahoo! Yslow</a> is an extension for the Firefox add-on Firebug. It analyzes web pages and suggests ways to improve their performance based on a set of rules for high performance web pages. Also try the performance tools online at <a href="%s">GTMetrix</a>.', 'wp-super-cache' ), 'http://developer.yahoo.com/yslow/', 'http://gtmetrix.com/' ); ?></li>
|
1268 |
<li><?php printf( __( '<a href="%s">Use Google Libraries</a> allows you to load some commonly used Javascript libraries from Google webservers. Ironically, it may reduce your Yslow score.', 'wp-super-cache' ), 'http://wordpress.org/plugins/use-google-libraries/' ); ?></li>
|
1269 |
<li><?php printf( __( '<strong>Advanced users only:</strong> Install an object cache. Choose from <a href="%s">Memcached</a>, <a href="%s">XCache</a>, <a href="%s">eAcccelerator</a> and others.', 'wp-super-cache' ), 'http://wordpress.org/plugins/memcached/', 'http://neosmart.net/dl.php?id=12', 'http://neosmart.net/dl.php?id=13' ); ?></li>
|
1270 |
<li><?php printf( __( '<a href="%s">Cron View</a> is a useful plugin to use when trying to debug garbage collection and preload problems.', 'wp-super-cache' ), 'http://wordpress.org/plugins/cron-view/' ); ?></li>
|
1271 |
-
</
|
1272 |
|
1273 |
<?php
|
1274 |
break;
|
@@ -1277,17 +1223,21 @@ table.wpsc-settings-table {
|
|
1277 |
?>
|
1278 |
</fieldset>
|
1279 |
</td><td valign='top' style='width: 300px'>
|
1280 |
-
<div style='background: #ffc; border: 1px solid #333; margin: 2px; padding:
|
1281 |
-
<h3
|
|
|
|
|
|
|
|
|
|
|
1282 |
<ol>
|
1283 |
-
<li><?php
|
1284 |
-
<li><?php printf( __( '<a href="%1$s">
|
1285 |
-
<li><?php printf( __( '<a href="%1$s">
|
1286 |
-
<li><?php printf( __( '<a href="%1$s">
|
1287 |
-
<li><?php printf( __( '<a href="%1$s">Development Version</a>', 'wp-super-cache' ), 'http://ocaoimh.ie/y/2o' ); ?></li>
|
1288 |
</ol>
|
1289 |
-
<h3
|
1290 |
-
<p><?php printf( __( 'Please <a href="%s">rate</a>
|
1291 |
|
1292 |
<?php
|
1293 |
if ( isset( $wp_supercache_cache_list ) && $wp_supercache_cache_list ) {
|
@@ -1361,66 +1311,32 @@ function wpsc_admin_tabs( $current = 0 ) {
|
|
1361 |
if ( $wp_db_version >= 15477 ) {
|
1362 |
echo '<div id="nav"><h2 class="themes-php">';
|
1363 |
echo implode( "", $links );
|
1364 |
-
echo '</h2
|
1365 |
} else {
|
1366 |
echo implode( " | ", $links );
|
1367 |
}
|
1368 |
}
|
1369 |
|
1370 |
function wsc_mod_rewrite() {
|
1371 |
-
global $
|
1372 |
|
1373 |
if ( defined( 'WPSC_DISABLE_HTACCESS_UPDATE' ) )
|
1374 |
return false;
|
1375 |
|
1376 |
if ( !$wp_cache_mod_rewrite )
|
1377 |
return false;
|
1378 |
-
|
1379 |
-
if ( isset( $wpmu_version ) || function_exists( 'is_multisite' ) && is_multisite() ) {
|
1380 |
-
if ( false == wpsupercache_site_admin() )
|
1381 |
-
return false;
|
1382 |
-
if ( function_exists( "is_main_site" ) && false == is_main_site() ) {
|
1383 |
-
global $current_site;
|
1384 |
-
$protocol = ( 'on' == strtolower( $_SERVER['HTTPS' ] ) ) ? 'https://' : 'http://';
|
1385 |
-
if ( isset( $wpmu_version ) ) {
|
1386 |
-
$link_to_admin = admin_url( "wpmu-admin.php?page=wpsupercache" );
|
1387 |
-
} else {
|
1388 |
-
$link_to_admin = admin_url( "ms-admin.php?page=wpsupercache" );
|
1389 |
-
}
|
1390 |
-
echo '<div id="message" class="updated fade"><p>' . sprintf( __( 'Notice: WP Super Cache mod_rewrite rule checks disabled unless running on <a href="%s">the main site</a> of this network.', 'wp-super-cache' ), $link_to_admin ) . '</p></div>';
|
1391 |
-
return false;
|
1392 |
-
}
|
1393 |
-
}
|
1394 |
-
|
1395 |
-
if ( function_exists( "is_main_site" ) && false == is_main_site() )
|
1396 |
-
return true;
|
1397 |
?>
|
1398 |
<a name="modrewrite"></a><fieldset class="options">
|
1399 |
-
<h3><?php _e( 'Mod Rewrite Rules', 'wp-super-cache' ); ?></h3
|
|
|
1400 |
|
|
|
1401 |
extract( wpsc_get_htaccess_info() );
|
1402 |
$dohtaccess = true;
|
1403 |
-
|
1404 |
-
if( isset( $wpmu_version ) ) {
|
1405 |
-
echo "<h4 style='color: #a00'>" . __( 'WordPress MU Detected', 'wp-super-cache' ) . "</h4><p>" . __( "Unfortunately, the rewrite rules cannot be updated automatically when running WordPress MU. Please open your .htaccess and add the following mod_rewrite rules above any other rules in that file.", 'wp-super-cache' ) . "</p>";
|
1406 |
-
} elseif( !$wprules || $wprules == '' ) {
|
1407 |
-
echo "<h4 style='color: #a00'>" . __( 'Mod Rewrite rules cannot be updated!', 'wp-super-cache' ) . "</h4>";
|
1408 |
-
echo "<p>" . sprintf( __( "You must have <strong>BEGIN</strong> and <strong>END</strong> markers in %s.htaccess for the auto update to work. They look like this and surround the main WordPress mod_rewrite rules:", 'wp-super-cache' ), $home_path );
|
1409 |
-
echo "<blockquote><pre><em># BEGIN WordPress</em>\n RewriteCond %{REQUEST_FILENAME} !-f\n RewriteCond %{REQUEST_FILENAME} !-d\n RewriteRule . /index.php [L]\n <em># END WordPress</em></pre></blockquote>";
|
1410 |
-
_e( 'Refresh this page when you have updated your .htaccess file.', 'wp-super-cache' );
|
1411 |
-
echo "</fieldset>";
|
1412 |
-
$dohtaccess = false;
|
1413 |
-
} elseif( strpos( $wprules, 'wordpressuser' ) ) { // Need to clear out old mod_rewrite rules
|
1414 |
echo "<p><strong>" . __( 'Thank you for upgrading.', 'wp-super-cache' ) . "</strong> " . sprintf( __( 'The mod_rewrite rules changed since you last installed this plugin. Unfortunately, you must remove the old supercache rules before the new ones are updated. Refresh this page when you have edited your .htaccess file. If you wish to manually upgrade, change the following line: %1$s so it looks like this: %2$s The only changes are "HTTP_COOKIE" becomes "HTTP:Cookie" and "wordpressuser" becomes "wordpress". This is a WordPress 2.5 change but it’s backwards compatible with older versions if you’re brave enough to use them.', 'wp-super-cache' ), '<blockquote><code>RewriteCond %{HTTP_COOKIE} !^.*wordpressuser.*$</code></blockquote>', '<blockquote><code>RewriteCond %{HTTP:Cookie} !^.*wordpress.*$</code></blockquote>' ) . "</p>";
|
1415 |
echo "</fieldset></div>";
|
1416 |
return;
|
1417 |
-
} elseif( $scrules != '' && strpos( $scrules, '%{REQUEST_URI} !^.*[^/]$' ) === false && substr( get_option( 'permalink_structure' ), -1 ) == '/' ) { // permalink structure has a trailing slash, need slash check in rules.
|
1418 |
-
echo "<div style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'><h4>" . __( 'Trailing slash check required.', 'wp-super-cache' ) . "</h4><p>" . __( 'It looks like your blog has URLs that end with a "/". Unfortunately since you installed this plugin a duplicate content bug has been found where URLs not ending in a "/" end serve the same content as those with the "/" and do not redirect to the proper URL. To fix, you must edit your .htaccess file and add these two rules to the two groups of Super Cache rules:', 'wp-super-cache' ) . "</p>";
|
1419 |
-
echo "<blockquote><code>RewriteCond %{REQUEST_URI} !^.*[^/]$RewriteCond %{REQUEST_URI} !^.*//.*$</code></blockquote>";
|
1420 |
-
echo "<p>" . __( 'You can see where the rules go and examine the complete rules by clicking the "View mod_rewrite rules" link below.', 'wp-super-cache' ) . "</p></div>";
|
1421 |
-
$dohtaccess = false;
|
1422 |
-
} elseif( strpos( $scrules, 'supercache' ) || strpos( $wprules, 'supercache' ) ) { // only write the rules once
|
1423 |
-
$dohtaccess = false;
|
1424 |
}
|
1425 |
if ( $dohtaccess && !isset( $_POST[ 'updatehtaccess' ] ) ){
|
1426 |
if ( $scrules == '' ) {
|
@@ -1430,12 +1346,13 @@ function wsc_mod_rewrite() {
|
|
1430 |
}
|
1431 |
} elseif ( $valid_nonce && isset( $_POST[ 'updatehtaccess' ] ) ) {
|
1432 |
echo "<div style='padding:0 8px;color:#4f8a10;background-color:#dff2bf;border:1px solid #4f8a10;'>";
|
1433 |
-
if(
|
1434 |
echo "<h4>" . __( 'Mod Rewrite rules updated!', 'wp-super-cache' ) . "</h4>";
|
1435 |
echo "<p><strong>" . sprintf( __( '%s.htaccess has been updated with the necessary mod_rewrite rules. Please verify they are correct. They should look like this:', 'wp-super-cache' ), $home_path ) . "</strong></p>\n";
|
1436 |
} else {
|
|
|
1437 |
echo "<h4>" . __( 'Mod Rewrite rules must be updated!', 'wp-super-cache' ) . "</h4>";
|
1438 |
-
echo "<p><strong>" . sprintf( __( '
|
1439 |
}
|
1440 |
echo "<p><pre>" . esc_html( $rules ) . "</pre></p>\n</div>";
|
1441 |
} else {
|
@@ -1449,15 +1366,12 @@ function wsc_mod_rewrite() {
|
|
1449 |
wpsc_update_htaccess_form();
|
1450 |
echo "<div id='rewriterules' style='display: none;'>";
|
1451 |
if ( $rules != $scrules )
|
1452 |
-
echo '<div style="background: #fff; border: 1px solid #333; margin: 2px;">' . wp_text_diff( $scrules, $rules, array( 'title' => 'Rewrite Rules', 'title_left' => 'Current Rules', 'title_right' => 'New Rules' ) ) . "</div>";
|
1453 |
echo "<p><pre># BEGIN WPSuperCache\n" . esc_html( $rules ) . "# END WPSuperCache</pre></p>\n";
|
1454 |
echo "<p>" . sprintf( __( 'Rules must be added to %s too:', 'wp-super-cache' ), WP_CONTENT_DIR . "/cache/.htaccess" ) . "</p>";
|
1455 |
echo "<pre># BEGIN supercache\n" . esc_html( $gziprules ) . "# END supercache</pre></p>";
|
1456 |
echo '</div>';
|
1457 |
}
|
1458 |
-
// http://allmybrain.com/2007/11/08/making-wp-super-cache-gzip-compression-work/
|
1459 |
-
$gziprules = insert_with_markers( $cache_path . '.htaccess', 'supercache', explode( "\n", $gziprules ) );
|
1460 |
-
echo "<h4>" . sprintf( __( 'Gzip encoding rules in %s.htaccess created.', 'wp-super-cache' ), $cache_path ) . "</h4>";
|
1461 |
|
1462 |
?></fieldset><?php
|
1463 |
}
|
@@ -1479,99 +1393,83 @@ function comment_form_lockdown_message() {
|
|
1479 |
if( defined( 'WPLOCKDOWN' ) && constant( 'WPLOCKDOWN' ) )
|
1480 |
add_action( 'comment_form', 'comment_form_lockdown_message' );
|
1481 |
|
1482 |
-
function
|
1483 |
-
global $
|
1484 |
-
global $wp_super_cache_lock_down;
|
1485 |
|
1486 |
-
if(isset($_POST['wp_lock_down']) && $valid_nonce) {
|
1487 |
-
$wp_lock_down = $_POST['wp_lock_down'] == '1' ? '1' : '0';
|
1488 |
-
wp_cache_replace_line('^.*WPLOCKDOWN', "define( 'WPLOCKDOWN', '$wp_lock_down' );", $wp_cache_config_file);
|
1489 |
-
if(
|
|
|
|
|
1490 |
prune_super_cache( $cache_path, true ); // clear the cache after lockdown
|
1491 |
-
|
1492 |
-
}
|
1493 |
-
if( !isset( $wp_lock_down ) ) {
|
1494 |
-
if( defined( 'WPLOCKDOWN' ) ) {
|
1495 |
-
$wp_lock_down = constant( 'WPLOCKDOWN' );
|
1496 |
-
} else {
|
1497 |
-
$wp_lock_down = '0';
|
1498 |
-
}
|
1499 |
-
}
|
1500 |
-
?><a name='lockdown'></a>
|
1501 |
-
<fieldset class="options">
|
1502 |
-
<h3><?php _e( 'Lock Down:', 'wp-super-cache' ); ?> <?php echo $wp_lock_down == '0' ? '<span style="color:red">' . __( 'Disabled', 'wp-super-cache' ) . '</span>' : '<span style="color:green">' . __( 'Enabled', 'wp-super-cache' ) . '</span>'; ?></h3>
|
1503 |
-
<p><?php _e( 'Prepare your server for an expected spike in traffic by enabling the lock down. When this is enabled, new comments on a post will not refresh the cached static files.', 'wp-super-cache' ); ?></p>
|
1504 |
-
<p><?php _e( 'Developers: Make your plugin lock down compatible by checking the "WPLOCKDOWN" constant. The following code will make sure your plugin respects the WPLOCKDOWN setting.', 'wp-super-cache' ); ?>
|
1505 |
-
<blockquote><code>if( defined( 'WPLOCKDOWN' ) && constant( 'WPLOCKDOWN' ) ) {
|
1506 |
-
echo "<?php _e( 'Sorry. My blog is locked down. Updates will appear shortly', 'wp-super-cache' ); ?>";
|
1507 |
-
}</code></blockquote>
|
1508 |
-
<?php
|
1509 |
-
if( $wp_lock_down == '1' ) {
|
1510 |
-
?><p><?php _e( 'WordPress is locked down. Super Cache static files will not be deleted when new comments are made.', 'wp-super-cache' ); ?></p><?php
|
1511 |
-
} else {
|
1512 |
-
?><p><?php _e( 'WordPress is not locked down. New comments will refresh Super Cache static files as normal.', 'wp-super-cache' ); ?></p><?php
|
1513 |
}
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
wp_nonce_field('wp-cache');
|
1520 |
-
echo "</form>\n";
|
1521 |
|
1522 |
-
|
1523 |
-
|
1524 |
-
?><a name='direct'></a>
|
1525 |
-
<fieldset class="options">
|
1526 |
-
<h3><?php _e( 'Directly Cached Files', 'wp-super-cache' ); ?></h3><?php
|
1527 |
|
|
|
|
|
1528 |
$out = '';
|
1529 |
-
if( $valid_nonce && array_key_exists('direct_pages', $_POST) && is_array( $_POST[ 'direct_pages' ] ) && !empty( $_POST[ 'direct_pages' ] ) ) {
|
1530 |
$expiredfiles = array_diff( $cached_direct_pages, $_POST[ 'direct_pages' ] );
|
1531 |
unset( $cached_direct_pages );
|
1532 |
foreach( $_POST[ 'direct_pages' ] as $page ) {
|
1533 |
-
$page =
|
1534 |
-
if( $page != '' ) {
|
1535 |
$cached_direct_pages[] = $page;
|
1536 |
$out .= "'$page', ";
|
1537 |
}
|
1538 |
}
|
1539 |
-
if(
|
1540 |
-
$
|
1541 |
-
}
|
1542 |
}
|
1543 |
-
if( $valid_nonce && array_key_exists('new_direct_page', $_POST) && $_POST[ 'new_direct_page' ] && '' != $_POST[ 'new_direct_page' ] ) {
|
1544 |
$page = str_replace( get_option( 'siteurl' ), '', $_POST[ 'new_direct_page' ] );
|
1545 |
-
|
|
|
1546 |
$page = '/' . $page;
|
1547 |
-
$page
|
1548 |
-
if ( false == is_array( $cached_direct_pages ) || in_array( $page, $cached_direct_pages ) == false ) {
|
1549 |
$cached_direct_pages[] = $page;
|
1550 |
$out .= "'$page', ";
|
|
|
|
|
|
|
1551 |
}
|
1552 |
}
|
1553 |
|
1554 |
-
if( $out != '' ) {
|
1555 |
$out = substr( $out, 0, -2 );
|
1556 |
-
$out = '$cached_direct_pages = array( ' . $out . ' );';
|
1557 |
-
wp_cache_replace_line('^ *\$cached_direct_pages', "$out", $wp_cache_config_file);
|
1558 |
-
prune_super_cache( $cache_path, true );
|
1559 |
}
|
|
|
|
|
|
|
|
|
|
|
1560 |
|
1561 |
-
if( !empty( $expiredfiles ) ) {
|
1562 |
foreach( $expiredfiles as $file ) {
|
1563 |
if( $file != '' ) {
|
1564 |
$firstfolder = explode( '/', $file );
|
1565 |
$firstfolder = ABSPATH . $firstfolder[1];
|
1566 |
$file = ABSPATH . $file;
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
|
|
|
|
|
|
1570 |
}
|
1571 |
}
|
1572 |
}
|
1573 |
|
1574 |
-
if( $valid_nonce && array_key_exists('deletepage', $_POST) && $_POST[ 'deletepage' ] ) {
|
1575 |
$page = str_replace( '..', '', preg_replace('/[ <>\'\"\r\n\t\(\)]/', '', $_POST['deletepage'] ) ) . '/';
|
1576 |
$pagefile = realpath( ABSPATH . $page . 'index.html' );
|
1577 |
if ( substr( $pagefile, 0, strlen( ABSPATH ) ) != ABSPATH || false == wp_cache_confirm_delete( ABSPATH . $page ) ) {
|
@@ -1584,11 +1482,47 @@ function wp_lock_down() {
|
|
1584 |
@unlink( $pagefile );
|
1585 |
@unlink( $pagefile . '.gz' );
|
1586 |
RecursiveFolderDelete( $firstfolder );
|
1587 |
-
echo "<strong>" . sprintf( __( '%s removed!', 'wp-super-cache' ), $pagefile ) . "</strong>";
|
1588 |
-
prune_super_cache( $cache_path, true );
|
1589 |
}
|
1590 |
}
|
1591 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1592 |
$readonly = '';
|
1593 |
if( !is_writeable_ACLSafe( ABSPATH ) ) {
|
1594 |
$readonly = 'READONLY';
|
@@ -1652,13 +1586,13 @@ function RecursiveFolderDelete ( $folderPath ) { // from http://www.php.net/manu
|
|
1652 |
}
|
1653 |
}
|
1654 |
|
1655 |
-
function
|
1656 |
-
global $cache_max_time, $wp_cache_config_file, $valid_nonce, $
|
1657 |
-
|
1658 |
-
$timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
|
1659 |
-
|
1660 |
if ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'expirytime' ) {
|
1661 |
|
|
|
|
|
|
|
1662 |
if( !isset( $cache_schedule_type ) ) {
|
1663 |
$cache_schedule_type = 'interval';
|
1664 |
wp_cache_replace_line('^ *\$cache_schedule_type', "\$cache_schedule_type = '$cache_schedule_type';", $wp_cache_config_file);
|
@@ -1679,7 +1613,7 @@ function wp_cache_edit_max_time () {
|
|
1679 |
wp_cache_replace_line('^ *\$cache_time_interval', "\$cache_time_interval = '$cache_time_interval';", $wp_cache_config_file);
|
1680 |
}
|
1681 |
|
1682 |
-
if ( isset( $_POST['wp_max_time'] )
|
1683 |
$cache_max_time = (int)$_POST['wp_max_time'];
|
1684 |
wp_cache_replace_line('^ *\$cache_max_time', "\$cache_max_time = $cache_max_time;", $wp_cache_config_file);
|
1685 |
// schedule gc watcher
|
@@ -1687,14 +1621,14 @@ function wp_cache_edit_max_time () {
|
|
1687 |
wp_schedule_event( time()+600, 'hourly', 'wp_cache_gc_watcher' );
|
1688 |
}
|
1689 |
|
1690 |
-
if ( isset( $_POST[ 'cache_gc_email_me' ] )
|
1691 |
$cache_gc_email_me = 1;
|
1692 |
wp_cache_replace_line('^ *\$cache_gc_email_me', "\$cache_gc_email_me = $cache_gc_email_me;", $wp_cache_config_file);
|
1693 |
-
}
|
1694 |
$cache_gc_email_me = 0;
|
1695 |
wp_cache_replace_line('^ *\$cache_gc_email_me', "\$cache_gc_email_me = $cache_gc_email_me;", $wp_cache_config_file);
|
1696 |
}
|
1697 |
-
if ( isset( $_POST[ 'cache_schedule_type' ] ) && $_POST[ 'cache_schedule_type' ] == 'interval' && isset( $_POST['cache_time_interval'] )
|
1698 |
wp_clear_scheduled_hook( 'wp_cache_gc' );
|
1699 |
$cache_schedule_type = 'interval';
|
1700 |
if ( (int)$_POST[ 'cache_time_interval' ] == 0 )
|
@@ -1703,7 +1637,7 @@ function wp_cache_edit_max_time () {
|
|
1703 |
wp_schedule_single_event( time() + $cache_time_interval, 'wp_cache_gc' );
|
1704 |
wp_cache_replace_line('^ *\$cache_schedule_type', "\$cache_schedule_type = '$cache_schedule_type';", $wp_cache_config_file);
|
1705 |
wp_cache_replace_line('^ *\$cache_time_interval', "\$cache_time_interval = '$cache_time_interval';", $wp_cache_config_file);
|
1706 |
-
}
|
1707 |
wp_clear_scheduled_hook( 'wp_cache_gc' );
|
1708 |
$cache_schedule_type = 'time';
|
1709 |
if ( !isset( $_POST[ 'cache_scheduled_time' ] ) ||
|
@@ -1716,7 +1650,7 @@ function wp_cache_edit_max_time () {
|
|
1716 |
$schedules = wp_get_schedules();
|
1717 |
if ( !isset( $cache_schedule_interval ) )
|
1718 |
$cache_schedule_interval = 'daily';
|
1719 |
-
if ( isset( $schedules[ $_POST[ 'cache_schedule_interval' ] ] ) )
|
1720 |
$cache_schedule_interval = $_POST[ 'cache_schedule_interval' ];
|
1721 |
wp_cache_replace_line('^ *\$cache_schedule_type', "\$cache_schedule_type = '$cache_schedule_type';", $wp_cache_config_file);
|
1722 |
wp_cache_replace_line('^ *\$cache_schedule_interval', "\$cache_schedule_interval = '{$cache_schedule_interval}';", $wp_cache_config_file);
|
@@ -1725,14 +1659,23 @@ function wp_cache_edit_max_time () {
|
|
1725 |
}
|
1726 |
}
|
1727 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1728 |
?><fieldset class="options">
|
1729 |
<a name='expirytime'></a>
|
1730 |
<h3><?php _e( 'Expiry Time & Garbage Collection', 'wp-super-cache' ); ?></h3><?php
|
1731 |
|
1732 |
-
?><span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n($timezone_format, false, 'gmt')); ?></span><?php
|
1733 |
$current_offset = get_option('gmt_offset');
|
1734 |
if ( get_option('timezone_string') || !empty($current_offset) ) {
|
1735 |
-
?><span id="local-time"><?php printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format)); ?></span><?php
|
1736 |
}
|
1737 |
$next_gc = wp_next_scheduled( 'wp_cache_gc' );
|
1738 |
if ( $next_gc )
|
@@ -1740,7 +1683,7 @@ function wp_cache_edit_max_time () {
|
|
1740 |
|
1741 |
|
1742 |
if ( $wp_cache_preload_on )
|
1743 |
-
echo "<p>" . __( 'Warning! <strong>PRELOAD MODE</strong> activated. Supercache files will not be deleted regardless of age.' ) . "</p>";
|
1744 |
|
1745 |
echo "<script type='text/javascript'>";
|
1746 |
echo "jQuery(function () {
|
@@ -1790,7 +1733,7 @@ function wp_cache_edit_max_time () {
|
|
1790 |
echo "<li>" . __( 'Sites with lots of static content, no widgets or rss feeds in their sidebar can use a timeout of 86400 seconds or even more and set the timer to something equally long.', 'wp-super-cache' ) . "</li>\n";
|
1791 |
echo "<li>" . __( 'Sites where an external data source updates at a particular time every day should set the timeout to 86400 seconds and use the Clock scheduler set appropriately.', 'wp-super-cache' ) . "</li>\n";
|
1792 |
echo "</ol>";
|
1793 |
-
echo "<p>" . __( 'Checking for and deleting expired files is expensive, but it’s expensive leaving them there too. On a very busy site, you should set the expiry time to <em>600 seconds</em>. Experiment with different values and visit this page to see how many expired files remain at different times during the day.
|
1794 |
echo "<p>" . __( 'Set the expiry time to 0 seconds to disable garbage collection.', 'wp-super-cache' ) . "</p>";
|
1795 |
echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Change Expiration', 'wp-super-cache' ) . '" /></div>';
|
1796 |
wp_nonce_field('wp-cache');
|
@@ -1821,7 +1764,7 @@ if( !function_exists('apache_request_headers') ) {
|
|
1821 |
}
|
1822 |
}
|
1823 |
|
1824 |
-
function
|
1825 |
global $cache_rejected_user_agent, $wp_cache_config_file, $valid_nonce;
|
1826 |
|
1827 |
if ( !function_exists( 'apache_request_headers' ) ) return;
|
@@ -1835,6 +1778,14 @@ function wp_cache_edit_rejected_ua() {
|
|
1835 |
}
|
1836 |
reset( $cache_rejected_user_agent );
|
1837 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1838 |
|
1839 |
echo '<a name="useragents"></a><fieldset class="options"><h3>' . __( 'Rejected User Agents', 'wp-super-cache' ) . '</h3>';
|
1840 |
echo "<p>" . __( 'Strings in the HTTP ’User Agent’ header that prevent WP-Cache from caching bot, spiders, and crawlers’ requests. Note that super cached files are still sent to these agents if they already exists.', 'wp-super-cache' ) . "</p>\n";
|
@@ -1850,7 +1801,7 @@ function wp_cache_edit_rejected_ua() {
|
|
1850 |
echo "</fieldset>\n";
|
1851 |
}
|
1852 |
|
1853 |
-
function
|
1854 |
global $wp_cache_config_file, $valid_nonce, $wp_cache_pages;
|
1855 |
|
1856 |
if ( isset( $_POST[ 'wp_edit_rejected_pages' ] ) && $valid_nonce ) {
|
@@ -1865,6 +1816,12 @@ function wp_cache_edit_rejected_pages() {
|
|
1865 |
$wp_cache_pages[ $page ] = $value;
|
1866 |
}
|
1867 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1868 |
|
1869 |
echo '<a name="rejectpages"></a>';
|
1870 |
echo '<p>' . __( 'Do not cache the following page types. See the <a href="http://codex.wordpress.org/Conditional_Tags">Conditional Tags</a> documentation for a complete discussion on each type.', 'wp-super-cache' ) . '</p>';
|
@@ -1881,20 +1838,26 @@ function wp_cache_edit_rejected_pages() {
|
|
1881 |
echo '<label><input type="checkbox" value="1" name="wp_cache_pages[search]" ' . checked( 1, $wp_cache_pages[ 'search' ], false ) . ' /> ' . __( 'Search Pages', 'wp-super-cache' ) . ' (is_search)</label><br />';
|
1882 |
echo '<label><input type="checkbox" value="1" name="wp_cache_pages[author]" ' . checked( 1, $wp_cache_pages[ 'author' ], false ) . ' /> ' . __( 'Author Pages', 'wp-super-cache' ) . ' (is_author)</label><br />';
|
1883 |
|
1884 |
-
echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Save' ) . '" /></div>';
|
1885 |
wp_nonce_field('wp-cache');
|
1886 |
echo "</form>\n";
|
1887 |
|
1888 |
}
|
1889 |
|
1890 |
-
function
|
1891 |
-
global $
|
1892 |
|
1893 |
-
if(isset($_REQUEST['wp_rejected_uri']) && $valid_nonce) {
|
1894 |
$text = wp_cache_sanitize_value( str_replace( '\\\\', '\\', $_REQUEST['wp_rejected_uri'] ), $cache_rejected_uri );
|
1895 |
wp_cache_replace_line('^ *\$cache_rejected_uri', "\$cache_rejected_uri = $text;", $wp_cache_config_file);
|
1896 |
}
|
1897 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1898 |
|
1899 |
echo '<a name="rejecturi"></a>';
|
1900 |
echo '<form name="wp_edit_rejected" action="#rejecturi" method="post">';
|
@@ -1909,14 +1872,19 @@ function wp_cache_edit_rejected() {
|
|
1909 |
echo "</form>\n";
|
1910 |
}
|
1911 |
|
1912 |
-
function
|
1913 |
-
global $cache_acceptable_files, $
|
1914 |
|
1915 |
-
if(isset($_REQUEST['wp_accepted_files']) && $valid_nonce) {
|
1916 |
-
$text = wp_cache_sanitize_value($_REQUEST['wp_accepted_files'], $cache_acceptable_files);
|
1917 |
-
wp_cache_replace_line('^ *\$cache_acceptable_files', "\$cache_acceptable_files = $text;", $wp_cache_config_file);
|
1918 |
}
|
|
|
1919 |
|
|
|
|
|
|
|
|
|
1920 |
|
1921 |
echo '<a name="cancache"></a>';
|
1922 |
echo '<div style="clear:both"></div><form name="wp_edit_accepted" action="#cancache" method="post">';
|
@@ -1931,54 +1899,149 @@ function wp_cache_edit_accepted() {
|
|
1931 |
echo "</form>\n";
|
1932 |
}
|
1933 |
|
1934 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1935 |
global $wp_super_cache_debug, $wp_cache_debug_log, $wp_cache_debug_ip, $cache_path, $valid_nonce, $wp_cache_config_file, $wp_super_cache_comments;
|
1936 |
global $wp_super_cache_front_page_check, $wp_super_cache_front_page_clear, $wp_super_cache_front_page_text, $wp_super_cache_front_page_notification, $wp_super_cache_advanced_debug;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1937 |
|
1938 |
if ( false == isset( $wp_super_cache_comments ) )
|
1939 |
$wp_super_cache_comments = 1;
|
1940 |
-
|
1941 |
-
|
1942 |
-
|
1943 |
-
|
1944 |
-
wp_cache_replace_line('^ *\$wp_super_cache_debug', "\$wp_super_cache_debug = '$wp_super_cache_debug';", $wp_cache_config_file);
|
1945 |
-
if ( $wp_super_cache_debug && ( ( isset( $wp_cache_debug_log ) && $wp_cache_debug_log == '' ) || !isset( $wp_cache_debug_log ) ) ) {
|
1946 |
-
$wp_cache_debug_log = md5( time() ) . ".txt";
|
1947 |
-
} else {
|
1948 |
-
$wp_cache_debug_log = "";
|
1949 |
-
}
|
1950 |
-
wp_cache_replace_line('^ *\$wp_cache_debug_log', "\$wp_cache_debug_log = '$wp_cache_debug_log';", $wp_cache_config_file);
|
1951 |
$wp_super_cache_comments = isset( $_POST[ 'wp_super_cache_comments' ] ) ? 1 : 0;
|
1952 |
-
|
1953 |
$wp_cache_debug_ip = esc_html( $_POST[ 'wp_cache_debug_ip' ] );
|
1954 |
-
|
1955 |
$wp_super_cache_front_page_check = isset( $_POST[ 'wp_super_cache_front_page_check' ] ) ? 1 : 0;
|
1956 |
-
|
1957 |
$wp_super_cache_front_page_clear = isset( $_POST[ 'wp_super_cache_front_page_clear' ] ) ? 1 : 0;
|
1958 |
-
|
1959 |
$wp_super_cache_front_page_text = esc_html( $_POST[ 'wp_super_cache_front_page_text' ] );
|
1960 |
-
|
1961 |
$wp_super_cache_front_page_notification = isset( $_POST[ 'wp_super_cache_front_page_notification' ] ) ? 1 : 0;
|
1962 |
-
|
1963 |
if ( $wp_super_cache_front_page_check == 1 && !wp_next_scheduled( 'wp_cache_check_site_hook' ) ) {
|
1964 |
wp_schedule_single_event( time() + 360 , 'wp_cache_check_site_hook' );
|
1965 |
-
wp_cache_debug( 'scheduled wp_cache_check_site_hook for 360 seconds time.'
|
1966 |
}
|
1967 |
}
|
1968 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1969 |
echo '<a name="debug"></a>';
|
1970 |
echo '<fieldset class="options">';
|
1971 |
-
|
1972 |
-
|
1973 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1974 |
|
1975 |
-
echo '<
|
1976 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1977 |
echo "<input type='hidden' name='wp_cache_debug' value='1' /><br />";
|
1978 |
echo "<table class='form-table'>";
|
1979 |
-
echo "<tr><
|
1980 |
-
echo "<tr><
|
1981 |
-
echo "<tr><td valign='top'>" . __( 'Cache Status Messages', 'wp-super-cache' ) . "</td><td><input type='checkbox' name='wp_super_cache_comments' value='1' " . checked( 1, $wp_super_cache_comments, false ) . " /> " . __( 'enabled', 'wp-super-cache' ) . "<br />";
|
1982 |
echo __( 'Display comments at the end of every page like this:', 'wp-super-cache' ) . "<br />";
|
1983 |
echo "<pre><!-- Dynamic page generated in 0.450 seconds. -->
|
1984 |
<!-- Cached page generated by WP-Super-Cache on " . date( "Y-m-d H:i:s", time() ) . " -->
|
@@ -2002,16 +2065,19 @@ function wp_cache_debug_settings() {
|
|
2002 |
}
|
2003 |
|
2004 |
function wp_cache_enable() {
|
2005 |
-
global $wp_cache_config_file, $cache_enabled
|
2006 |
|
2007 |
-
if(get_option('gzipcompression')) {
|
2008 |
-
echo "<strong>" . __( 'Error: GZIP compression is enabled. Disable it if you want to enable wp-cache.', 'wp-super-cache' ) . "</strong>";
|
2009 |
-
return false;
|
2010 |
-
}
|
2011 |
if( wp_cache_replace_line('^ *\$cache_enabled', '$cache_enabled = true;', $wp_cache_config_file) ) {
|
2012 |
$cache_enabled = true;
|
2013 |
}
|
2014 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015 |
}
|
2016 |
|
2017 |
function wp_cache_disable() {
|
@@ -2066,6 +2132,20 @@ function wp_cache_is_enabled() {
|
|
2066 |
return false;
|
2067 |
}
|
2068 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2069 |
|
2070 |
function wp_cache_replace_line($old, $new, $my_file) {
|
2071 |
if ( @is_file( $my_file ) == false ) {
|
@@ -2138,7 +2218,7 @@ function wp_cache_remove_index() {
|
|
2138 |
}
|
2139 |
|
2140 |
function wp_cache_index_notice() {
|
2141 |
-
global $
|
2142 |
|
2143 |
if ( false == wpsupercache_site_admin() )
|
2144 |
return false;
|
@@ -2159,7 +2239,7 @@ function wp_cache_index_notice() {
|
|
2159 |
} elseif ( get_site_option( 'wp_super_cache_index_detected' ) != 3 ) {
|
2160 |
echo "<div id='wpsc-index-warning' class='error notice' style='padding: 10px 10px 50px 10px'>";
|
2161 |
echo "<h1>" . __( 'WP Super Cache Warning!', 'wp-super-cache' ) . '</h1>';
|
2162 |
-
echo '<p>' . __( 'Your server is configured to show files and directories, which may expose sensitive data such as login cookies to attackers in the cache directories. That has been fixed by adding a file named index.html to each directory. If you use
|
2163 |
echo "<p><strong>";
|
2164 |
_e( 'If you just installed WP Super Cache for the first time, you can dismiss this message. Otherwise, you should probably refresh the login cookies of all logged in WordPress users here by clicking the logout link below.', 'wp-super-cache' );
|
2165 |
echo "</strong></p>";
|
@@ -2212,7 +2292,7 @@ if ( isset( $_GET[ 'action' ] ) && $_GET[ 'action' ] == 'wpsclogout' )
|
|
2212 |
add_action( 'admin_init', 'wp_cache_logout_all' );
|
2213 |
|
2214 |
function wp_cache_add_index_protection() {
|
2215 |
-
global $cache_path, $blog_cache_dir
|
2216 |
|
2217 |
if ( is_dir( $cache_path ) && false == is_file( "$cache_path/index.html" ) ) {
|
2218 |
$page = wp_remote_get( home_url( "/wp-content/cache/" ) );
|
@@ -2269,7 +2349,7 @@ function wp_cache_add_site_cache_index() {
|
|
2269 |
}
|
2270 |
|
2271 |
function wp_cache_verify_cache_dir() {
|
2272 |
-
global $cache_path, $blog_cache_dir
|
2273 |
|
2274 |
$dir = dirname($cache_path);
|
2275 |
if ( !file_exists($cache_path) ) {
|
@@ -2340,7 +2420,10 @@ function wp_cache_verify_config_file() {
|
|
2340 |
$sem_id = crc32( $WPSC_HTTP_HOST . $cache_path ) & 0x7fffffff;
|
2341 |
wp_cache_replace_line('sem_id', '$sem_id = ' . $sem_id . ';', $wp_cache_config_file);
|
2342 |
}
|
2343 |
-
|
|
|
|
|
|
|
2344 |
return true;
|
2345 |
}
|
2346 |
|
@@ -2354,7 +2437,7 @@ function wp_cache_create_advanced_cache() {
|
|
2354 |
|
2355 |
$line = 'define( \'WPCACHEHOME\', \'' . dirname( __FILE__ ) . '/\' );';
|
2356 |
if ( !is_writeable_ACLSafe($global_config_file) || !wp_cache_replace_line('define *\( *\'WPCACHEHOME\'', $line, $global_config_file ) ) {
|
2357 |
-
echo '<div
|
2358 |
return false;
|
2359 |
}
|
2360 |
$ret = true;
|
@@ -2390,7 +2473,7 @@ function wp_cache_check_link() {
|
|
2390 |
}
|
2391 |
|
2392 |
if( false == $ret ) {
|
2393 |
-
echo '<div
|
2394 |
echo "<p><ul><li>" . __( '1. If it already exists, please delete the file first.', 'wp-super-cache' ) . "</li>";
|
2395 |
echo "<li>" . sprintf( __( '2. Make %1$s writable using the chmod command through your ftp or server software. (<em>chmod 777 %1$s</em>) and refresh this page. This is only a temporary measure and you’ll have to make it read only afterwards again. (Change 777 to 755 in the previous command)', 'wp-super-cache' ), WP_CONTENT_DIR ) . "</li>";
|
2396 |
echo "<li>" . sprintf( __( '3. Refresh this page to update <em>%s/advanced-cache.php</em>', 'wp-super-cache' ), WP_CONTENT_DIR ) . "</li></ul>";
|
@@ -2418,20 +2501,82 @@ function wp_cache_check_global_config() {
|
|
2418 |
$line = 'define(\'WP_CACHE\', true);';
|
2419 |
if (!is_writeable_ACLSafe($global) || !wp_cache_replace_line('define *\( *\'WP_CACHE\'', $line, $global) ) {
|
2420 |
if ( defined( 'WP_CACHE' ) && constant( 'WP_CACHE' ) == false ) {
|
2421 |
-
echo '<div
|
2422 |
} else {
|
2423 |
-
echo "
|
2424 |
-
echo "<p>" . sprintf( __( "Edit <code>%s</code> and add the following line:<br /> <code>define('WP_CACHE', true);</code><br />Otherwise, <strong>WP-Cache will not be executed</strong> by WordPress core. ", 'wp-super-cache' ), $global ) . "</p>";
|
2425 |
}
|
2426 |
return false;
|
2427 |
} else {
|
2428 |
-
echo "<div
|
2429 |
}
|
2430 |
return true;
|
2431 |
}
|
2432 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2433 |
function wp_cache_files() {
|
2434 |
-
global $cache_path, $file_prefix, $cache_max_time, $valid_nonce, $supercachedir, $
|
2435 |
global $wp_cache_object_cache, $wp_cache_preload_on;
|
2436 |
|
2437 |
if ( '/' != substr($cache_path, -1)) {
|
@@ -2464,7 +2609,6 @@ function wp_cache_files() {
|
|
2464 |
|
2465 |
$cache_stats = get_option( 'supercache_stats' );
|
2466 |
if ( !is_array( $cache_stats ) || ( isset( $_GET[ 'listfiles' ] ) ) || ( $valid_nonce && array_key_exists('action', $_GET) && $_GET[ 'action' ] == 'regenerate_cache_stats' ) ) {
|
2467 |
-
$list_files = false; // it doesn't list supercached files, and removing single pages is buggy
|
2468 |
$count = 0;
|
2469 |
$expired = 0;
|
2470 |
$now = time();
|
@@ -2481,10 +2625,11 @@ function wp_cache_files() {
|
|
2481 |
$supercacheuri = trailingslashit( realpath( $cache_path . 'supercache/' . $supercacheuri ) );
|
2482 |
if ( wp_cache_confirm_delete( $supercacheuri ) ) {
|
2483 |
printf( __( "Deleting supercache file: <strong>%s</strong><br />", 'wp-super-cache' ), $supercacheuri );
|
2484 |
-
|
2485 |
-
@unlink( $supercacheuri . 'index.html.gz' );
|
2486 |
prune_super_cache( $supercacheuri . 'page', true );
|
2487 |
@rmdir( $supercacheuri );
|
|
|
|
|
2488 |
}
|
2489 |
}
|
2490 |
while( false !== ( $file = readdir( $handle ) ) ) {
|
@@ -2523,7 +2668,6 @@ function wp_cache_files() {
|
|
2523 |
$count++;
|
2524 |
}
|
2525 |
$wp_cache_fsize += $fsize;
|
2526 |
-
$fsize = intval($fsize/1024);
|
2527 |
}
|
2528 |
}
|
2529 |
closedir($handle);
|
@@ -2540,34 +2684,7 @@ function wp_cache_files() {
|
|
2540 |
} else {
|
2541 |
$wp_cache_fsize = '0KB';
|
2542 |
}
|
2543 |
-
|
2544 |
-
// Supercache files
|
2545 |
-
$now = time();
|
2546 |
-
$sizes = array( 'expired' => 0, 'expired_list' => array(), 'cached' => 0, 'cached_list' => array(), 'ts' => 0 );
|
2547 |
-
|
2548 |
-
if (is_dir($supercachedir)) {
|
2549 |
-
if( $dh = opendir( $supercachedir ) ) {
|
2550 |
-
while( ( $entry = readdir( $dh ) ) !== false ) {
|
2551 |
-
if ($entry != '.' && $entry != '..') {
|
2552 |
-
$sizes = wpsc_dirsize( trailingslashit( $supercachedir ) . $entry, $sizes );
|
2553 |
-
}
|
2554 |
-
}
|
2555 |
-
closedir($dh);
|
2556 |
-
}
|
2557 |
-
} else {
|
2558 |
-
$filem = @filemtime( $supercachedir );
|
2559 |
-
if ( false == $wp_cache_preload_on && is_file( $supercachedir ) && $cache_max_time > 0 && $filem + $cache_max_time <= $now ) {
|
2560 |
-
$sizes[ 'expired' ] ++;
|
2561 |
-
if ( $valid_nonce && isset( $_GET[ 'listfiles' ] ) )
|
2562 |
-
$sizes[ 'expired_list' ][ str_replace( $cache_path . 'supercache/' , '', $supercachedir ) ] = $now - $filem;
|
2563 |
-
} else {
|
2564 |
-
if ( $valid_nonce && isset( $_GET[ 'listfiles' ] ) && $filem )
|
2565 |
-
$sizes[ 'cached_list' ][ str_replace( $cache_path . 'supercache/' , '', $supercachedir ) ] = $now - $filem;
|
2566 |
-
}
|
2567 |
-
}
|
2568 |
-
$sizes[ 'ts' ] = time();
|
2569 |
-
$cache_stats = array( 'generated' => time(), 'supercache' => $sizes, 'wpcache' => array( 'cached' => $count, 'expired' => $expired, 'fsize' => $wp_cache_fsize ) );
|
2570 |
-
update_option( 'supercache_stats', $cache_stats );
|
2571 |
} else {
|
2572 |
echo "<p>" . __( 'Cache stats are not automatically generated. You must click the link below to regenerate the stats on this page.', 'wp-super-cache' ) . "</p>";
|
2573 |
echo "<a href='" . wp_nonce_url( add_query_arg( array( 'page' => 'wpsupercache', 'tab' => 'contents', 'action' => 'regenerate_cache_stats' ) ), 'wp-cache' ) . "'>" . __( 'Regenerate cache stats', 'wp-super-cache' ) . "</a>";
|
@@ -2578,7 +2695,8 @@ function wp_cache_files() {
|
|
2578 |
}// regerate stats cache
|
2579 |
|
2580 |
if ( is_array( $cache_stats ) ) {
|
2581 |
-
|
|
|
2582 |
echo "<ul><li>" . sprintf( __( '%s Cached Pages', 'wp-super-cache' ), $cache_stats[ 'wpcache' ][ 'cached' ] ) . "</li>";
|
2583 |
echo "<li>" . sprintf( __( '%s Expired Pages', 'wp-super-cache' ), $cache_stats[ 'wpcache' ][ 'expired' ] ) . "</li></ul>";
|
2584 |
$divisor = $cache_compression == 1 ? 2 : 1;
|
@@ -2586,85 +2704,42 @@ function wp_cache_files() {
|
|
2586 |
$fsize = $cache_stats[ 'supercache' ][ 'fsize' ] / 1024;
|
2587 |
else
|
2588 |
$fsize = 0;
|
2589 |
-
|
2590 |
-
$fsize = number_format( $fsize / 1024, 2 ) . "MB";
|
2591 |
-
} elseif( $fsize != 0 ) {
|
2592 |
-
$fsize = number_format( $fsize, 2 ) . "KB";
|
2593 |
-
} else {
|
2594 |
-
$fsize = "0KB";
|
2595 |
-
}
|
2596 |
echo "<p><strong>" . __( 'WP-Super-Cache', 'wp-super-cache' ) . " ({$fsize})</strong></p>";
|
2597 |
echo "<ul><li>" . sprintf( __( '%s Cached Pages', 'wp-super-cache' ), intval( $cache_stats[ 'supercache' ][ 'cached' ] / $divisor ) ) . "</li>";
|
2598 |
-
if (isset($now) && isset($
|
2599 |
-
$age = intval(($now - $
|
2600 |
else
|
2601 |
$age = 0;
|
2602 |
echo "<li>" . sprintf( __( '%s Expired Pages', 'wp-super-cache' ), intval( $cache_stats[ 'supercache' ][ 'expired' ] / $divisor ) ) . "</li></ul>";
|
2603 |
if ( $valid_nonce && array_key_exists('listfiles', $_GET) && $_GET[ 'listfiles' ] ) {
|
2604 |
echo "<div style='padding: 10px; border: 1px solid #333; height: 400px; width: 90%; overflow: auto'>";
|
2605 |
-
|
2606 |
-
|
2607 |
-
|
2608 |
-
|
2609 |
-
$
|
2610 |
-
|
2611 |
-
|
2612 |
-
|
2613 |
-
$
|
2614 |
-
|
2615 |
-
|
2616 |
-
$
|
2617 |
-
|
2618 |
-
|
2619 |
-
|
2620 |
-
|
2621 |
-
|
2622 |
-
|
2623 |
-
|
2624 |
-
|
2625 |
-
|
2626 |
-
|
2627 |
-
|
2628 |
-
|
2629 |
-
$bg = $flip ? 'style="background: #EAEAEA;"' : '';
|
2630 |
-
echo "<tr $bg><td>$c</td><td> <a href='http://{$details[ 'uri' ]}'>" . $details[ 'uri' ] . "</a></td><td> " . str_replace( $details[ 'uri' ], '', $details[ 'key' ] ) . "</td><td> {$age}</td><td><a href='" . wp_nonce_url( add_query_arg( array( 'page' => 'wpsupercache', 'action' => 'deletewpcache', 'uri' => base64_encode( $details[ 'uri' ] ) ) ), 'wp-cache' ) . "#listfiles'>X</a></td></tr>\n";
|
2631 |
-
$flip = !$flip;
|
2632 |
-
$c++;
|
2633 |
-
}
|
2634 |
-
}
|
2635 |
-
echo "</table>";
|
2636 |
-
}
|
2637 |
-
if ( is_array( $sizes[ 'cached_list' ] ) & !empty( $sizes[ 'cached_list' ] ) ) {
|
2638 |
-
echo "<h4>" . __( 'Fresh Super Cached Files', 'wp-super-cache' ) . "</h4>";
|
2639 |
-
echo "<table class='widefat'><tr><th>#</th><th>" . __( 'URI', 'wp-super-cache' ) . "</th><th>" . __( 'Age', 'wp-super-cache' ) . "</th><th>" . __( 'Delete', 'wp-super-cache' ) . "</th></tr>";
|
2640 |
-
$c = 1;
|
2641 |
-
$flip = 1;
|
2642 |
-
ksort( $sizes[ 'cached_list' ] );
|
2643 |
-
foreach( $sizes[ 'cached_list' ] as $age => $d ) {
|
2644 |
-
foreach( $d as $uri => $n ) {
|
2645 |
-
$bg = $flip ? 'style="background: #EAEAEA;"' : '';
|
2646 |
-
echo "<tr $bg><td>$c</td><td> <a href='http://{$uri}'>" . $uri . "</a></td><td>$age</td><td><a href='" . wp_nonce_url( add_query_arg( array( 'page' => 'wpsupercache', 'action' => 'deletesupercache', 'uri' => base64_encode( $uri ) ) ), 'wp-cache' ) . "#listfiles'>X</a></td></tr>\n";
|
2647 |
-
$flip = !$flip;
|
2648 |
-
$c++;
|
2649 |
-
}
|
2650 |
-
}
|
2651 |
-
echo "</table>";
|
2652 |
-
}
|
2653 |
-
if ( is_array( $sizes[ 'expired_list' ] ) && !empty( $sizes[ 'expired_list' ] ) ) {
|
2654 |
-
echo "<h4>" . __( 'Stale Super Cached Files', 'wp-super-cache' ) . "</h4>";
|
2655 |
-
echo "<table class='widefat'><tr><th>#</th><th>" . __( 'URI', 'wp-super-cache' ) . "</th><th>" . __( 'Age', 'wp-super-cache' ) . "</th><th>" . __( 'Delete', 'wp-super-cache' ) . "</th></tr>";
|
2656 |
-
$c = 1;
|
2657 |
-
$flip = 1;
|
2658 |
-
ksort( $sizes[ 'expired_list' ] );
|
2659 |
-
foreach( $sizes[ 'expired_list' ] as $age => $d ) {
|
2660 |
-
foreach( $d as $uri => $n ) {
|
2661 |
-
$bg = $flip ? 'style="background: #EAEAEA;"' : '';
|
2662 |
-
echo "<tr $bg><td>$c</td><td> <a href='http://{$uri}'>" . $uri . "</a></td><td>$age</td><td><a href='" . wp_nonce_url( add_query_arg( array( 'page' => 'wpsupercache', 'action' => 'deletesupercache', 'uri' => base64_encode( $uri ) ) ), 'wp-cache' ) . "#listfiles'>X</a></td></tr>\n";
|
2663 |
-
$flip = !$flip;
|
2664 |
-
$c++;
|
2665 |
}
|
2666 |
}
|
2667 |
-
echo "</table>";
|
2668 |
}
|
2669 |
echo "</div>";
|
2670 |
echo "<p><a href='?page=wpsupercache&tab=contents#top'>" . __( 'Hide file list', 'wp-super-cache' ) . "</a></p>";
|
@@ -2675,6 +2750,8 @@ function wp_cache_files() {
|
|
2675 |
}
|
2676 |
if ( $cache_max_time > 0 )
|
2677 |
echo "<p>" . sprintf( __( 'Expired files are files older than %s seconds. They are still used by the plugin and are deleted periodically.', 'wp-super-cache' ), $cache_max_time ) . "</p>";
|
|
|
|
|
2678 |
} // cache_stats
|
2679 |
wp_cache_delete_buttons();
|
2680 |
|
@@ -2715,7 +2792,7 @@ function delete_cache_dashboard() {
|
|
2715 |
add_action( 'dashmenu', 'delete_cache_dashboard' );
|
2716 |
|
2717 |
function wpsc_dirsize($directory, $sizes) {
|
2718 |
-
global $cache_max_time, $cache_path, $valid_nonce, $wp_cache_preload_on;
|
2719 |
$now = time();
|
2720 |
|
2721 |
if (is_dir($directory)) {
|
@@ -2728,28 +2805,55 @@ function wpsc_dirsize($directory, $sizes) {
|
|
2728 |
closedir($dh);
|
2729 |
}
|
2730 |
} else {
|
2731 |
-
if(is_file($directory) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2732 |
$filem = filemtime( $directory );
|
2733 |
-
if ( $
|
2734 |
-
$
|
2735 |
-
if ( $valid_nonce && $_GET[ 'listfiles' ] )
|
2736 |
-
$sizes[ 'expired_list' ][ $now - $filem ][ str_replace( $cache_path . 'supercache/' , '', str_replace( 'index.html', '', str_replace( 'index.html.gz', '', $directory ) ) ) ] = 1;
|
2737 |
} else {
|
2738 |
-
$
|
2739 |
-
|
2740 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2741 |
}
|
2742 |
if ( ! isset( $sizes[ 'fsize' ] ) )
|
2743 |
-
$sizes[ 'fsize' ] = @filesize( $directory );
|
2744 |
else
|
2745 |
-
$sizes[ 'fsize' ] += @filesize( $directory );
|
2746 |
}
|
2747 |
}
|
2748 |
return $sizes;
|
2749 |
}
|
2750 |
|
2751 |
function wp_cache_clean_cache( $file_prefix, $all = false ) {
|
2752 |
-
global $
|
2753 |
|
2754 |
if ( $wp_cache_object_cache && function_exists( "reset_oc_version" ) )
|
2755 |
reset_oc_version();
|
@@ -2758,6 +2862,8 @@ function wp_cache_clean_cache( $file_prefix, $all = false ) {
|
|
2758 |
prune_super_cache( $cache_path, true );
|
2759 |
return true;
|
2760 |
}
|
|
|
|
|
2761 |
|
2762 |
if (function_exists ('prune_super_cache')) {
|
2763 |
if( is_dir( $supercachedir ) ) {
|
@@ -2775,6 +2881,30 @@ function wp_cache_clean_cache( $file_prefix, $all = false ) {
|
|
2775 |
|
2776 |
}
|
2777 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2778 |
function wp_cache_clean_legacy_files( $dir, $file_prefix ) {
|
2779 |
global $wpdb;
|
2780 |
|
@@ -2790,7 +2920,7 @@ function wp_cache_clean_legacy_files( $dir, $file_prefix ) {
|
|
2790 |
|
2791 |
if ( strpos( $file, $file_prefix ) !== false ) {
|
2792 |
if ( strpos( $file, '.html' ) ) {
|
2793 |
-
// delete old
|
2794 |
@unlink( $dir . $file);
|
2795 |
@unlink( $dir . 'meta/' . str_replace( '.html', '.meta', $file ) );
|
2796 |
} else {
|
@@ -2807,7 +2937,7 @@ function wp_cache_clean_legacy_files( $dir, $file_prefix ) {
|
|
2807 |
}
|
2808 |
|
2809 |
function wp_cache_clean_expired($file_prefix) {
|
2810 |
-
global $
|
2811 |
|
2812 |
if ( $cache_max_time == 0 ) {
|
2813 |
return false;
|
@@ -2853,7 +2983,6 @@ function wpsc_remove_marker( $filename, $marker ) {
|
|
2853 |
}
|
2854 |
|
2855 |
$f = fopen( $filename, 'w' );
|
2856 |
-
$foundit = false;
|
2857 |
if ( $markerdata ) {
|
2858 |
$state = true;
|
2859 |
foreach ( $markerdata as $n => $markerline ) {
|
@@ -2877,7 +3006,7 @@ function wpsc_remove_marker( $filename, $marker ) {
|
|
2877 |
}
|
2878 |
|
2879 |
function wp_super_cache_footer() {
|
2880 |
-
?><p id='supercache'><?php printf( __( '%1$s is Stephen Fry proof thanks to caching by %2$s', 'wp-super-cache' ),
|
2881 |
}
|
2882 |
if( isset( $wp_cache_hello_world ) && $wp_cache_hello_world )
|
2883 |
add_action( 'wp_footer', 'wp_super_cache_footer' );
|
@@ -2910,13 +3039,13 @@ add_filter( 'favorite_actions', 'wp_cache_favorite_action' );
|
|
2910 |
function wp_cache_plugin_notice( $plugin ) {
|
2911 |
global $cache_enabled;
|
2912 |
if( $plugin == 'wp-super-cache/wp-cache.php' && !$cache_enabled && function_exists( "admin_url" ) )
|
2913 |
-
echo '<td colspan="5" class="plugin-update">' . sprintf( __( 'WP Super Cache must be configured. Go to <a href="%s">the admin page</a> to enable and configure the plugin.' ), admin_url( 'options-general.php?page=wpsupercache' ) ) . '</td>';
|
2914 |
}
|
2915 |
add_action( 'after_plugin_row', 'wp_cache_plugin_notice' );
|
2916 |
|
2917 |
function wp_cache_plugin_actions( $links, $file ) {
|
2918 |
if( $file == 'wp-super-cache/wp-cache.php' && function_exists( "admin_url" ) ) {
|
2919 |
-
$settings_link = '<a href="' . admin_url( 'options-general.php?page=wpsupercache' ) . '">' . __('Settings') . '</a>';
|
2920 |
array_unshift( $links, $settings_link ); // before other links
|
2921 |
}
|
2922 |
return $links;
|
@@ -2926,10 +3055,10 @@ add_filter( 'plugin_action_links', 'wp_cache_plugin_actions', 10, 2 );
|
|
2926 |
function wp_cache_admin_notice() {
|
2927 |
global $cache_enabled, $wp_cache_phase1_loaded;
|
2928 |
if( substr( $_SERVER["PHP_SELF"], -11 ) == 'plugins.php' && !$cache_enabled && function_exists( "admin_url" ) )
|
2929 |
-
echo '<div class="
|
2930 |
|
2931 |
if ( defined( 'WP_CACHE' ) && WP_CACHE == true && ( defined( 'ADVANCEDCACHEPROBLEM' ) || ( $cache_enabled && false == isset( $wp_cache_phase1_loaded ) ) ) ) {
|
2932 |
-
echo '<div class="error"><p>' . sprintf( __( 'Warning! WP Super Cache caching <strong>was</strong> broken but has been <strong>fixed</strong>! The script advanced-cache.php could not load wp-cache-phase1.php.<br /><br />The file %1$s/advanced-cache.php has been recreated and WPCACHEHOME fixed in your wp-config.php. Reload to hide this message.', 'wp-super-cache' ), WP_CONTENT_DIR ) . '</p></div>';
|
2933 |
wp_cache_create_advanced_cache();
|
2934 |
}
|
2935 |
}
|
@@ -2980,14 +3109,8 @@ add_action( 'wp_cache_check_site_hook', 'wp_cache_check_site' );
|
|
2980 |
|
2981 |
function update_cached_mobile_ua_list( $mobile_browsers, $mobile_prefixes = 0, $mobile_groups = 0 ) {
|
2982 |
global $wp_cache_config_file, $wp_cache_mobile_browsers, $wp_cache_mobile_prefixes, $wp_cache_mobile_groups;
|
2983 |
-
|
2984 |
-
|
2985 |
-
wp_cache_replace_line('^ *\$wp_cache_mobile_browsers', "\$wp_cache_mobile_browsers = '" . implode( ', ', $mobile_browsers ) . "';", $wp_cache_config_file);
|
2986 |
-
}
|
2987 |
-
if ( is_array( $mobile_prefixes ) ) {
|
2988 |
-
$wp_cache_mobile_prefixes = $mobile_prefixes;
|
2989 |
-
wp_cache_replace_line('^ *\$wp_cache_mobile_prefixes', "\$wp_cache_mobile_prefixes = '" . implode( ', ', $mobile_prefixes ) . "';", $wp_cache_config_file);
|
2990 |
-
}
|
2991 |
if ( is_array( $mobile_groups ) ) {
|
2992 |
$wp_cache_mobile_groups = $mobile_groups;
|
2993 |
wp_cache_replace_line('^ *\$wp_cache_mobile_groups', "\$wp_cache_mobile_groups = '" . implode( ', ', $mobile_groups ) . "';", $wp_cache_config_file);
|
@@ -3072,7 +3195,19 @@ function wpsc_get_htaccess_info() {
|
|
3072 |
}
|
3073 |
$home_path = get_home_path();
|
3074 |
$home_root = parse_url(get_bloginfo('url'));
|
3075 |
-
$home_root = isset( $home_root['path'] ) ? trailingslashit( $home_root['path'] ) : '/';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3076 |
$home_root_lc = str_replace( '//', '/', strtolower( $home_root ) );
|
3077 |
$inst_root = str_replace( '//', '/', '/' . trailingslashit( str_replace( $content_dir_root, '', str_replace( '\\', '/', WP_CONTENT_DIR ) ) ) );
|
3078 |
$wprules = implode( "\n", extract_from_markers( $home_path.'.htaccess', 'WordPress' ) );
|
@@ -3090,10 +3225,10 @@ function wpsc_get_htaccess_info() {
|
|
3090 |
$condition_rules[] = "RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\\\"]+ [NC]";
|
3091 |
$condition_rules[] = "RewriteCond %{HTTP:Profile} !^[a-z0-9\\\"]+ [NC]";
|
3092 |
if ( $wp_cache_mobile_enabled ) {
|
3093 |
-
if (
|
3094 |
-
$condition_rules[] = "RewriteCond %{HTTP_USER_AGENT} !^.*(" . addcslashes(
|
3095 |
-
if (
|
3096 |
-
$condition_rules[] = "RewriteCond %{
|
3097 |
}
|
3098 |
$condition_rules = apply_filters( 'supercacherewriteconditions', $condition_rules );
|
3099 |
|
@@ -3148,11 +3283,8 @@ function clear_post_supercache( $post_id ) {
|
|
3148 |
if ( !function_exists( 'prune_super_cache' ) )
|
3149 |
include_once( 'wp-cache-phase2.php' );
|
3150 |
|
3151 |
-
wp_cache_debug( "clear_post_supercache: deleting $dir
|
3152 |
-
|
3153 |
-
foreach( $files_to_check as $cache_file ) {
|
3154 |
-
prune_super_cache( $dir . $cache_file, true );
|
3155 |
-
}
|
3156 |
}
|
3157 |
|
3158 |
function wp_cron_preload_cache() {
|
@@ -3163,6 +3295,12 @@ function wp_cron_preload_cache() {
|
|
3163 |
wp_cache_debug( "wp_cron_preload_cache: preload cancelled", 1 );
|
3164 |
return true;
|
3165 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
3166 |
$mutex = $cache_path . "preload_mutex.tmp";
|
3167 |
sleep( 3 + mt_rand( 1, 5 ) );
|
3168 |
if ( @file_exists( $mutex ) ) {
|
@@ -3187,6 +3325,10 @@ function wp_cron_preload_cache() {
|
|
3187 |
|
3188 |
update_option( 'preload_cache_counter', array( 'c' => ( $c + 100 ), 't' => time() ) );
|
3189 |
|
|
|
|
|
|
|
|
|
3190 |
if ( $wp_cache_preload_email_me && $c == 0 )
|
3191 |
wp_mail( get_option( 'admin_email' ), sprintf( __( '[%1$s] Cache Preload Started', 'wp-super-cache' ), home_url(), '' ), ' ' );
|
3192 |
|
@@ -3250,7 +3392,7 @@ function wp_cron_preload_cache() {
|
|
3250 |
$types = get_post_types( array( 'public' => true, 'publicly_queryable' => true ), 'names', 'or' );
|
3251 |
$types = array_map( 'esc_sql', $types );
|
3252 |
$types = "'" . implode( "','", $types ) . "'";
|
3253 |
-
$posts = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE ( post_type IN ( $types ) ) AND post_status = 'publish' ORDER BY ID
|
3254 |
wp_cache_debug( "wp_cron_preload_cache: got 100 posts from position $c.", 5 );
|
3255 |
} else {
|
3256 |
wp_cache_debug( "wp_cron_preload_cache: no more posts to get. Limit ($wp_cache_preload_posts) reached.", 5 );
|
@@ -3297,7 +3439,7 @@ function wp_cron_preload_cache() {
|
|
3297 |
sleep( 1 );
|
3298 |
$count++;
|
3299 |
}
|
3300 |
-
if ( $wp_cache_preload_email_me && $wp_cache_preload_email_volume
|
3301 |
wp_mail( get_option( 'admin_email' ), sprintf( __( '[%1$s] %2$d posts refreshed', 'wp-super-cache' ), home_url(), ($c+100) ), __( "Refreshed the following posts:", 'wp-super-cache' ) . "\n$msg" );
|
3302 |
if ( defined( 'DOING_CRON' ) ) {
|
3303 |
wp_cache_debug( "wp_cron_preload_cache: scheduling the next preload in 30 seconds.", 5 );
|
@@ -3368,7 +3510,7 @@ function check_up_on_preloading() {
|
|
3368 |
add_action( 'init', 'check_up_on_preloading' ); // sometimes preloading stops working. Kickstart it.
|
3369 |
|
3370 |
function wp_cache_disable_plugin( $delete_config_file = true ) {
|
3371 |
-
global $
|
3372 |
if ( file_exists( ABSPATH . 'wp-config.php') ) {
|
3373 |
$global_config_file = ABSPATH . 'wp-config.php';
|
3374 |
} else {
|
@@ -3447,4 +3589,252 @@ function supercache_admin_bar_render() {
|
|
3447 |
}
|
3448 |
add_action( 'wp_before_admin_bar_render', 'supercache_admin_bar_render' );
|
3449 |
|
3450 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.5.0
|
7 |
Author: Automattic
|
8 |
Author URI: https://automattic.com/
|
9 |
License: GPL2+
|
63 |
}
|
64 |
|
65 |
include(WPCACHEHOME . 'wp-cache-base.php');
|
66 |
+
include( WPCACHEHOME . 'rest/load.php' );
|
67 |
|
68 |
function wp_super_cache_text_domain() {
|
69 |
+
load_plugin_textdomain( 'wp-super-cache', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
70 |
}
|
71 |
add_action( 'init', 'wp_super_cache_text_domain' );
|
72 |
|
165 |
register_activation_hook( __FILE__, 'wpsupercache_activate' );
|
166 |
|
167 |
function wpsupercache_site_admin() {
|
168 |
+
global $wp_version;
|
169 |
+
|
170 |
+
if ( version_compare( "4.8", $wp_version, "<=" ) ) {
|
171 |
+
return current_user_can( 'setup_network' );
|
172 |
+
}
|
173 |
+
|
174 |
if ( function_exists( 'is_super_admin' ) ) {
|
175 |
return is_super_admin();
|
176 |
} elseif ( function_exists( 'is_site_admin' ) ) {
|
182 |
|
183 |
function wp_cache_add_pages() {
|
184 |
global $wpmu_version;
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
if ( wpsupercache_site_admin() ) { // in single or MS mode add this menu item too, but only for superadmins in MS mode.
|
186 |
add_options_page( 'WP Super Cache', 'WP Super Cache', 'manage_options', 'wpsupercache', 'wp_cache_manager');
|
187 |
}
|
194 |
add_action( 'network_admin_menu', 'wp_cache_network_pages' );
|
195 |
|
196 |
function wp_cache_manager_error_checks() {
|
197 |
+
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;
|
198 |
global $dismiss_htaccess_warning, $dismiss_readable_warning, $dismiss_gc_warning, $wp_cache_shutdown_gc;
|
199 |
|
200 |
if ( !wpsupercache_site_admin() )
|
201 |
return false;
|
202 |
|
203 |
if ( version_compare( PHP_VERSION, '5.3.0', '<' ) && ( 1 == ini_get( 'safe_mode' ) || "on" == strtolower( ini_get( 'safe_mode' ) ) ) ) {
|
204 |
+
echo '<div class="notice notice-error"><h3>' . __( 'Warning! PHP Safe Mode Enabled!', 'wp-super-cache' ) . '</h3><p>' .
|
205 |
+
__( 'You may experience problems running this plugin because SAFE MODE is enabled.', 'wp-super-cache' ) . '<br />';
|
206 |
|
207 |
|
208 |
if( !ini_get( 'safe_mode_gid' ) ) {
|
209 |
+
echo __( 'Your server is set up to check the owner of PHP scripts before allowing them to read and write files.', 'wp-super-cache' ) . '<br />';
|
210 |
printf( __( 'You or an administrator may be able to make it work by changing the group owner of the plugin scripts to match that of the web server user. The group owner of the %s/cache/ directory must also be changed. See the <a href="http://php.net/features.safe-mode">safe mode manual page</a> for further details.', 'wp-super-cache' ), WP_CONTENT_DIR );
|
211 |
} else {
|
212 |
_e( 'You or an administrator must disable this. See the <a href="http://php.net/features.safe-mode">safe mode manual page</a> for further details. This cannot be disabled in a .htaccess file unfortunately. It must be done in the php.ini config file.', 'wp-super-cache' );
|
215 |
}
|
216 |
|
217 |
if ( '' == get_option( 'permalink_structure' ) ) {
|
218 |
+
echo '<div class="notice notice-error"><h3>' . __( 'Permlink Structure Error', 'wp-super-cache' ) . '</h3>';
|
219 |
+
echo "<p>" . __( 'A custom url or permalink structure is required for this plugin to work correctly. Please go to the <a href="options-permalink.php">Permalinks Options Page</a> to configure your permalinks.', 'wp-super-cache' ) . "</p>";
|
220 |
echo '</div>';
|
221 |
return false;
|
222 |
}
|
228 |
$hostname = substr( $hostname, 0, strpos( $hostname, '/' ) );
|
229 |
$ip = gethostbyname( $hostname );
|
230 |
if( substr( $ip, 0, 3 ) == '127' || substr( $ip, 0, 7 ) == '192.168' ) {
|
231 |
+
?><div class="notice notice-warning"><h3><?php printf( __( 'Warning! Your hostname "%s" resolves to %s', 'wp-super-cache' ), $hostname, $ip ); ?></h3>
|
232 |
<p><?php printf( __( 'Your server thinks your hostname resolves to %s. Some services such as garbage collection by this plugin, and WordPress scheduled posts may not operate correctly.', 'wp-super-cache' ), $ip ); ?></p>
|
233 |
<p><?php printf( __( 'Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache' ), 'http://wordpress.org/plugins/wp-super-cache/faq/' ); ?></p>
|
234 |
</div>
|
242 |
$cron = wp_remote_get($cron_url, array('timeout' => 0.01, 'blocking' => true));
|
243 |
if( is_array( $cron ) ) {
|
244 |
if( $cron[ 'response' ][ 'code' ] == '404' ) {
|
245 |
+
?><div class="notice notice-error"><h3>Warning! wp-cron.php not found!</h3>
|
246 |
<p><?php _e( 'Unfortunately, WordPress cannot find the file wp-cron.php. This script is required for the correct operation of garbage collection by this plugin, WordPress scheduled posts as well as other critical activities.', 'wp-super-cache' ); ?></p>
|
247 |
<p><?php printf( __( 'Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache' ), 'http://wordpress.org/plugins/wp-super-cache/faq/' ); ?></p>
|
248 |
</div>
|
266 |
}
|
267 |
|
268 |
if ( 1 == ini_get( 'zlib.output_compression' ) || "on" == strtolower( ini_get( 'zlib.output_compression' ) ) ) {
|
269 |
+
?><div class="notice notice-warning"><h3><?php _e( 'Zlib Output Compression Enabled!', 'wp-super-cache' ); ?></h3>
|
270 |
<p><?php _e( 'PHP is compressing the data sent to the visitors of your site. Disabling this is recommended as the plugin caches the compressed output once instead of compressing the same page over and over again. Also see #21 in the Troubleshooting section. See <a href="http://php.net/manual/en/zlib.configuration.php">this page</a> for instructions on modifying your php.ini.', 'wp-super-cache' ); ?></p></div><?php
|
271 |
}
|
272 |
|
273 |
if( $cache_enabled == true && $super_cache_enabled == true && $wp_cache_mod_rewrite && !got_mod_rewrite() ) {
|
274 |
+
?><div class="notice notice-warning"><h3><?php _e( 'Mod rewrite may not be installed!', 'wp-super-cache' ); ?></h3>
|
275 |
+
<p><?php _e( 'It appears that mod_rewrite is not installed. Sometimes this check isn’t 100% reliable, especially if you are not using Apache. Please verify that the mod_rewrite module is loaded. It is required for serving Super Cache static files in expert mode. You will still be able to simple mode.', 'wp-super-cache' ); ?></p></div><?php
|
276 |
}
|
277 |
|
278 |
if( !is_writeable_ACLSafe( $wp_cache_config_file ) ) {
|
279 |
if ( !defined( 'SUBMITDISABLED' ) )
|
280 |
define( "SUBMITDISABLED", 'disabled style="color: #aaa" ' );
|
281 |
+
?><div class="notice notice-error"><h3><?php _e( 'Read Only Mode. Configuration cannot be changed.', 'wp-super-cache' ); ?></h3>
|
282 |
<p><?php printf( __( 'The WP Super Cache configuration file is <code>%s/wp-cache-config.php</code> and cannot be modified. That file must be writeable by the web server to make any changes.', 'wp-super-cache' ), WP_CONTENT_DIR ); ?>
|
283 |
<?php _e( 'A simple way of doing that is by changing the permissions temporarily using the CHMOD command or through your ftp client. Make sure it’s globally writeable and it should be fine.', 'wp-super-cache' ); ?></p>
|
284 |
<p><?php _e( '<a href="http://codex.wordpress.org/Changing_File_Permissions">This page</a> explains how to change file permissions.', 'wp-super-cache' ); ?></p>
|
285 |
+
<?php _e( 'Writeable:', 'wp-super-cache' ); ?> <code>chmod 666 <?php echo WP_CONTENT_DIR; ?>/wp-cache-config.php</code><br />
|
286 |
<?php _e( 'Read-only:', 'wp-super-cache' ); ?> <code>chmod 644 <?php echo WP_CONTENT_DIR; ?>/wp-cache-config.php</code></p>
|
287 |
</div><?php
|
288 |
} elseif ( !defined( 'SUBMITDISABLED' ) ) {
|
301 |
$gc_flag = get_gc_flag();
|
302 |
if ( $dismiss_gc_warning == 0 ) {
|
303 |
if ( false == maybe_stop_gc( $gc_flag ) && false == wp_next_scheduled( 'wp_cache_gc' ) ) {
|
304 |
+
?><div class="notice notice-warning"><h3><?php _e( 'Warning! Garbage collection is not scheduled!', 'wp-super-cache' ); ?></h3>
|
305 |
<p><?php _e( 'Garbage collection by this plugin clears out expired and old cached pages on a regular basis. Use <a href="#expirytime">this form</a> to enable it.', 'wp-super-cache' ); ?> </p>
|
306 |
<form action="" method="POST">
|
307 |
<input type="hidden" name="action" value="dismiss_gc_warning" />
|
328 |
$wp_content_stat = stat(WP_CONTENT_DIR . '/');
|
329 |
$wp_content_mode = decoct( $wp_content_stat[ 'mode' ] & 0777 );
|
330 |
if( substr( $wp_content_mode, -2 ) == '77' ) {
|
331 |
+
?><div class="notice notice-warning"><h3><?php printf( __( 'Warning! %s is writeable!', 'wp-super-cache' ), WP_CONTENT_DIR ); ?></h3>
|
332 |
<p><?php printf( __( 'You should change the permissions on %s and make it more restrictive. Use your ftp client, or the following command to fix things:', 'wp-super-cache' ), WP_CONTENT_DIR ); ?> <code>chmod 755 <?php echo WP_CONTENT_DIR; ?>/</code></p>
|
333 |
<p><?php _e( '<a href="http://codex.wordpress.org/Changing_File_Permissions">This page</a> explains how to change file permissions.', 'wp-super-cache' ); ?></p>
|
334 |
<form action="" method="POST">
|
346 |
if ( function_exists( "is_main_site" ) && true == is_main_site() ) {
|
347 |
$home_path = trailingslashit( get_home_path() );
|
348 |
$scrules = implode( "\n", extract_from_markers( $home_path.'.htaccess', 'WPSuperCache' ) );
|
349 |
+
if ( $cache_enabled && $wp_cache_mod_rewrite && !$wp_cache_mobile_enabled && strpos( $scrules, addcslashes( str_replace( ', ', '|', $wp_cache_mobile_browsers ), ' ' ) ) ) {
|
350 |
+
echo '<div class="notice notice-warning"><h3>' . __( 'Mobile rewrite rules detected', 'wp-super-cache' ) . "</h3>";
|
351 |
echo "<p>" . __( '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' ) . "</p><p>" . __( 'This will have no affect on ordinary users but mobile users will see uncached pages.', 'wp-super-cache' ) . "</p></div>";
|
352 |
} elseif ( $wp_cache_mod_rewrite && $cache_enabled && $wp_cache_mobile_enabled && $scrules != '' && (
|
353 |
+
( '' != $wp_cache_mobile_prefixes && false === strpos( $scrules, addcslashes( str_replace( ', ', '|', $wp_cache_mobile_prefixes ), ' ' ) ) ) ||
|
354 |
+
( '' != $wp_cache_mobile_browsers && false === strpos( $scrules, addcslashes( str_replace( ', ', '|', $wp_cache_mobile_browsers ), ' ' ) ) ) )
|
355 |
) {
|
356 |
?>
|
357 |
+
<div class="notice notice-warning"><h3><?php _e( 'Rewrite rules must be updated', 'wp-super-cache' ); ?></h3>
|
358 |
<p><?php _e( 'The rewrite rules required by this plugin have changed or are missing. ', 'wp-super-cache' ); ?>
|
359 |
+
<?php _e( 'Mobile support requires extra rules in your .htaccess file, or you can set the plugin to simple mode. Here are your options (in order of difficulty):', 'wp-super-cache' ); ?>
|
360 |
+
<ol><li> <?php _e( 'Set the plugin to simple mode and enable mobile support.', 'wp-super-cache' ); ?></li>
|
361 |
<li> <?php _e( 'Scroll down the Advanced Settings page and click the <strong>Update Mod_Rewrite Rules</strong> button.', 'wp-super-cache' ); ?></li>
|
362 |
<li> <?php printf( __( 'Delete the plugin mod_rewrite rules in %s.htaccess enclosed by <code># BEGIN WPSuperCache</code> and <code># END WPSuperCache</code> and let the plugin regenerate them by reloading this page.', 'wp-super-cache' ), $home_path ); ?></li>
|
363 |
<li> <?php printf( __( 'Add the rules yourself. Edit %s.htaccess and find the block of code enclosed by the lines <code># BEGIN WPSuperCache</code> and <code># END WPSuperCache</code>. There are two sections that look very similar. Just below the line <code>%%{HTTP:Cookie} !^.*(comment_author_|%s|wp-postpass_).*$</code> add these lines: (do it twice, once for each section)', 'wp-super-cache' ), $home_path, wpsc_get_logged_in_cookie() ); ?></p>
|
364 |
+
<div style='padding: 2px; margin: 2px; border: 1px solid #333; width:400px; overflow: scroll'><pre><?php echo "RewriteCond %{HTTP_user_agent} !^.*(" . addcslashes( str_replace( ', ', '|', $wp_cache_mobile_browsers ), ' ' ) . ").*\nRewriteCond %{HTTP_user_agent} !^(" . addcslashes( str_replace( ', ', '|', $wp_cache_mobile_prefixes ), ' ' ) . ").*"; ?></pre></div></li></ol></div><?php
|
365 |
}
|
366 |
|
367 |
if ( $cache_enabled && $super_cache_enabled && $wp_cache_mod_rewrite && $scrules == '' ) {
|
368 |
+
?><div class='notice notice-warning'><h3><?php _e( 'Rewrite rules must be updated', 'wp-super-cache' ); ?></h3>
|
369 |
<p><?php _e( 'The rewrite rules required by this plugin have changed or are missing. ', 'wp-super-cache' ); ?>
|
370 |
<?php _e( 'Scroll down the Advanced Settings page and click the <strong>Update Mod_Rewrite Rules</strong> button.', 'wp-super-cache' ); ?></p></div><?php
|
371 |
}
|
380 |
}
|
381 |
}
|
382 |
if( isset( $missing_mods) && is_array( $missing_mods ) ) {
|
383 |
+
?><div class='notice notice-warning'><h3><?php _e( 'Missing Apache Modules', 'wp-super-cache' ); ?></h3>
|
384 |
+
<p><?php __( 'The following Apache modules are missing. The plugin will work in simple mode without them but in export mode, your visitors may see corrupted pages or out of date content however.', 'wp-super-cache' ); ?></p><?php
|
385 |
echo "<ul>";
|
386 |
foreach( $missing_mods as $req => $desc ) {
|
387 |
echo "<li> $req - $desc</li>";
|
400 |
if ( isset( $disable_supercache_htaccess_warning ) == false )
|
401 |
$disable_supercache_htaccess_warning = false;
|
402 |
if ( $dismiss_htaccess_warning == 0 && $wp_cache_mod_rewrite && $super_cache_enabled && $disable_supercache_htaccess_warning == false && get_option( 'siteurl' ) != get_option( 'home' ) ) {
|
403 |
+
?><div class="notice notice-info"><h3><?php _e( '.htaccess file may need to be moved', 'wp-super-cache' ); ?></h3>
|
|
|
404 |
<p><?php _e( 'It appears you have WordPress installed in a sub directory as described <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">here</a>. Unfortunately, WordPress writes to the .htaccess in the install directory, not where your site is served from.<br />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' ); ?></p>
|
405 |
<form action="" method="POST">
|
406 |
<input type="hidden" name="action" value="dismiss_htaccess_warning" />
|
427 |
return false; // Directory not found. Probably not cached.
|
428 |
if ( false == wp_cache_confirm_delete( $path ) || substr( $path, 0, strlen( get_supercache_dir() ) ) != get_supercache_dir() )
|
429 |
die( "Could not delete directory" );
|
430 |
+
wpsc_delete_files( $path );
|
|
|
|
|
|
|
431 |
wp_redirect( preg_replace( '/[ <>\'\"\r\n\t\(\)]/', '', $_GET[ 'path' ] ) );
|
432 |
die();
|
433 |
}
|
437 |
|
438 |
function wp_cache_manager_updates() {
|
439 |
global $wp_cache_mobile_enabled, $wp_cache_mfunc_enabled, $wp_supercache_cache_list, $wp_cache_config_file, $wp_cache_hello_world, $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_not_logged_in, $wp_cache_make_known_anon, $cache_path, $wp_cache_object_cache, $_wp_using_ext_object_cache, $wp_cache_refresh_single_only, $cache_compression, $wp_cache_mod_rewrite, $wp_supercache_304, $wp_super_cache_late_init, $wp_cache_front_page_checks, $cache_page_secret, $wp_cache_disable_utf8, $wp_cache_no_cache_for_get;
|
440 |
+
global $cache_schedule_type, $cache_max_time, $cache_time_interval, $wp_cache_shutdown_gc, $wpsc_save_headers;
|
441 |
|
442 |
if ( !wpsupercache_site_admin() )
|
443 |
return false;
|
455 |
$_POST[ 'action' ] = 'scupdates';
|
456 |
if( isset( $_POST[ 'wp_cache_easy_on' ] ) && $_POST[ 'wp_cache_easy_on' ] == 1 ) {
|
457 |
$_POST[ 'wp_cache_mobile_enabled' ] = 1;
|
458 |
+
$_POST[ 'wp_cache_enabled' ] = 1;
|
459 |
+
$_POST[ 'super_cache_enabled' ] = 1;
|
460 |
$_POST[ 'cache_rebuild_files' ] = 1;
|
461 |
unset( $_POST[ 'cache_compression' ] );
|
462 |
if ( $cache_path != WP_CONTENT_DIR . '/cache/' )
|
476 |
}
|
477 |
|
478 |
} else {
|
479 |
+
unset( $_POST[ 'wp_cache_enabled' ] );
|
|
|
480 |
wp_clear_scheduled_hook( 'wp_cache_check_site_hook' );
|
481 |
wp_clear_scheduled_hook( 'wp_cache_gc' );
|
482 |
wp_clear_scheduled_hook( 'wp_cache_gc_watcher' );
|
483 |
}
|
484 |
+
$advanced_settings = array( 'wp_super_cache_late_init', 'wp_cache_disable_utf8', 'wp_cache_no_cache_for_get', 'wp_supercache_304', 'wp_cache_mfunc_enabled', 'wp_cache_mobile_enabled', 'wp_cache_front_page_checks', 'wp_supercache_cache_list', 'wp_cache_hello_world', 'wp_cache_clear_on_post_edit', 'wp_cache_not_logged_in', 'wp_cache_make_known_anon','wp_cache_object_cache', 'wp_cache_refresh_single_only', 'cache_compression' );
|
485 |
foreach( $advanced_settings as $setting ) {
|
486 |
if ( isset( $$setting ) && $$setting == 1 ) {
|
487 |
$_POST[ $setting ] = 1;
|
564 |
}
|
565 |
wp_cache_replace_line('^ *\$wp_supercache_cache_list', "\$wp_supercache_cache_list = " . $wp_supercache_cache_list . ";", $wp_cache_config_file);
|
566 |
|
567 |
+
if ( isset( $_POST[ 'wp_cache_enabled' ] ) ) {
|
568 |
+
wp_cache_enable();
|
569 |
+
if ( ! defined( 'DISABLE_SUPERCACHE' ) ) {
|
570 |
+
wp_cache_debug( 'DISABLE_SUPERCACHE is not set, super_cache enabled.' );
|
571 |
+
wp_super_cache_enable();
|
572 |
+
$super_cache_enabled = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
573 |
}
|
574 |
} else {
|
575 |
wp_cache_disable();
|
576 |
+
wp_super_cache_disable();
|
577 |
+
$super_cache_enabled = false;
|
578 |
+
}
|
579 |
+
|
580 |
+
if ( $_POST[ 'wp_cache_mod_rewrite' ] == 1 ) {
|
581 |
+
$wp_cache_mod_rewrite = 1;
|
582 |
+
add_mod_rewrite_rules();
|
583 |
+
} else {
|
584 |
+
$wp_cache_mod_rewrite = 0; // cache files served by PHP
|
585 |
+
remove_mod_rewrite_rules();
|
586 |
}
|
587 |
+
wp_cache_setting( 'wp_cache_mod_rewrite', $wp_cache_mod_rewrite );
|
588 |
|
589 |
if( isset( $_POST[ 'wp_cache_hello_world' ] ) ) {
|
590 |
$wp_cache_hello_world = 1;
|
607 |
}
|
608 |
wp_cache_replace_line('^ *\$cache_rebuild_files', "\$cache_rebuild_files = " . $cache_rebuild_files . ";", $wp_cache_config_file);
|
609 |
|
610 |
+
if ( isset( $_POST[ 'wpsc_save_headers' ] ) ) {
|
611 |
+
$wpsc_save_headers = 1;
|
612 |
+
} else {
|
613 |
+
$wpsc_save_headers = 0;
|
614 |
+
}
|
615 |
+
wp_cache_replace_line('^ *\$wpsc_save_headers', "\$wpsc_save_headers = " . $wpsc_save_headers . ";", $wp_cache_config_file);
|
616 |
+
|
617 |
if( isset( $_POST[ 'wp_cache_mutex_disabled' ] ) ) {
|
618 |
$wp_cache_mutex_disabled = 0;
|
619 |
} else {
|
656 |
} else {
|
657 |
$wp_cache_refresh_single_only = 0;
|
658 |
}
|
659 |
+
wp_cache_setting( 'wp_cache_refresh_single_only', $wp_cache_refresh_single_only );
|
660 |
|
661 |
if ( defined( 'WPSC_DISABLE_COMPRESSION' ) ) {
|
662 |
$cache_compression = 0;
|
668 |
$new_cache_compression = 0;
|
669 |
}
|
670 |
if ( 1 == ini_get( 'zlib.output_compression' ) || "on" == strtolower( ini_get( 'zlib.output_compression' ) ) ) {
|
671 |
+
echo '<div class="notice notice-error">' . __( "<strong>Warning!</strong> You attempted to enable compression but <code>zlib.output_compression</code> is enabled. See #21 in the Troubleshooting section of the readme file.", 'wp-super-cache' ) . '</div>';
|
672 |
} else {
|
673 |
if ( $new_cache_compression != $cache_compression ) {
|
674 |
$cache_compression = $new_cache_compression;
|
687 |
function wp_cache_manager() {
|
688 |
global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world;
|
689 |
global $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_mobile_enabled, $wp_cache_mobile_browsers, $wp_cache_no_cache_for_get;
|
690 |
+
global $wp_cache_not_logged_in, $wp_cache_make_known_anon, $wp_supercache_cache_list, $cache_page_secret;
|
691 |
global $wp_super_cache_front_page_check, $wp_cache_object_cache, $_wp_using_ext_object_cache, $wp_cache_refresh_single_only, $wp_cache_mobile_prefixes;
|
692 |
+
global $wp_cache_mod_rewrite, $wp_supercache_304, $wp_super_cache_late_init, $wp_cache_front_page_checks, $wp_cache_disable_utf8, $wp_cache_mfunc_enabled;
|
693 |
+
global $wp_super_cache_comments, $wp_cache_home_path, $wpsc_save_headers;
|
694 |
|
695 |
if ( !wpsupercache_site_admin() )
|
696 |
return false;
|
718 |
$mobile_groups = apply_filters( 'cached_mobile_groups', array() ); // Group mobile user agents by capabilities. Lump them all together by default
|
719 |
// mobile_groups = array( 'apple' => array( 'ipod', 'iphone' ), 'nokia' => array( 'nokia5800', 'symbianos' ) );
|
720 |
|
721 |
+
$wp_cache_mobile_browsers = implode( ', ', $wp_cache_mobile_browsers );
|
722 |
+
$wp_cache_mobile_prefixes = implode( ', ', $wp_cache_mobile_prefixes );
|
723 |
+
|
724 |
if ( false == apply_filters( 'wp_super_cache_error_checking', true ) )
|
725 |
return false;
|
726 |
|
763 |
#nav h2 {
|
764 |
border-bottom: 1px solid #ccc;
|
765 |
padding-bottom: 0;
|
766 |
+
height: 2em;
|
767 |
}
|
768 |
table.wpsc-settings-table {
|
769 |
clear: both;
|
781 |
$wp_cache_mod_rewrite = 1;
|
782 |
}
|
783 |
|
784 |
+
if ( ! isset( $_GET[ 'tab' ] ) && $cache_enabled && ( $wp_cache_mod_rewrite || $super_cache_enabled == false ) ) {
|
|
|
|
|
|
|
785 |
$_GET[ 'tab' ] = 'settings';
|
786 |
+
echo '<div class="notice notice-info is-dismissible"><p>' . __( 'Notice: <em>Expert mode caching enabled</em>. Showing Advanced Settings Page by default.', 'wp-super-cache' ) . '</p></div>';
|
787 |
+
}
|
788 |
+
if ( ! isset( $_GET[ 'tab' ] ) ) {
|
789 |
+
$_GET[ 'tab' ] = 'easy';
|
790 |
}
|
791 |
+
|
792 |
wpsc_admin_tabs();
|
793 |
|
794 |
if ( isset( $wp_super_cache_front_page_check ) && $wp_super_cache_front_page_check == 1 && !wp_next_scheduled( 'wp_cache_check_site_hook' ) ) {
|
808 |
}
|
809 |
$home_path = parse_url( site_url() );
|
810 |
$home_path = trailingslashit( array_key_exists( 'path', $home_path ) ? $home_path[ 'path' ] : '' );
|
811 |
+
if (! isset( $wp_cache_home_path ) ) {
|
812 |
$wp_cache_home_path = '/';
|
813 |
+
wp_cache_setting( 'wp_cache_home_path', '/' );
|
814 |
+
}
|
815 |
if ( "$home_path" != "$wp_cache_home_path" )
|
816 |
+
wp_cache_setting( 'wp_cache_home_path', $home_path );
|
817 |
|
818 |
|
819 |
if( $wp_cache_mobile_enabled == 1 ) {
|
836 |
echo '<a name="preload"></a>';
|
837 |
if ( $super_cache_enabled == true && false == defined( 'DISABLESUPERCACHEPRELOADING' ) ) {
|
838 |
global $wp_cache_preload_interval, $wp_cache_preload_on, $wp_cache_preload_taxonomies, $wp_cache_preload_email_me, $wp_cache_preload_email_volume, $wp_cache_preload_posts, $wpdb;
|
839 |
+
$posts_count = wp_count_posts();
|
840 |
+
$count = $posts_count->publish;
|
841 |
if ( $count > 1000 ) {
|
842 |
$min_refresh_interval = 720;
|
843 |
} else {
|
844 |
$min_refresh_interval = 30;
|
845 |
}
|
846 |
+
$return = wpsc_preload_settings( $min_refresh_interval );
|
847 |
+
if ( empty( $return ) == false ) {
|
848 |
+
foreach( $return as $message ) {
|
849 |
+
echo $message;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
850 |
}
|
851 |
}
|
852 |
echo '<p>' . __( 'This will cache every published post and page on your site. It will create supercache static files so unknown visitors (including bots) will hit a cached page. This will probably help your Google ranking as they are using speed as a metric when judging websites now.', 'wp-super-cache' ) . '</p>';
|
853 |
echo '<p>' . __( 'Preloading creates lots of files however. Caching is done from the newest post to the oldest so please consider only caching the newest if you have lots (10,000+) of posts. This is especially important on shared hosting.', 'wp-super-cache' ) . '</p>';
|
854 |
+
echo '<p>' . __( 'In ’Preload Mode’ regular garbage collection will be disabled so that old cache files are not deleted. This is a recommended setting when the cache is preloaded.', 'wp-super-cache' ) . '</p>';
|
855 |
echo '<form name="cache_filler" action="" method="POST">';
|
856 |
echo '<input type="hidden" name="action" value="preload" />';
|
857 |
echo '<input type="hidden" name="page" value="wpsupercache" />';
|
858 |
+
echo '<p>' . sprintf( __( 'Refresh preloaded cache files every %s minutes. (0 to disable, minimum %d minutes.)', 'wp-super-cache' ), "<input type='text' size=4 name='wp_cache_preload_interval' value='" . (int)$wp_cache_preload_interval . "' />", $min_refresh_interval ) . '</p>';
|
859 |
if ( $count > 100 ) {
|
860 |
$step = (int)( $count / 10 );
|
861 |
|
862 |
+
$select = "<select name='wp_cache_preload_posts' size=1>";
|
863 |
$select .= "<option value='all' ";
|
864 |
if ( !isset( $wp_cache_preload_posts ) || $wp_cache_preload_posts == 'all' ) {
|
865 |
$checked = 'selectect=1 ';
|
883 |
$select .= "</select>";
|
884 |
echo '<p>' . sprintf( __( 'Preload %s posts.', 'wp-super-cache' ), $select ) . '</p>';
|
885 |
} else {
|
886 |
+
echo '<input type="hidden" name="wp_cache_preload_posts" value="' . $count . '" />';
|
887 |
}
|
888 |
|
889 |
+
echo '<input type="checkbox" name="wp_cache_preload_on" value="1" ';
|
890 |
echo $wp_cache_preload_on == 1 ? 'checked=1' : '';
|
891 |
+
echo ' /> ' . __( 'Preload mode (garbage collection disabled. Recommended.)', 'wp-super-cache' ) . '<br />';
|
892 |
+
echo '<input type="checkbox" name="wp_cache_preload_taxonomies" value="1" ';
|
893 |
echo $wp_cache_preload_taxonomies == 1 ? 'checked=1' : '';
|
894 |
echo ' /> ' . __( 'Preload tags, categories and other taxonomies.', 'wp-super-cache' ) . '<br />';
|
895 |
+
echo __( 'Send me status emails when files are refreshed.', 'wp-super-cache' ) . '<br />';
|
|
|
|
|
896 |
if ( !isset( $wp_cache_preload_email_volume ) )
|
897 |
+
$wp_cache_preload_email_volume = 'none';
|
898 |
+
echo '<select type="select" name="wp_cache_preload_email_volume">';
|
899 |
+
echo '<option value="none" '. selected( 'none', $wp_cache_preload_email_volume ) . '>'. __( 'No Emails', 'wp-super-cache' ) . '</option>';
|
900 |
+
echo '<option value="many" '. selected( 'many', $wp_cache_preload_email_volume ) . '>'. __( 'Many emails, 2 emails per 100 posts.', 'wp-super-cache' ) . '</option>';
|
901 |
+
echo '<option value="medium" '. selected( 'medium', $wp_cache_preload_email_volume ) . '>'. __( 'Medium, 1 email per 100 posts.', 'wp-super-cache' ) . '</option>';
|
902 |
+
echo '<option value="less" '. selected( 'less', $wp_cache_preload_email_volume ) . '>'. __( 'Less emails, 1 at the start and 1 at the end of preloading all posts.', 'wp-super-cache' ) . '</option>';
|
903 |
+
echo "</select>";
|
|
|
|
|
|
|
904 |
|
905 |
$currently_preloading = false;
|
906 |
|
907 |
next_preload_message( 'wp_cache_preload_hook', __( 'Refresh of cache in %d hours %d minutes and %d seconds.', 'wp-super-cache' ), 60 );
|
908 |
next_preload_message( 'wp_cache_full_preload_hook', __( 'Full refresh of cache in %d hours %d minutes and %d seconds.', 'wp-super-cache' ) );
|
909 |
|
910 |
+
if ( wp_next_scheduled( 'wp_cache_preload_hook' ) || wp_next_scheduled( 'wp_cache_full_preload_hook' ) ) {
|
911 |
+
$currently_preloading = true;
|
912 |
+
}
|
913 |
$preload_counter = get_option( 'preload_cache_counter' );
|
914 |
if ( isset( $preload_counter[ 'first' ] ) ) // converted from int to array
|
915 |
update_option( 'preload_cache_counter', array( 'c' => $preload_counter[ 'c' ], 't' => time() ) );
|
921 |
echo "<p>" . sprintf( __( "<strong>Page last cached:</strong> %s", 'wp-super-cache' ), $url ) . "</p>";
|
922 |
}
|
923 |
}
|
924 |
+
echo '<div class="submit"><input class="button-primary" type="submit" name="preload" value="' . __( 'Update Settings', 'wp-super-cache' ) . '" />';
|
925 |
+
echo '</div>';
|
926 |
+
wp_nonce_field('wp-cache');
|
927 |
+
echo '</form>';
|
928 |
+
echo '<form name="do_preload" action="" method="POST">';
|
929 |
+
echo '<input type="hidden" name="action" value="preload" />';
|
930 |
+
echo '<input type="hidden" name="page" value="wpsupercache" />';
|
931 |
+
echo '<div class="submit">';
|
932 |
+
if ( false == $currently_preloading ) {
|
933 |
+
echo '<input class="button-primary" type="submit" name="preload_now" value="' . __( 'Preload Cache Now', 'wp-super-cache' ) . '" />';
|
934 |
+
} else {
|
935 |
+
echo '<input class="button-primary" type="submit" name="preload_off" value="' . __( 'Cancel Cache Preload', 'wp-super-cache' ) . '" />';
|
936 |
}
|
937 |
echo '</div>';
|
938 |
wp_nonce_field('wp-cache');
|
939 |
echo '</form>';
|
940 |
} else {
|
941 |
+
echo '<div class="notice notice-warning"><p>' . __( 'Preloading of cache disabled. Please make sure simple or expert mode is enabled or talk to your host administrator.', 'wp-super-cache' ) . '</p></div>';
|
942 |
}
|
943 |
break;
|
944 |
case 'plugins':
|
955 |
echo '<input type="hidden" name="action" value="scupdates" />';
|
956 |
?><table class="form-table">
|
957 |
<tr valign="top">
|
958 |
+
<th scope="row"><label for="wp_cache_enabled"><?php _e( 'Caching', 'wp-super-cache' ); ?></label></th>
|
959 |
<td>
|
960 |
<fieldset>
|
961 |
+
<legend class="hidden"><?php _e( 'Caching', 'wp-super-cache' ); ?></legend>
|
962 |
+
<label><input type='checkbox' name='wp_cache_enabled' value='1' <?php if ( $cache_enabled == true ) { echo 'checked=checked'; } ?>> <?php _e( 'Enable Caching', 'wp-super-cache' ); ?><br />
|
963 |
+
</fieldset>
|
964 |
+
</td>
|
965 |
+
</tr>
|
966 |
+
<tr valign="top">
|
967 |
+
<th scope="row"><label for="super_cache_enabled"><?php _e( 'Cache Delivery Method', 'wp-super-cache' ); ?></label></th>
|
968 |
+
<td>
|
969 |
+
<label><input type='radio' name='wp_cache_mod_rewrite' <?php if ( $wp_cache_mod_rewrite == 0 ) echo "checked"; ?> value='0'> <?php _e( '<acronym title="Use PHP to serve cached files">Simple</acronym>', 'wp-super-cache' ); echo " <em>(" . __( "Recommended", "wp-super-cache" ) . ")</em>"; ?></label><br />
|
970 |
+
<label><input type='radio' name='wp_cache_mod_rewrite' <?php if ( $wp_cache_mod_rewrite == 1 ) echo "checked"; ?> value='1'> <?php _e( '<acronym title="Use mod_rewrite to serve cached files">Expert</acronym>', 'wp-super-cache' ); ?></label><br />
|
971 |
+
<em><small class='description'><?php _e( 'Expert caching requires changes to important server files and may require manual intervention if enabled.', 'wp-super-cache' ); ?></small></em>
|
972 |
</fieldset>
|
973 |
</td>
|
974 |
</tr>
|
977 |
<td>
|
978 |
<fieldset>
|
979 |
<legend class="hidden">Miscellaneous</legend>
|
980 |
+
<label><input type='checkbox' name='wp_cache_not_logged_in' <?php if ( $wp_cache_not_logged_in ) echo "checked"; ?> value='1'> <?php _e( 'Don’t cache pages for <acronym title="Logged in users and those that comment">known users</acronym>.', 'wp-super-cache' ); echo " <em>(" . __( "Recommended", "wp-super-cache" ) . ")</em>"; ?></label><br />
|
981 |
+
<label><input type='checkbox' name='wp_cache_no_cache_for_get' <?php if( $wp_cache_no_cache_for_get ) echo "checked"; ?> value='1'> <?php _e( 'Don’t cache pages with GET parameters. (?x=y at the end of a url)', 'wp-super-cache' ); ?></label><br />
|
982 |
<?php if ( false == defined( 'WPSC_DISABLE_COMPRESSION' ) ) { ?>
|
983 |
<?php if ( false == function_exists( 'gzencode' ) ) { ?>
|
984 |
<em><?php _e( 'Warning! Compression is disabled as gzencode() function was not found.', 'wp-super-cache' ); ?></em><br />
|
988 |
<?php }
|
989 |
}
|
990 |
?>
|
991 |
+
<label><input type='checkbox' name='wpsc_save_headers' <?php if ( $wpsc_save_headers ) echo "checked"; ?> value='1' /> <?php _e( 'Cache HTTP headers with page content.', 'wp-super-cache' ); ?></label><br />
|
992 |
<label><input type='checkbox' name='cache_rebuild_files' <?php if ( $cache_rebuild_files ) echo "checked"; ?> value='1'> <?php _e( 'Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated.', 'wp-super-cache' ); echo " <em>(" . __( "Recommended", "wp-super-cache" ) . ")</em>"; ?></label><br />
|
993 |
<?php
|
994 |
$disable_304 = true;
|
1004 |
?><em><?php _e( '304 support is disabled by default because some hosts have had problems with the headers used in the past.', 'wp-super-cache' ); ?></em><br /><?php
|
1005 |
}
|
1006 |
?>
|
|
|
1007 |
<label><input type='checkbox' name='wp_cache_make_known_anon' <?php if( $wp_cache_make_known_anon ) echo "checked"; ?> value='1'> <?php _e( 'Make known users anonymous so they’re served supercached static files.', 'wp-super-cache' ); ?></label><br />
|
1008 |
<label><input type='checkbox' name='wp_cache_hello_world' <?php if( $wp_cache_hello_world ) echo "checked"; ?> value='1'> <?php printf( __( 'Proudly tell the world your server is <a href="%s">Stephen Fry proof</a>! (places a message in your blog’s footer)', 'wp-super-cache' ), 'https://twitter.com/#!/HibbsLupusTrust/statuses/136429993059291136' ); ?></label><br />
|
1009 |
</legend>
|
1015 |
<td>
|
1016 |
<fieldset>
|
1017 |
<legend class="hidden">Advanced</legend>
|
1018 |
+
<label><input type='checkbox' name='wp_cache_mfunc_enabled' <?php if( $wp_cache_mfunc_enabled ) echo "checked"; ?> value='1' <?php if ( $wp_cache_mod_rewrite ) { echo "disabled='disabled'"; } ?>> <?php _e( 'Enable dynamic caching. (See <a href="http://wordpress.org/plugins/wp-super-cache/faq/">FAQ</a> or wp-super-cache/plugins/dynamic-cache-test.php for example code.)', 'wp-super-cache' ); ?></label><br />
|
1019 |
<label><input type='checkbox' name='wp_cache_mobile_enabled' <?php if( $wp_cache_mobile_enabled ) echo "checked"; ?> value='1'> <?php _e( 'Mobile device support. (External plugin or theme required. See the <a href="http://wordpress.org/plugins/wp-super-cache/faq/">FAQ</a> for further details.)', 'wp-super-cache' ); ?></label><br />
|
1020 |
<?php if ( $wp_cache_mobile_enabled ) {
|
1021 |
+
echo '<blockquote><h4>' . __( 'Mobile Browsers', 'wp-super-cache' ) . '</h4>' . esc_html( $wp_cache_mobile_browsers ) . "<br /><h4>" . __( 'Mobile Prefixes', 'wp-super-cache' ) . "</h4>" . esc_html( $wp_cache_mobile_prefixes ) . "<br /></blockquote>";
|
1022 |
} ?>
|
1023 |
<label><input type='checkbox' name='wp_cache_disable_utf8' <?php if( $wp_cache_disable_utf8 ) echo "checked"; ?> value='1'> <?php _e( 'Remove UTF8/blog charset support from .htaccess file. Only necessary if you see odd characters or punctuation looks incorrect. Requires rewrite rules update.', 'wp-super-cache' ); ?></label><br />
|
1024 |
<label><input type='checkbox' name='wp_cache_clear_on_post_edit' <?php if( $wp_cache_clear_on_post_edit ) echo "checked"; ?> value='1'> <?php _e( 'Clear all cache files when a post or page is published or updated.', 'wp-super-cache' ); ?></label><br />
|
1028 |
<?php if( false == defined( 'WPSC_DISABLE_LOCKING' ) ) { ?>
|
1029 |
<label><input type='checkbox' name='wp_cache_mutex_disabled' <?php if( !$wp_cache_mutex_disabled ) echo "checked"; ?> value='0'> <?php _e( 'Coarse file locking. You do not need this as it will slow down your website.', 'wp-super-cache' ); ?></label><br />
|
1030 |
<?php } ?>
|
1031 |
+
<label><input type='checkbox' name='wp_super_cache_late_init' <?php if( $wp_super_cache_late_init ) echo "checked"; ?> value='1'> <?php _e( 'Late init. Display cached files after WordPress has loaded.', 'wp-super-cache' ); ?></label><br />
|
1032 |
<?php if ( $_wp_using_ext_object_cache ) {
|
1033 |
?><label><input type='checkbox' name='wp_cache_object_cache' <?php if( $wp_cache_object_cache ) echo "checked"; ?> value='1'> <?php echo __( 'Use object cache to store cached files.', 'wp-super-cache' ) . ' ' . __( '(Experimental)', 'wp-super-cache' ); ?></label><?php
|
1034 |
}?>
|
1050 |
<?php if ( get_site_option( 'wp_super_cache_index_detected' ) && strlen( $cache_path ) > strlen( ABSPATH ) && ABSPATH == substr( $cache_path, 0, strlen( ABSPATH ) ) ) {
|
1051 |
$msg = __( 'The plugin detected a bare directory index in your cache directory, which would let visitors see your cache files directly and might expose private posts.', 'wp-super-cache' );
|
1052 |
if ( $super_cache_enabled && $wp_cache_mod_rewrite == 1 ) {
|
1053 |
+
$msg .= ' ' . __( 'You are using expert mode to serve cache files so the plugin has added <q>Options -Indexes</q> to the .htaccess file in the cache directory to disable indexes. However, if that does not work, you should contact your system administrator or support and ask for them to be disabled, or use simple mode and move the cache outside of the web root.', 'wp-super-cache' );
|
1054 |
} else {
|
1055 |
+
$msg .= ' <strong>' . sprintf( __( 'index.html files have been added in key directories, but unless directory indexes are disabled, it is probably better to store the cache files outside of the web root of %s', 'wp-super-cache' ), ABSPATH ) . '</strong>';
|
1056 |
}
|
1057 |
echo "<li>$msg</li>";
|
1058 |
} ?>
|
1071 |
<ol>
|
1072 |
<li><?php _e( 'Uninstall this plugin on the plugins page. It will automatically clean up after itself. If manual intervention is required, then simple instructions are provided.', 'wp-super-cache' ); ?></li>
|
1073 |
<li><?php printf( __( 'If uninstalling this plugin, make sure the directory <em>%s</em> is writeable by the webserver so the files <em>advanced-cache.php</em> and <em>cache-config.php</em> can be deleted automatically. (Making sure those files are writeable is probably a good idea!)', 'wp-super-cache' ), WP_CONTENT_DIR ); ?></li>
|
1074 |
+
<li><?php printf( __( 'Please see the <a href="%1$s/wp-super-cache/readme.txt">readme.txt</a> for instructions on uninstalling this script. Look for the heading, "How to uninstall WP Super Cache".', 'wp-super-cache' ), plugins_url() ); ?></li><?php
|
1075 |
echo "<li><em>" . sprintf( __( 'Need help? Check the <a href="%1$s">Super Cache readme file</a>. It includes installation documentation, a FAQ and Troubleshooting tips. The <a href="%2$s">support forum</a> is also available. Your question may already have been answered.', 'wp-super-cache' ), 'http://wordpress.org/plugins/wp-super-cache/', 'http://wordpress.org/tags/wp-super-cache?forum_id=10' ) . "</em></li>";
|
1076 |
echo "</ol>";
|
1077 |
|
1117 |
if ( $cache_enabled && !$wp_cache_mod_rewrite ) {
|
1118 |
$scrules = trim( implode( "\n", extract_from_markers( trailingslashit( get_home_path() ) . '.htaccess', 'WPSuperCache' ) ) );
|
1119 |
if ( $scrules != '' ) {
|
1120 |
+
echo "<p><strong>" . __( 'Notice: Simple caching enabled but Supercache mod_rewrite rules from expert mode detected. Cached files will be served using those rules. If your site is working ok, please ignore this message. Otherwise, you can edit the .htaccess file in the root of your install and remove the SuperCache rules.', 'wp-super-cache' ) . '</strong></p>';
|
1121 |
}
|
1122 |
}
|
1123 |
echo "<div class='submit'><input class='button-primary' type='submit' " . SUBMITDISABLED . " value='" . __( 'Update Status', 'wp-super-cache' ) . "' /></div></form>";
|
1128 |
$url = trailingslashit( get_bloginfo( 'url' ) );
|
1129 |
if ( isset( $_POST[ 'httponly' ] ) )
|
1130 |
$url = str_replace( 'https://', 'http://', $url );
|
1131 |
+
$test_messages = array( __( 'Fetching %s to prime cache: ', 'wp-super-cache' ), __( 'Fetching first copy of %s: ', 'wp-super-cache' ), __( 'Fetching second copy of %s: ', 'wp-super-cache' ) );
|
1132 |
+
$c = 0;
|
1133 |
+
$cache_test_error = false;
|
1134 |
+
$page = array();
|
1135 |
+
foreach( $test_messages as $message ) {
|
1136 |
+
echo "<p>" . sprintf( $message, $url );
|
1137 |
+
$page[ $c ] = wp_remote_get( $url, array('timeout' => 60, 'blocking' => true ) );
|
1138 |
+
if ( !is_wp_error( $page[ $c ] ) ) {
|
1139 |
+
$fp = fopen( $cache_path . $c . ".html", "w" );
|
1140 |
+
fwrite( $fp, $page[ $c ][ 'body' ] );
|
1141 |
+
fclose( $fp );
|
1142 |
+
echo '<span style="color: #0a0; font-weight: bold;">' . __( 'OK', 'wp-super-cache' ) . "</span> (<a href='" . WP_CONTENT_URL . "/cache/" . $c . ".html'>" . $c . ".html</a>)</p>";
|
1143 |
+
sleep( 1 );
|
1144 |
+
} else {
|
1145 |
+
$cache_test_error = true;
|
1146 |
+
echo '<span style="color: #a00; font-weight: bold;">' . __( 'FAILED', 'wp-super-cache' ) . "</span></p>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1147 |
$errors = '';
|
1148 |
$messages = '';
|
1149 |
+
foreach ( $page[ $c ]->get_error_codes() as $code ) {
|
1150 |
+
$severity = $page[ $c ]->get_error_data( $code );
|
1151 |
+
foreach ( $page[ $c ]->get_error_messages( $code ) as $err ) {
|
1152 |
+
$errors .= $severity . ': ' . $err . "<br />\n";
|
1153 |
}
|
1154 |
}
|
1155 |
+
if ( '' != $errors )
|
1156 |
+
echo "<p>" . sprintf( __( '<strong>Errors:</strong> %s', 'wp-super-cache' ), $errors ) . "</p>";
|
|
|
|
|
|
|
1157 |
}
|
1158 |
+
$c ++;
|
1159 |
+
}
|
1160 |
+
|
1161 |
+
if ( false == $cache_test_error ) {
|
1162 |
+
echo '<ul><li>' . sprintf( __( 'Page %d: %d (%s)', 'wp-super-cache' ), 1, $page[ 1 ][ 'response' ][ 'code' ], $page[ 1 ][ 'response' ][ 'message' ] ) . '</li>';
|
1163 |
+
echo '<li>' . sprintf( __( 'Page %d: %d (%s)', 'wp-super-cache' ), 2, $page[ 2 ][ 'response' ][ 'code' ], $page[ 2 ][ 'response' ][ 'message' ] ) . '</li></ul>';
|
1164 |
}
|
1165 |
|
1166 |
+
if ( false == $cache_test_error && preg_match( '/(Cached page generated by WP-Super-Cache on) ([0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*)/', $page[ 1 ][ 'body' ], $matches1 ) &&
|
1167 |
+
preg_match( '/(Cached page generated by WP-Super-Cache on) ([0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*)/', $page[ 2 ][ 'body' ], $matches2 ) && $matches1[2] == $matches2[2] ) {
|
1168 |
echo '<p>' . sprintf( __( 'Page 1: %s', 'wp-super-cache' ), $matches1[ 2 ] ) . '</p>';
|
1169 |
echo '<p>' . sprintf( __( 'Page 2: %s', 'wp-super-cache' ), $matches2[ 2 ] ) . '</p>';
|
1170 |
echo '<p><span style="color: #0a0; font-weight: bold;">' . __( 'The timestamps on both pages match!', 'wp-super-cache' ) . '</span></p>';
|
1175 |
echo '<li>' . __( 'Enable logging on the Debug page here. That should help you track down the problem.', 'wp-super-cache' ) . '</li>';
|
1176 |
echo '<li>' . __( 'You should check Page 1 and Page 2 above for errors. Your local server configuration may not allow your website to access itself.', 'wp-super-cache' ) . '</li>';
|
1177 |
echo "</ol>";
|
|
|
1178 |
}
|
1179 |
}
|
1180 |
echo '<form name="cache_tester" action="" method="post">';
|
1181 |
echo '<input type="hidden" name="action" value="test" />';
|
1182 |
if ( isset( $_SERVER['HTTPS' ] ) && 'on' == strtolower( $_SERVER['HTTPS' ] ) )
|
1183 |
echo "<input type='checkbox' name='httponly' checked='checked' value='1' /> " . __( 'Send non-secure (non https) request for homepage', 'wp-super-cache' );
|
1184 |
+
if ( isset( $wp_super_cache_comments ) && $wp_super_cache_comments == 0 ) {
|
1185 |
+
echo "<p>" . __( '<strong>Warning!</strong> Cache comments are currently disabled. Please go to the Debug page and enable Cache Status Messages there. You should clear the cache before testing.', 'wp-super-cache' ) . "</p>";
|
1186 |
+
echo '<div class="submit"><input disabled style="color: #aaa" class="button-secondary" type="submit" name="test" value="' . __( 'Test Cache', 'wp-super-cache' ) . '" /></div>';
|
1187 |
+
} else {
|
1188 |
+
echo '<div class="submit"><input class="button-secondary" type="submit" name="test" value="' . __( 'Test Cache', 'wp-super-cache' ) . '" /></div>';
|
1189 |
+
}
|
1190 |
wp_nonce_field('wp-cache');
|
1191 |
echo '</form>';
|
1192 |
}
|
1201 |
if ( ( defined( 'VHOST' ) || defined( 'SUBDOMAIN_INSTALL' ) || defined( 'SUNRISE' ) || ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) == true ) ) && wpsupercache_site_admin() ) {
|
1202 |
echo '<form name="wp_cache_content_delete" action="#listfiles" method="post">';
|
1203 |
echo '<input type="hidden" name="wp_delete_all_cache" />';
|
1204 |
+
echo '<div class="submit"><input id="deleteallpost" class="button-secondary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Delete Cache On All Blogs', 'wp-super-cache' ) . '" /></div>';
|
1205 |
wp_nonce_field('wp-cache');
|
1206 |
echo "</form><br />\n";
|
1207 |
}
|
1208 |
?>
|
1209 |
<h3 class="clear"><?php _e( 'Recommended Links and Plugins', 'wp-super-cache' ); ?></h3>
|
1210 |
<p><?php _e( 'Caching is only one part of making a website faster. Here are some other plugins that will help:', 'wp-super-cache' ); ?></p>
|
1211 |
+
<ul style="list-style: square; margin-left: 2em;">
|
1212 |
+
<li><?php printf( __( '<a href="%s">Jetpack</a> provides everything you need to build a successful WordPress website including an image/photo CDN (free) and a video hosting service (paid).', 'wp-super-cache' ), 'https://jetpack.com/redirect/?source=jitm-wpsc-recommended' ); ?></li>
|
1213 |
<li><?php printf( __( '<a href="%s">Yahoo! Yslow</a> is an extension for the Firefox add-on Firebug. It analyzes web pages and suggests ways to improve their performance based on a set of rules for high performance web pages. Also try the performance tools online at <a href="%s">GTMetrix</a>.', 'wp-super-cache' ), 'http://developer.yahoo.com/yslow/', 'http://gtmetrix.com/' ); ?></li>
|
1214 |
<li><?php printf( __( '<a href="%s">Use Google Libraries</a> allows you to load some commonly used Javascript libraries from Google webservers. Ironically, it may reduce your Yslow score.', 'wp-super-cache' ), 'http://wordpress.org/plugins/use-google-libraries/' ); ?></li>
|
1215 |
<li><?php printf( __( '<strong>Advanced users only:</strong> Install an object cache. Choose from <a href="%s">Memcached</a>, <a href="%s">XCache</a>, <a href="%s">eAcccelerator</a> and others.', 'wp-super-cache' ), 'http://wordpress.org/plugins/memcached/', 'http://neosmart.net/dl.php?id=12', 'http://neosmart.net/dl.php?id=13' ); ?></li>
|
1216 |
<li><?php printf( __( '<a href="%s">Cron View</a> is a useful plugin to use when trying to debug garbage collection and preload problems.', 'wp-super-cache' ), 'http://wordpress.org/plugins/cron-view/' ); ?></li>
|
1217 |
+
</ul>
|
1218 |
|
1219 |
<?php
|
1220 |
break;
|
1223 |
?>
|
1224 |
</fieldset>
|
1225 |
</td><td valign='top' style='width: 300px'>
|
1226 |
+
<div style='background: #ffc; border: 1px solid #333; margin: 2px; padding: 3px 15px'>
|
1227 |
+
<h3><?php _e( 'More Site Speed Tools', 'wp-super-cache' ); ?></h3>
|
1228 |
+
<ul style="list-style: square; margin-left: 2em;">
|
1229 |
+
<li><a href="https://jetpack.com/redirect/?source=jitm-wpsc-generic"><?php _e( 'Speed up images and photos (free)', 'wp-super-cache' ); ?></a></li>
|
1230 |
+
<li><a href="https://jetpack.com/redirect/?source=jitm-wpsc-premium"><?php _e( 'Fast video hosting (paid)', 'wp-super-cache' ); ?></a></li>
|
1231 |
+
</ul>
|
1232 |
+
<h3><?php _e( 'Need Help?', 'wp-super-cache' ); ?></h3>
|
1233 |
<ol>
|
1234 |
+
<li><?php printf( __( 'Use the <a href="%1$s">Debug tab</a> for diagnostics.', 'wp-super-cache' ), admin_url( 'options-general.php?page=wpsupercache&tab=debug' ) ); ?></li>
|
1235 |
+
<li><?php printf( __( 'Check out the <a href="%1$s">support forum</a> and <a href="%2$s">FAQ</a>.', 'wp-super-cache' ), 'https://wordpress.org/support/plugin/wp-super-cache', 'http://wordpress.org/plugins/wp-super-cache/#faq' ); ?></li>
|
1236 |
+
<li><?php printf( __( 'Visit the <a href="%1$s">plugin homepage</a>.', 'wp-super-cache' ), 'http://wordpress.org/plugins/wp-super-cache/' ); ?></li>
|
1237 |
+
<li><?php printf( __( 'Try out the <a href="%1$s">development version</a> for the latest fixes (<a href="%2$s">changelog</a>).', 'wp-super-cache' ), 'https://odd.blog/y/2o', 'https://plugins.trac.wordpress.org/log/wp-super-cache/' ); ?></li>
|
|
|
1238 |
</ol>
|
1239 |
+
<h3><?php _e( 'Rate This Plugin', 'wp-super-cache' ); ?></h3>
|
1240 |
+
<p><?php printf( __( 'Please <a href="%s">rate us</a> and give feedback.', 'wp-super-cache' ), 'https://wordpress.org/support/plugin/wp-super-cache/reviews?rate=5#new-post' ); ?></p>
|
1241 |
|
1242 |
<?php
|
1243 |
if ( isset( $wp_supercache_cache_list ) && $wp_supercache_cache_list ) {
|
1311 |
if ( $wp_db_version >= 15477 ) {
|
1312 |
echo '<div id="nav"><h2 class="themes-php">';
|
1313 |
echo implode( "", $links );
|
1314 |
+
echo '</div></h2>';
|
1315 |
} else {
|
1316 |
echo implode( " | ", $links );
|
1317 |
}
|
1318 |
}
|
1319 |
|
1320 |
function wsc_mod_rewrite() {
|
1321 |
+
global $valid_nonce, $cache_path, $wp_cache_mod_rewrite;
|
1322 |
|
1323 |
if ( defined( 'WPSC_DISABLE_HTACCESS_UPDATE' ) )
|
1324 |
return false;
|
1325 |
|
1326 |
if ( !$wp_cache_mod_rewrite )
|
1327 |
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1328 |
?>
|
1329 |
<a name="modrewrite"></a><fieldset class="options">
|
1330 |
+
<h3><?php _e( 'Mod Rewrite Rules', 'wp-super-cache' ); ?></h3>
|
1331 |
+
<p><?php _e( 'When Expert cache delivery is enabled a file called <em>.htaccess</em> is modified. It should probably be in the same directory as your wp-config.php. This file has special rules that serve the cached files very quickly to visitors without ever executing PHP. The .htaccess file can be updated automatically, but if that fails, the rules will be displayed here and it can be edited by you. You will not need to update the rules unless a warning shows here.', 'wp-super-cache' ); ?></p>
|
1332 |
|
1333 |
+
<?php
|
1334 |
extract( wpsc_get_htaccess_info() );
|
1335 |
$dohtaccess = true;
|
1336 |
+
if( strpos( $wprules, 'wordpressuser' ) ) { // Need to clear out old mod_rewrite rules
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1337 |
echo "<p><strong>" . __( 'Thank you for upgrading.', 'wp-super-cache' ) . "</strong> " . sprintf( __( 'The mod_rewrite rules changed since you last installed this plugin. Unfortunately, you must remove the old supercache rules before the new ones are updated. Refresh this page when you have edited your .htaccess file. If you wish to manually upgrade, change the following line: %1$s so it looks like this: %2$s The only changes are "HTTP_COOKIE" becomes "HTTP:Cookie" and "wordpressuser" becomes "wordpress". This is a WordPress 2.5 change but it’s backwards compatible with older versions if you’re brave enough to use them.', 'wp-super-cache' ), '<blockquote><code>RewriteCond %{HTTP_COOKIE} !^.*wordpressuser.*$</code></blockquote>', '<blockquote><code>RewriteCond %{HTTP:Cookie} !^.*wordpress.*$</code></blockquote>' ) . "</p>";
|
1338 |
echo "</fieldset></div>";
|
1339 |
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1340 |
}
|
1341 |
if ( $dohtaccess && !isset( $_POST[ 'updatehtaccess' ] ) ){
|
1342 |
if ( $scrules == '' ) {
|
1346 |
}
|
1347 |
} elseif ( $valid_nonce && isset( $_POST[ 'updatehtaccess' ] ) ) {
|
1348 |
echo "<div style='padding:0 8px;color:#4f8a10;background-color:#dff2bf;border:1px solid #4f8a10;'>";
|
1349 |
+
if ( add_mod_rewrite_rules() ) {
|
1350 |
echo "<h4>" . __( 'Mod Rewrite rules updated!', 'wp-super-cache' ) . "</h4>";
|
1351 |
echo "<p><strong>" . sprintf( __( '%s.htaccess has been updated with the necessary mod_rewrite rules. Please verify they are correct. They should look like this:', 'wp-super-cache' ), $home_path ) . "</strong></p>\n";
|
1352 |
} else {
|
1353 |
+
global $update_mod_rewrite_rules_error;
|
1354 |
echo "<h4>" . __( 'Mod Rewrite rules must be updated!', 'wp-super-cache' ) . "</h4>";
|
1355 |
+
echo "<p><strong>" . sprintf( __( 'The plugin could not update %1$s.htaccess file: %2$s. The new rules go above the regular WordPress rules as shown in the code below:', 'wp-super-cache' ), $home_path, $update_mod_rewrite_rules_error ) . "</strong></p>\n";
|
1356 |
}
|
1357 |
echo "<p><pre>" . esc_html( $rules ) . "</pre></p>\n</div>";
|
1358 |
} else {
|
1366 |
wpsc_update_htaccess_form();
|
1367 |
echo "<div id='rewriterules' style='display: none;'>";
|
1368 |
if ( $rules != $scrules )
|
1369 |
+
echo '<div style="background: #fff; border: 1px solid #333; margin: 2px;">' . wp_text_diff( $scrules, $rules, array( 'title' => __( 'Rewrite Rules', 'wp-super-cache' ), 'title_left' => __( 'Current Rules', 'wp-super-cache' ), 'title_right' => __( 'New Rules', 'wp-super-cache' ) ) ) . "</div>";
|
1370 |
echo "<p><pre># BEGIN WPSuperCache\n" . esc_html( $rules ) . "# END WPSuperCache</pre></p>\n";
|
1371 |
echo "<p>" . sprintf( __( 'Rules must be added to %s too:', 'wp-super-cache' ), WP_CONTENT_DIR . "/cache/.htaccess" ) . "</p>";
|
1372 |
echo "<pre># BEGIN supercache\n" . esc_html( $gziprules ) . "# END supercache</pre></p>";
|
1373 |
echo '</div>';
|
1374 |
}
|
|
|
|
|
|
|
1375 |
|
1376 |
?></fieldset><?php
|
1377 |
}
|
1393 |
if( defined( 'WPLOCKDOWN' ) && constant( 'WPLOCKDOWN' ) )
|
1394 |
add_action( 'comment_form', 'comment_form_lockdown_message' );
|
1395 |
|
1396 |
+
function wp_update_lock_down() {
|
1397 |
+
global $cache_path, $wp_cache_config_file, $valid_nonce;
|
|
|
1398 |
|
1399 |
+
if ( isset( $_POST[ 'wp_lock_down' ] ) && $valid_nonce ) {
|
1400 |
+
$wp_lock_down = $_POST[ 'wp_lock_down' ] == '1' ? '1' : '0';
|
1401 |
+
wp_cache_replace_line( '^.*WPLOCKDOWN', "if ( ! defined( 'WPLOCKDOWN' ) ) define( 'WPLOCKDOWN', '$wp_lock_down' );", $wp_cache_config_file );
|
1402 |
+
if ( false == defined( 'WPLOCKDOWN' ) )
|
1403 |
+
define( 'WPLOCKDOWN', $wp_lock_down );
|
1404 |
+
if ( $wp_lock_down == '0' && function_exists( 'prune_super_cache' ) )
|
1405 |
prune_super_cache( $cache_path, true ); // clear the cache after lockdown
|
1406 |
+
return $wp_lock_down;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1407 |
}
|
1408 |
+
if ( defined( 'WPLOCKDOWN' ) )
|
1409 |
+
return constant( 'WPLOCKDOWN' );
|
1410 |
+
else
|
1411 |
+
return 0;
|
1412 |
+
}
|
|
|
|
|
1413 |
|
1414 |
+
function wpsc_update_direct_pages() {
|
1415 |
+
global $cached_direct_pages, $valid_nonce, $cache_path, $wp_cache_config_file;
|
|
|
|
|
|
|
1416 |
|
1417 |
+
if ( false == isset( $cached_direct_pages ) )
|
1418 |
+
$cached_direct_pages = array();
|
1419 |
$out = '';
|
1420 |
+
if ( $valid_nonce && array_key_exists('direct_pages', $_POST) && is_array( $_POST[ 'direct_pages' ] ) && !empty( $_POST[ 'direct_pages' ] ) ) {
|
1421 |
$expiredfiles = array_diff( $cached_direct_pages, $_POST[ 'direct_pages' ] );
|
1422 |
unset( $cached_direct_pages );
|
1423 |
foreach( $_POST[ 'direct_pages' ] as $page ) {
|
1424 |
+
$page = str_replace( '..', '', preg_replace('/[ <>\'\"\r\n\t\(\)]/', '', $page ) );
|
1425 |
+
if ( $page != '' ) {
|
1426 |
$cached_direct_pages[] = $page;
|
1427 |
$out .= "'$page', ";
|
1428 |
}
|
1429 |
}
|
1430 |
+
if ( false == isset( $cached_direct_pages ) )
|
1431 |
+
$cached_direct_pages = array();
|
|
|
1432 |
}
|
1433 |
+
if ( $valid_nonce && array_key_exists('new_direct_page', $_POST) && $_POST[ 'new_direct_page' ] && '' != $_POST[ 'new_direct_page' ] ) {
|
1434 |
$page = str_replace( get_option( 'siteurl' ), '', $_POST[ 'new_direct_page' ] );
|
1435 |
+
$page = str_replace( '..', '', preg_replace('/[ <>\'\"\r\n\t\(\)]/', '', $page ) );
|
1436 |
+
if ( substr( $page, 0, 1 ) != '/' )
|
1437 |
$page = '/' . $page;
|
1438 |
+
if ( $page != '/' || false == is_array( $cached_direct_pages ) || in_array( $page, $cached_direct_pages ) == false ) {
|
|
|
1439 |
$cached_direct_pages[] = $page;
|
1440 |
$out .= "'$page', ";
|
1441 |
+
|
1442 |
+
@unlink( trailingslashit( ABSPATH . $page ) . "index.html" );
|
1443 |
+
wpsc_delete_files( get_supercache_dir() . $page );
|
1444 |
}
|
1445 |
}
|
1446 |
|
1447 |
+
if ( $out != '' ) {
|
1448 |
$out = substr( $out, 0, -2 );
|
|
|
|
|
|
|
1449 |
}
|
1450 |
+
if ( $out == "''" ) {
|
1451 |
+
$out = '';
|
1452 |
+
}
|
1453 |
+
$out = '$cached_direct_pages = array( ' . $out . ' );';
|
1454 |
+
wp_cache_replace_line('^ *\$cached_direct_pages', "$out", $wp_cache_config_file);
|
1455 |
|
1456 |
+
if ( !empty( $expiredfiles ) ) {
|
1457 |
foreach( $expiredfiles as $file ) {
|
1458 |
if( $file != '' ) {
|
1459 |
$firstfolder = explode( '/', $file );
|
1460 |
$firstfolder = ABSPATH . $firstfolder[1];
|
1461 |
$file = ABSPATH . $file;
|
1462 |
+
$file = realpath( str_replace( '..', '', preg_replace('/[ <>\'\"\r\n\t\(\)]/', '', $file ) ) );
|
1463 |
+
if ( $file ) {
|
1464 |
+
@unlink( trailingslashit( $file ) . "index.html" );
|
1465 |
+
@unlink( trailingslashit( $file ) . "index.html.gz" );
|
1466 |
+
RecursiveFolderDelete( trailingslashit( $firstfolder ) );
|
1467 |
+
}
|
1468 |
}
|
1469 |
}
|
1470 |
}
|
1471 |
|
1472 |
+
if ( $valid_nonce && array_key_exists('deletepage', $_POST) && $_POST[ 'deletepage' ] ) {
|
1473 |
$page = str_replace( '..', '', preg_replace('/[ <>\'\"\r\n\t\(\)]/', '', $_POST['deletepage'] ) ) . '/';
|
1474 |
$pagefile = realpath( ABSPATH . $page . 'index.html' );
|
1475 |
if ( substr( $pagefile, 0, strlen( ABSPATH ) ) != ABSPATH || false == wp_cache_confirm_delete( ABSPATH . $page ) ) {
|
1482 |
@unlink( $pagefile );
|
1483 |
@unlink( $pagefile . '.gz' );
|
1484 |
RecursiveFolderDelete( $firstfolder );
|
|
|
|
|
1485 |
}
|
1486 |
}
|
1487 |
|
1488 |
+
return $cached_direct_pages;
|
1489 |
+
}
|
1490 |
+
|
1491 |
+
function wp_lock_down() {
|
1492 |
+
global $cached_direct_pages, $cache_enabled, $super_cache_enabled;
|
1493 |
+
|
1494 |
+
$wp_lock_down = wp_update_lock_down();
|
1495 |
+
|
1496 |
+
?><a name='lockdown'></a>
|
1497 |
+
<fieldset class="options">
|
1498 |
+
<h3><?php _e( 'Lock Down:', 'wp-super-cache' ); ?> <?php echo $wp_lock_down == '0' ? '<span style="color:red">' . __( 'Disabled', 'wp-super-cache' ) . '</span>' : '<span style="color:green">' . __( 'Enabled', 'wp-super-cache' ) . '</span>'; ?></h3>
|
1499 |
+
<p><?php _e( 'Prepare your server for an expected spike in traffic by enabling the lock down. When this is enabled, new comments on a post will not refresh the cached static files.', 'wp-super-cache' ); ?></p>
|
1500 |
+
<p><?php _e( 'Developers: Make your plugin lock down compatible by checking the "WPLOCKDOWN" constant. The following code will make sure your plugin respects the WPLOCKDOWN setting.', 'wp-super-cache' ); ?>
|
1501 |
+
<blockquote><code>if( defined( 'WPLOCKDOWN' ) && constant( 'WPLOCKDOWN' ) ) {
|
1502 |
+
echo "<?php _e( 'Sorry. My blog is locked down. Updates will appear shortly', 'wp-super-cache' ); ?>";
|
1503 |
+
}</code></blockquote>
|
1504 |
+
<?php
|
1505 |
+
if( $wp_lock_down == '1' ) {
|
1506 |
+
?><p><?php _e( 'WordPress is locked down. Super Cache static files will not be deleted when new comments are made.', 'wp-super-cache' ); ?></p><?php
|
1507 |
+
} else {
|
1508 |
+
?><p><?php _e( 'WordPress is not locked down. New comments will refresh Super Cache static files as normal.', 'wp-super-cache' ); ?></p><?php
|
1509 |
+
}
|
1510 |
+
$new_lockdown = $wp_lock_down == '1' ? '0' : '1';
|
1511 |
+
$new_lockdown_desc = $wp_lock_down == '1' ? __( 'Disable', 'wp-super-cache' ) : __( 'Enable', 'wp-super-cache' );
|
1512 |
+
echo '<form name="wp_lock_down" action="#lockdown" method="post">';
|
1513 |
+
echo "<input type='hidden' name='wp_lock_down' value='{$new_lockdown}' />";
|
1514 |
+
echo "<div class='submit'><input class='button-primary' type='submit' " . SUBMITDISABLED . " value='{$new_lockdown_desc} " . __( 'Lock Down', 'wp-super-cache' ) . "' /></div>";
|
1515 |
+
wp_nonce_field('wp-cache');
|
1516 |
+
echo "</form>\n";
|
1517 |
+
|
1518 |
+
?></fieldset><?php
|
1519 |
+
if( $cache_enabled == true && $super_cache_enabled == true ) {
|
1520 |
+
?><a name='direct'></a>
|
1521 |
+
<fieldset class="options">
|
1522 |
+
<h3><?php _e( 'Directly Cached Files', 'wp-super-cache' ); ?></h3><?php
|
1523 |
+
|
1524 |
+
$cached_direct_pages = wpsc_update_direct_pages();
|
1525 |
+
|
1526 |
$readonly = '';
|
1527 |
if( !is_writeable_ACLSafe( ABSPATH ) ) {
|
1528 |
$readonly = 'READONLY';
|
1586 |
}
|
1587 |
}
|
1588 |
|
1589 |
+
function wp_cache_time_update() {
|
1590 |
+
global $cache_max_time, $wp_cache_config_file, $valid_nonce, $cache_schedule_type, $cache_scheduled_time, $cache_schedule_interval, $cache_time_interval, $cache_gc_email_me;
|
|
|
|
|
|
|
1591 |
if ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'expirytime' ) {
|
1592 |
|
1593 |
+
if ( false == $valid_nonce )
|
1594 |
+
return false;
|
1595 |
+
|
1596 |
if( !isset( $cache_schedule_type ) ) {
|
1597 |
$cache_schedule_type = 'interval';
|
1598 |
wp_cache_replace_line('^ *\$cache_schedule_type', "\$cache_schedule_type = '$cache_schedule_type';", $wp_cache_config_file);
|
1613 |
wp_cache_replace_line('^ *\$cache_time_interval', "\$cache_time_interval = '$cache_time_interval';", $wp_cache_config_file);
|
1614 |
}
|
1615 |
|
1616 |
+
if ( isset( $_POST['wp_max_time'] ) ) {
|
1617 |
$cache_max_time = (int)$_POST['wp_max_time'];
|
1618 |
wp_cache_replace_line('^ *\$cache_max_time', "\$cache_max_time = $cache_max_time;", $wp_cache_config_file);
|
1619 |
// schedule gc watcher
|
1621 |
wp_schedule_event( time()+600, 'hourly', 'wp_cache_gc_watcher' );
|
1622 |
}
|
1623 |
|
1624 |
+
if ( isset( $_POST[ 'cache_gc_email_me' ] ) ) {
|
1625 |
$cache_gc_email_me = 1;
|
1626 |
wp_cache_replace_line('^ *\$cache_gc_email_me', "\$cache_gc_email_me = $cache_gc_email_me;", $wp_cache_config_file);
|
1627 |
+
} else {
|
1628 |
$cache_gc_email_me = 0;
|
1629 |
wp_cache_replace_line('^ *\$cache_gc_email_me', "\$cache_gc_email_me = $cache_gc_email_me;", $wp_cache_config_file);
|
1630 |
}
|
1631 |
+
if ( isset( $_POST[ 'cache_schedule_type' ] ) && $_POST[ 'cache_schedule_type' ] == 'interval' && isset( $_POST['cache_time_interval'] ) ) {
|
1632 |
wp_clear_scheduled_hook( 'wp_cache_gc' );
|
1633 |
$cache_schedule_type = 'interval';
|
1634 |
if ( (int)$_POST[ 'cache_time_interval' ] == 0 )
|
1637 |
wp_schedule_single_event( time() + $cache_time_interval, 'wp_cache_gc' );
|
1638 |
wp_cache_replace_line('^ *\$cache_schedule_type', "\$cache_schedule_type = '$cache_schedule_type';", $wp_cache_config_file);
|
1639 |
wp_cache_replace_line('^ *\$cache_time_interval', "\$cache_time_interval = '$cache_time_interval';", $wp_cache_config_file);
|
1640 |
+
} else { // clock
|
1641 |
wp_clear_scheduled_hook( 'wp_cache_gc' );
|
1642 |
$cache_schedule_type = 'time';
|
1643 |
if ( !isset( $_POST[ 'cache_scheduled_time' ] ) ||
|
1650 |
$schedules = wp_get_schedules();
|
1651 |
if ( !isset( $cache_schedule_interval ) )
|
1652 |
$cache_schedule_interval = 'daily';
|
1653 |
+
if ( isset( $_POST[ 'cache_schedule_interval' ] ) && isset( $schedules[ $_POST[ 'cache_schedule_interval' ] ] ) )
|
1654 |
$cache_schedule_interval = $_POST[ 'cache_schedule_interval' ];
|
1655 |
wp_cache_replace_line('^ *\$cache_schedule_type', "\$cache_schedule_type = '$cache_schedule_type';", $wp_cache_config_file);
|
1656 |
wp_cache_replace_line('^ *\$cache_schedule_interval', "\$cache_schedule_interval = '{$cache_schedule_interval}';", $wp_cache_config_file);
|
1659 |
}
|
1660 |
}
|
1661 |
|
1662 |
+
}
|
1663 |
+
|
1664 |
+
function wp_cache_edit_max_time() {
|
1665 |
+
global $cache_max_time, $wp_cache_config_file, $valid_nonce, $super_cache_enabled, $cache_schedule_type, $cache_scheduled_time, $cache_schedule_interval, $cache_time_interval, $cache_gc_email_me, $wp_cache_preload_on;
|
1666 |
+
|
1667 |
+
$timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
|
1668 |
+
|
1669 |
+
wp_cache_time_update();
|
1670 |
+
|
1671 |
?><fieldset class="options">
|
1672 |
<a name='expirytime'></a>
|
1673 |
<h3><?php _e( 'Expiry Time & Garbage Collection', 'wp-super-cache' ); ?></h3><?php
|
1674 |
|
1675 |
+
?><span id="utc-time"><?php printf( __( '<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>', 'wp-super-cache' ), date_i18n( $timezone_format, false, 'gmt' ) ); ?></span><?php
|
1676 |
$current_offset = get_option('gmt_offset');
|
1677 |
if ( get_option('timezone_string') || !empty($current_offset) ) {
|
1678 |
+
?><span id="local-time"><?php printf( __( 'Local time is <code>%1$s</code>', 'wp-super-cache' ), date_i18n( $timezone_format ) ); ?></span><?php
|
1679 |
}
|
1680 |
$next_gc = wp_next_scheduled( 'wp_cache_gc' );
|
1681 |
if ( $next_gc )
|
1683 |
|
1684 |
|
1685 |
if ( $wp_cache_preload_on )
|
1686 |
+
echo "<p>" . __( 'Warning! <strong>PRELOAD MODE</strong> activated. Supercache files will not be deleted regardless of age.', 'wp-super-cache' ) . "</p>";
|
1687 |
|
1688 |
echo "<script type='text/javascript'>";
|
1689 |
echo "jQuery(function () {
|
1733 |
echo "<li>" . __( 'Sites with lots of static content, no widgets or rss feeds in their sidebar can use a timeout of 86400 seconds or even more and set the timer to something equally long.', 'wp-super-cache' ) . "</li>\n";
|
1734 |
echo "<li>" . __( 'Sites where an external data source updates at a particular time every day should set the timeout to 86400 seconds and use the Clock scheduler set appropriately.', 'wp-super-cache' ) . "</li>\n";
|
1735 |
echo "</ol>";
|
1736 |
+
echo "<p>" . __( 'Checking for and deleting expired files is expensive, but it’s expensive leaving them there too. On a very busy site, you should set the expiry time to <em>600 seconds</em>. Experiment with different values and visit this page to see how many expired files remain at different times during the day.', 'wp-super-cache' ) . "</p>";
|
1737 |
echo "<p>" . __( 'Set the expiry time to 0 seconds to disable garbage collection.', 'wp-super-cache' ) . "</p>";
|
1738 |
echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Change Expiration', 'wp-super-cache' ) . '" /></div>';
|
1739 |
wp_nonce_field('wp-cache');
|
1764 |
}
|
1765 |
}
|
1766 |
|
1767 |
+
function wp_cache_update_rejected_ua() {
|
1768 |
global $cache_rejected_user_agent, $wp_cache_config_file, $valid_nonce;
|
1769 |
|
1770 |
if ( !function_exists( 'apache_request_headers' ) ) return;
|
1778 |
}
|
1779 |
reset( $cache_rejected_user_agent );
|
1780 |
}
|
1781 |
+
}
|
1782 |
+
|
1783 |
+
function wp_cache_edit_rejected_ua() {
|
1784 |
+
global $cache_rejected_user_agent, $wp_cache_config_file, $valid_nonce;
|
1785 |
+
|
1786 |
+
if ( !function_exists( 'apache_request_headers' ) ) return;
|
1787 |
+
|
1788 |
+
wp_cache_update_rejected_ua();
|
1789 |
|
1790 |
echo '<a name="useragents"></a><fieldset class="options"><h3>' . __( 'Rejected User Agents', 'wp-super-cache' ) . '</h3>';
|
1791 |
echo "<p>" . __( 'Strings in the HTTP ’User Agent’ header that prevent WP-Cache from caching bot, spiders, and crawlers’ requests. Note that super cached files are still sent to these agents if they already exists.', 'wp-super-cache' ) . "</p>\n";
|
1801 |
echo "</fieldset>\n";
|
1802 |
}
|
1803 |
|
1804 |
+
function wp_cache_update_rejected_pages() {
|
1805 |
global $wp_cache_config_file, $valid_nonce, $wp_cache_pages;
|
1806 |
|
1807 |
if ( isset( $_POST[ 'wp_edit_rejected_pages' ] ) && $valid_nonce ) {
|
1816 |
$wp_cache_pages[ $page ] = $value;
|
1817 |
}
|
1818 |
}
|
1819 |
+
}
|
1820 |
+
|
1821 |
+
function wp_cache_edit_rejected_pages() {
|
1822 |
+
global $wp_cache_config_file, $valid_nonce, $wp_cache_pages;
|
1823 |
+
|
1824 |
+
wp_cache_update_rejected_pages();
|
1825 |
|
1826 |
echo '<a name="rejectpages"></a>';
|
1827 |
echo '<p>' . __( 'Do not cache the following page types. See the <a href="http://codex.wordpress.org/Conditional_Tags">Conditional Tags</a> documentation for a complete discussion on each type.', 'wp-super-cache' ) . '</p>';
|
1838 |
echo '<label><input type="checkbox" value="1" name="wp_cache_pages[search]" ' . checked( 1, $wp_cache_pages[ 'search' ], false ) . ' /> ' . __( 'Search Pages', 'wp-super-cache' ) . ' (is_search)</label><br />';
|
1839 |
echo '<label><input type="checkbox" value="1" name="wp_cache_pages[author]" ' . checked( 1, $wp_cache_pages[ 'author' ], false ) . ' /> ' . __( 'Author Pages', 'wp-super-cache' ) . ' (is_author)</label><br />';
|
1840 |
|
1841 |
+
echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Save', 'wp-super-cache' ) . '" /></div>';
|
1842 |
wp_nonce_field('wp-cache');
|
1843 |
echo "</form>\n";
|
1844 |
|
1845 |
}
|
1846 |
|
1847 |
+
function wp_cache_update_rejected_strings() {
|
1848 |
+
global $cache_rejected_uri, $wp_cache_config_file, $valid_nonce;
|
1849 |
|
1850 |
+
if ( isset($_REQUEST['wp_rejected_uri']) && $valid_nonce ) {
|
1851 |
$text = wp_cache_sanitize_value( str_replace( '\\\\', '\\', $_REQUEST['wp_rejected_uri'] ), $cache_rejected_uri );
|
1852 |
wp_cache_replace_line('^ *\$cache_rejected_uri', "\$cache_rejected_uri = $text;", $wp_cache_config_file);
|
1853 |
}
|
1854 |
|
1855 |
+
}
|
1856 |
+
|
1857 |
+
function wp_cache_edit_rejected() {
|
1858 |
+
global $cache_rejected_uri;
|
1859 |
+
|
1860 |
+
wp_cache_update_rejected_strings();
|
1861 |
|
1862 |
echo '<a name="rejecturi"></a>';
|
1863 |
echo '<form name="wp_edit_rejected" action="#rejecturi" method="post">';
|
1872 |
echo "</form>\n";
|
1873 |
}
|
1874 |
|
1875 |
+
function wp_cache_update_accepted_strings() {
|
1876 |
+
global $cache_acceptable_files, $wp_cache_config_file, $valid_nonce;
|
1877 |
|
1878 |
+
if ( isset( $_REQUEST[ 'wp_accepted_files' ] ) && $valid_nonce ) {
|
1879 |
+
$text = wp_cache_sanitize_value( $_REQUEST[ 'wp_accepted_files' ], $cache_acceptable_files );
|
1880 |
+
wp_cache_replace_line( '^ *\$cache_acceptable_files', "\$cache_acceptable_files = $text;", $wp_cache_config_file );
|
1881 |
}
|
1882 |
+
}
|
1883 |
|
1884 |
+
function wp_cache_edit_accepted() {
|
1885 |
+
global $cache_acceptable_files;
|
1886 |
+
|
1887 |
+
wp_cache_update_accepted_strings();
|
1888 |
|
1889 |
echo '<a name="cancache"></a>';
|
1890 |
echo '<div style="clear:both"></div><form name="wp_edit_accepted" action="#cancache" method="post">';
|
1899 |
echo "</form>\n";
|
1900 |
}
|
1901 |
|
1902 |
+
function wpsc_create_debug_log( $filename = '', $username = '' ) {
|
1903 |
+
global $cache_path, $wp_cache_debug_username, $wp_cache_debug_log;
|
1904 |
+
if ( $filename != '' ) {
|
1905 |
+
$wp_cache_debug_log = $filename;
|
1906 |
+
} else {
|
1907 |
+
$wp_cache_debug_log = md5( time() + mt_rand() ) . ".php";
|
1908 |
+
}
|
1909 |
+
if ( $username != '' ) {
|
1910 |
+
$wp_cache_debug_username = $username;
|
1911 |
+
} else {
|
1912 |
+
$wp_cache_debug_username = md5( time() + mt_rand() );
|
1913 |
+
}
|
1914 |
+
|
1915 |
+
$fp = fopen( $cache_path . $wp_cache_debug_log, 'w' );
|
1916 |
+
if ( $fp ) {
|
1917 |
+
fwrite( $fp, '<' . "?php\n" );
|
1918 |
+
$msg = '
|
1919 |
+
if ( !isset( $_SERVER[ "PHP_AUTH_USER" ] ) || ( $_SERVER[ "PHP_AUTH_USER" ] != "' . $wp_cache_debug_username . '" && $_SERVER[ "PHP_AUTH_PW" ] != "' . $wp_cache_debug_username . '" ) ) {
|
1920 |
+
header( "WWW-Authenticate: Basic realm=\"WP-Super-Cache Debug Log\"" );
|
1921 |
+
header("HTTP/1.0 401 Unauthorized");
|
1922 |
+
echo "You must login to view the debug log";
|
1923 |
+
exit;
|
1924 |
+
}';
|
1925 |
+
fwrite( $fp, $msg );
|
1926 |
+
fwrite( $fp, '?' . "><pre>" );
|
1927 |
+
fclose( $fp );
|
1928 |
+
wp_cache_setting( 'wp_cache_debug_log', $wp_cache_debug_log );
|
1929 |
+
wp_cache_setting( 'wp_cache_debug_username', $wp_cache_debug_username );
|
1930 |
+
}
|
1931 |
+
return array( 'wp_cache_debug_log' => $wp_cache_debug_log, 'wp_cache_debug_username' => $wp_cache_debug_username );
|
1932 |
+
}
|
1933 |
+
|
1934 |
+
function wpsc_update_debug_settings() {
|
1935 |
global $wp_super_cache_debug, $wp_cache_debug_log, $wp_cache_debug_ip, $cache_path, $valid_nonce, $wp_cache_config_file, $wp_super_cache_comments;
|
1936 |
global $wp_super_cache_front_page_check, $wp_super_cache_front_page_clear, $wp_super_cache_front_page_text, $wp_super_cache_front_page_notification, $wp_super_cache_advanced_debug;
|
1937 |
+
global $wp_cache_debug_username;
|
1938 |
+
|
1939 |
+
if ( false == $valid_nonce ) {
|
1940 |
+
return array (
|
1941 |
+
'wp_super_cache_debug' => $wp_super_cache_debug,
|
1942 |
+
'wp_cache_debug_log' => $wp_cache_debug_log,
|
1943 |
+
'wp_cache_debug_ip' => $wp_cache_debug_ip,
|
1944 |
+
'wp_super_cache_comments' => $wp_super_cache_comments,
|
1945 |
+
'wp_super_cache_front_page_check' => $wp_super_cache_front_page_check,
|
1946 |
+
'wp_super_cache_front_page_clear' => $wp_super_cache_front_page_clear,
|
1947 |
+
'wp_super_cache_front_page_text' => $wp_super_cache_front_page_text,
|
1948 |
+
'wp_super_cache_front_page_notification' => $wp_super_cache_front_page_notification,
|
1949 |
+
'wp_super_cache_advanced_debug' => $wp_super_cache_advanced_debug,
|
1950 |
+
'wp_cache_debug_username' => $wp_cache_debug_username,
|
1951 |
+
);
|
1952 |
+
}
|
1953 |
+
|
1954 |
+
if ( isset( $_POST[ 'wpsc_delete_log' ] ) && $wp_cache_debug_log != '' ) {
|
1955 |
+
@unlink( $cache_path . $wp_cache_debug_log );
|
1956 |
+
extract( wpsc_create_debug_log( $wp_cache_debug_log, $wp_cache_debug_username ) );
|
1957 |
+
} elseif ( isset( $_POST[ 'wp_super_cache_debug' ] ) ) {
|
1958 |
+
$wp_super_cache_debug = (int) $_POST[ 'wp_super_cache_debug' ];
|
1959 |
+
wp_cache_setting( 'wp_super_cache_debug', $wp_super_cache_debug );
|
1960 |
+
if ( ! isset( $wp_cache_debug_log ) || $wp_cache_debug_log == '' ) {
|
1961 |
+
extract( wpsc_create_debug_log() );
|
1962 |
+
}
|
1963 |
+
}
|
1964 |
|
1965 |
if ( false == isset( $wp_super_cache_comments ) )
|
1966 |
$wp_super_cache_comments = 1;
|
1967 |
+
|
1968 |
+
if ( isset( $_POST[ 'wp_cache_debug' ] ) ) {
|
1969 |
+
wp_cache_setting( 'wp_cache_debug_username', $wp_cache_debug_username );
|
1970 |
+
wp_cache_setting( 'wp_cache_debug_log', $wp_cache_debug_log );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1971 |
$wp_super_cache_comments = isset( $_POST[ 'wp_super_cache_comments' ] ) ? 1 : 0;
|
1972 |
+
wp_cache_setting( 'wp_super_cache_comments', $wp_super_cache_comments );
|
1973 |
$wp_cache_debug_ip = esc_html( $_POST[ 'wp_cache_debug_ip' ] );
|
1974 |
+
wp_cache_setting( 'wp_cache_debug_ip', $wp_cache_debug_ip );
|
1975 |
$wp_super_cache_front_page_check = isset( $_POST[ 'wp_super_cache_front_page_check' ] ) ? 1 : 0;
|
1976 |
+
wp_cache_setting( 'wp_super_cache_front_page_check', $wp_super_cache_front_page_check );
|
1977 |
$wp_super_cache_front_page_clear = isset( $_POST[ 'wp_super_cache_front_page_clear' ] ) ? 1 : 0;
|
1978 |
+
wp_cache_setting( 'wp_super_cache_front_page_clear', $wp_super_cache_front_page_clear );
|
1979 |
$wp_super_cache_front_page_text = esc_html( $_POST[ 'wp_super_cache_front_page_text' ] );
|
1980 |
+
wp_cache_setting( 'wp_super_cache_front_page_text', $wp_super_cache_front_page_text );
|
1981 |
$wp_super_cache_front_page_notification = isset( $_POST[ 'wp_super_cache_front_page_notification' ] ) ? 1 : 0;
|
1982 |
+
wp_cache_setting( 'wp_super_cache_front_page_notification', $wp_super_cache_front_page_notification );
|
1983 |
if ( $wp_super_cache_front_page_check == 1 && !wp_next_scheduled( 'wp_cache_check_site_hook' ) ) {
|
1984 |
wp_schedule_single_event( time() + 360 , 'wp_cache_check_site_hook' );
|
1985 |
+
wp_cache_debug( 'scheduled wp_cache_check_site_hook for 360 seconds time.' );
|
1986 |
}
|
1987 |
}
|
1988 |
|
1989 |
+
return array (
|
1990 |
+
'wp_super_cache_debug' => $wp_super_cache_debug,
|
1991 |
+
'wp_cache_debug_log' => $wp_cache_debug_log,
|
1992 |
+
'wp_cache_debug_ip' => $wp_cache_debug_ip,
|
1993 |
+
'wp_super_cache_comments' => $wp_super_cache_comments,
|
1994 |
+
'wp_super_cache_front_page_check' => $wp_super_cache_front_page_check,
|
1995 |
+
'wp_super_cache_front_page_clear' => $wp_super_cache_front_page_clear,
|
1996 |
+
'wp_super_cache_front_page_text' => $wp_super_cache_front_page_text,
|
1997 |
+
'wp_super_cache_front_page_notification' => $wp_super_cache_front_page_notification,
|
1998 |
+
'wp_super_cache_advanced_debug' => $wp_super_cache_advanced_debug,
|
1999 |
+
'wp_cache_debug_username' => $wp_cache_debug_username,
|
2000 |
+
);
|
2001 |
+
}
|
2002 |
+
|
2003 |
+
function wp_cache_debug_settings() {
|
2004 |
+
global $wp_super_cache_debug, $wp_cache_debug_log, $wp_cache_debug_ip, $cache_path, $valid_nonce, $wp_cache_config_file, $wp_super_cache_comments;
|
2005 |
+
global $wp_super_cache_front_page_check, $wp_super_cache_front_page_clear, $wp_super_cache_front_page_text, $wp_super_cache_front_page_notification, $wp_super_cache_advanced_debug;
|
2006 |
+
global $wp_cache_debug_username;
|
2007 |
+
|
2008 |
+
extract( wpsc_update_debug_settings() );
|
2009 |
+
|
2010 |
echo '<a name="debug"></a>';
|
2011 |
echo '<fieldset class="options">';
|
2012 |
+
echo '<p>' . __( 'Fix problems with the plugin by debugging it here. It will log to a file in your cache directory.', 'wp-super-cache' ) . '</p>';
|
2013 |
+
if ( ! isset( $wp_cache_debug_log ) || $wp_cache_debug_log == '' ) {
|
2014 |
+
extract( wpsc_create_debug_log() );
|
2015 |
+
}
|
2016 |
+
$log_file_link = "<a href='" . site_url( str_replace( ABSPATH, '', "{$cache_path}{$wp_cache_debug_log}" ) ) . "'>$wp_cache_debug_log</a>";
|
2017 |
+
if ( $wp_super_cache_debug == 1 ) {
|
2018 |
+
echo "<p>" . sprintf( __( 'Currently logging to: %s', 'wp-super-cache' ), $log_file_link ) . "</p>";
|
2019 |
+
} else {
|
2020 |
+
echo "<p>" . sprintf( __( 'Last Logged to: %s', 'wp-super-cache' ), $log_file_link ) . "</p>";
|
2021 |
+
}
|
2022 |
+
echo "<p>" . sprintf( __( 'Username/Password: %s', 'wp-super-cache' ), $wp_cache_debug_username ) . "</p>";
|
2023 |
|
2024 |
+
echo '<form name="wpsc_delete" action="" method="post">';
|
2025 |
+
wp_nonce_field('wp-cache');
|
2026 |
+
submit_button( __( 'Delete', 'wp-super-cache' ), 'delete', 'wpsc_delete_log', false );
|
2027 |
+
echo "</form>";
|
2028 |
+
echo '<form name="wpsc_delete" action="" method="post">';
|
2029 |
+
if ( ! isset( $wp_super_cache_debug ) || $wp_super_cache_debug == 0 ) {
|
2030 |
+
$debug_status_message = __( 'Enable Logging', 'wp-super-cache' );
|
2031 |
+
$not_status = 1;
|
2032 |
+
} else {
|
2033 |
+
$debug_status_message = __( 'Disable Logging', 'wp-super-cache' );
|
2034 |
+
$not_status = 0;
|
2035 |
+
}
|
2036 |
+
echo "<input type='hidden' name='wp_super_cache_debug' value='" . $not_status . "' />";
|
2037 |
+
wp_nonce_field('wp-cache');
|
2038 |
+
submit_button( $debug_status_message, 'primary', 'wpsc_log_status', true );
|
2039 |
+
echo "</form>";
|
2040 |
+
echo '<form name="wp_cache_debug" action="" method="post">';
|
2041 |
echo "<input type='hidden' name='wp_cache_debug' value='1' /><br />";
|
2042 |
echo "<table class='form-table'>";
|
2043 |
+
echo "<tr><th>" . __( 'IP Address', 'wp-super-cache' ) . "</th><td> <input type='text' size='20' name='wp_cache_debug_ip' value='{$wp_cache_debug_ip}' /> " . sprintf( __( '(only log requests from this IP address. Your IP is %s)', 'wp-super-cache' ), $_SERVER[ 'REMOTE_ADDR' ] ) . "</td></tr>";
|
2044 |
+
echo "<tr><th valign='top'>" . __( 'Cache Status Messages', 'wp-super-cache' ) . "</th><td><input type='checkbox' name='wp_super_cache_comments' value='1' " . checked( 1, $wp_super_cache_comments, false ) . " /> " . __( 'enabled', 'wp-super-cache' ) . "<br />";
|
|
|
2045 |
echo __( 'Display comments at the end of every page like this:', 'wp-super-cache' ) . "<br />";
|
2046 |
echo "<pre><!-- Dynamic page generated in 0.450 seconds. -->
|
2047 |
<!-- Cached page generated by WP-Super-Cache on " . date( "Y-m-d H:i:s", time() ) . " -->
|
2065 |
}
|
2066 |
|
2067 |
function wp_cache_enable() {
|
2068 |
+
global $wp_cache_config_file, $cache_enabled;
|
2069 |
|
|
|
|
|
|
|
|
|
2070 |
if( wp_cache_replace_line('^ *\$cache_enabled', '$cache_enabled = true;', $wp_cache_config_file) ) {
|
2071 |
$cache_enabled = true;
|
2072 |
}
|
2073 |
+
|
2074 |
+
if ( wpsc_set_default_gc() ) {
|
2075 |
+
// gc might not be scheduled, check and schedule
|
2076 |
+
$timestamp = wp_next_scheduled( 'wp_cache_gc' );
|
2077 |
+
if ( false == $timestamp ) {
|
2078 |
+
wp_schedule_single_event( time() + 600, 'wp_cache_gc' );
|
2079 |
+
}
|
2080 |
+
}
|
2081 |
}
|
2082 |
|
2083 |
function wp_cache_disable() {
|
2132 |
return false;
|
2133 |
}
|
2134 |
|
2135 |
+
function wp_cache_setting( $field, $value ) {
|
2136 |
+
global $wp_cache_config_file;
|
2137 |
+
global ${$field};
|
2138 |
+
$$field = $value;
|
2139 |
+
if ( is_numeric( $value ) ) {
|
2140 |
+
wp_cache_replace_line( '^ *\$' . $field, "\$$field = $value;", $wp_cache_config_file );
|
2141 |
+
} elseif ( is_object( $value ) || is_array( $value ) ) {
|
2142 |
+
$text = var_export( $value, true );
|
2143 |
+
$text = preg_replace( '/[\s]+/', ' ', $text );
|
2144 |
+
wp_cache_replace_line( '^ *\$' . $field, "\$$field = $text;", $wp_cache_config_file );
|
2145 |
+
} else {
|
2146 |
+
wp_cache_replace_line( '^ *\$' . $field, "\$$field = '$value';", $wp_cache_config_file );
|
2147 |
+
}
|
2148 |
+
}
|
2149 |
|
2150 |
function wp_cache_replace_line($old, $new, $my_file) {
|
2151 |
if ( @is_file( $my_file ) == false ) {
|
2218 |
}
|
2219 |
|
2220 |
function wp_cache_index_notice() {
|
2221 |
+
global $wp_version, $cache_path;
|
2222 |
|
2223 |
if ( false == wpsupercache_site_admin() )
|
2224 |
return false;
|
2239 |
} elseif ( get_site_option( 'wp_super_cache_index_detected' ) != 3 ) {
|
2240 |
echo "<div id='wpsc-index-warning' class='error notice' style='padding: 10px 10px 50px 10px'>";
|
2241 |
echo "<h1>" . __( 'WP Super Cache Warning!', 'wp-super-cache' ) . '</h1>';
|
2242 |
+
echo '<p>' . __( 'Your server is configured to show files and directories, which may expose sensitive data such as login cookies to attackers in the cache directories. That has been fixed by adding a file named index.html to each directory. If you use simple caching, consider moving the location of the cache directory on the Advanced Settings page.', 'wp-super-cache' ) . '</p>';
|
2243 |
echo "<p><strong>";
|
2244 |
_e( 'If you just installed WP Super Cache for the first time, you can dismiss this message. Otherwise, you should probably refresh the login cookies of all logged in WordPress users here by clicking the logout link below.', 'wp-super-cache' );
|
2245 |
echo "</strong></p>";
|
2292 |
add_action( 'admin_init', 'wp_cache_logout_all' );
|
2293 |
|
2294 |
function wp_cache_add_index_protection() {
|
2295 |
+
global $cache_path, $blog_cache_dir;
|
2296 |
|
2297 |
if ( is_dir( $cache_path ) && false == is_file( "$cache_path/index.html" ) ) {
|
2298 |
$page = wp_remote_get( home_url( "/wp-content/cache/" ) );
|
2349 |
}
|
2350 |
|
2351 |
function wp_cache_verify_cache_dir() {
|
2352 |
+
global $cache_path, $blog_cache_dir;
|
2353 |
|
2354 |
$dir = dirname($cache_path);
|
2355 |
if ( !file_exists($cache_path) ) {
|
2420 |
$sem_id = crc32( $WPSC_HTTP_HOST . $cache_path ) & 0x7fffffff;
|
2421 |
wp_cache_replace_line('sem_id', '$sem_id = ' . $sem_id . ';', $wp_cache_config_file);
|
2422 |
}
|
2423 |
+
if ( $new ) {
|
2424 |
+
require($wp_cache_config_file);
|
2425 |
+
wpsc_set_default_gc( true );
|
2426 |
+
}
|
2427 |
return true;
|
2428 |
}
|
2429 |
|
2437 |
|
2438 |
$line = 'define( \'WPCACHEHOME\', \'' . dirname( __FILE__ ) . '/\' );';
|
2439 |
if ( !is_writeable_ACLSafe($global_config_file) || !wp_cache_replace_line('define *\( *\'WPCACHEHOME\'', $line, $global_config_file ) ) {
|
2440 |
+
echo '<div class="notice notice-error"><h3>' . __( 'Warning', 'wp-super-cache' ) . "! <em>" . sprintf( __( 'Could not update %s!</em> WPCACHEHOME must be set in config file.', 'wp-super-cache' ), $global_config_file ) . "</h3>";
|
2441 |
return false;
|
2442 |
}
|
2443 |
$ret = true;
|
2473 |
}
|
2474 |
|
2475 |
if( false == $ret ) {
|
2476 |
+
echo '<div class="notice notice-error"><h3>' . __( 'Warning', 'wp-super-cache' ) . "! <em>" . sprintf( __( '%s/advanced-cache.php</em> does not exist or cannot be updated.', 'wp-super-cache' ), WP_CONTENT_DIR ) . "</h3>";
|
2477 |
echo "<p><ul><li>" . __( '1. If it already exists, please delete the file first.', 'wp-super-cache' ) . "</li>";
|
2478 |
echo "<li>" . sprintf( __( '2. Make %1$s writable using the chmod command through your ftp or server software. (<em>chmod 777 %1$s</em>) and refresh this page. This is only a temporary measure and you’ll have to make it read only afterwards again. (Change 777 to 755 in the previous command)', 'wp-super-cache' ), WP_CONTENT_DIR ) . "</li>";
|
2479 |
echo "<li>" . sprintf( __( '3. Refresh this page to update <em>%s/advanced-cache.php</em>', 'wp-super-cache' ), WP_CONTENT_DIR ) . "</li></ul>";
|
2501 |
$line = 'define(\'WP_CACHE\', true);';
|
2502 |
if (!is_writeable_ACLSafe($global) || !wp_cache_replace_line('define *\( *\'WP_CACHE\'', $line, $global) ) {
|
2503 |
if ( defined( 'WP_CACHE' ) && constant( 'WP_CACHE' ) == false ) {
|
2504 |
+
echo '<div class="notice notice-error">' . __( "<h3>WP_CACHE constant set to false</h3><p>The WP_CACHE constant is used by WordPress to load the code that serves cached pages. Unfortunately, it is set to false. Please edit your wp-config.php and add or edit the following line above the final require_once command:<br /><br /><code>define('WP_CACHE', true);</code></p>", 'wp-super-cache' ) . "</div>";
|
2505 |
} else {
|
2506 |
+
echo '<div class="notice notice-error"><p>' . __( "<strong>Error: WP_CACHE is not enabled</strong> in your <code>wp-config.php</code> file and I couldn’t modify it.", 'wp-super-cache' ) . "</p>";
|
2507 |
+
echo "<p>" . sprintf( __( "Edit <code>%s</code> and add the following line:<br /> <code>define('WP_CACHE', true);</code><br />Otherwise, <strong>WP-Cache will not be executed</strong> by WordPress core. ", 'wp-super-cache' ), $global ) . "</p></div>";
|
2508 |
}
|
2509 |
return false;
|
2510 |
} else {
|
2511 |
+
echo "<div class='notice notice-warning'>" . __( '<h3>WP_CACHE constant added to wp-config.php</h3><p>If you continue to see this warning message please see point 5 of the <a href="http://wordpress.org/plugins/wp-super-cache/faq/">Troubleshooting Guide</a>. The WP_CACHE line must be moved up.', 'wp-super-cache' ) . "</p></div>";
|
2512 |
}
|
2513 |
return true;
|
2514 |
}
|
2515 |
|
2516 |
+
function wpsc_generate_sizes_array() {
|
2517 |
+
$sizes = array();
|
2518 |
+
$cache_types = apply_filters( 'wpsc_cache_types', array( 'supercache', 'wpcache' ) );
|
2519 |
+
$cache_states = apply_filters( 'wpsc_cache_state', array( 'expired', 'cached' ) );
|
2520 |
+
foreach( $cache_types as $type ) {
|
2521 |
+
reset( $cache_states );
|
2522 |
+
foreach( $cache_states as $state ) {
|
2523 |
+
$sizes[ $type ][ $state ] = 0;
|
2524 |
+
}
|
2525 |
+
$sizes[ $type ][ 'fsize' ] = 0;
|
2526 |
+
$sizes[ $type ][ 'cached_list' ] = array();
|
2527 |
+
$sizes[ $type ][ 'expired_list' ] = array();
|
2528 |
+
}
|
2529 |
+
return $sizes;
|
2530 |
+
}
|
2531 |
+
|
2532 |
+
function wp_cache_format_fsize( $fsize ) {
|
2533 |
+
if ( $fsize > 1024 ) {
|
2534 |
+
$fsize = number_format( $fsize / 1024, 2 ) . "MB";
|
2535 |
+
} elseif ( $fsize != 0 ) {
|
2536 |
+
$fsize = number_format( $fsize, 2 ) . "KB";
|
2537 |
+
} else {
|
2538 |
+
$fsize = "0KB";
|
2539 |
+
}
|
2540 |
+
return $fsize;
|
2541 |
+
}
|
2542 |
+
|
2543 |
+
function wp_cache_regenerate_cache_file_stats() {
|
2544 |
+
global $supercachedir, $file_prefix, $wp_cache_preload_on, $cache_max_time;
|
2545 |
+
|
2546 |
+
if ( $supercachedir == '' )
|
2547 |
+
$supercachedir = get_supercache_dir();
|
2548 |
+
|
2549 |
+
$sizes = wpsc_generate_sizes_array();
|
2550 |
+
$now = time();
|
2551 |
+
if (is_dir( $supercachedir ) ) {
|
2552 |
+
if ( $dh = opendir( $supercachedir ) ) {
|
2553 |
+
while ( ( $entry = readdir( $dh ) ) !== false ) {
|
2554 |
+
if ( $entry != '.' && $entry != '..' ) {
|
2555 |
+
$sizes = wpsc_dirsize( trailingslashit( $supercachedir ) . $entry, $sizes );
|
2556 |
+
}
|
2557 |
+
}
|
2558 |
+
closedir( $dh );
|
2559 |
+
}
|
2560 |
+
}
|
2561 |
+
foreach( $sizes as $cache_type => $list ) {
|
2562 |
+
foreach( array( 'cached_list', 'expired_list' ) as $status ) {
|
2563 |
+
$cached_list = array();
|
2564 |
+
foreach( $list[ $status ] as $dir => $details ) {
|
2565 |
+
if ( $details[ 'files' ] == 2 && !isset( $details[ 'upper_age' ] ) ) {
|
2566 |
+
$details[ 'files' ] = 1;
|
2567 |
+
}
|
2568 |
+
$cached_list[ $dir ] = $details;
|
2569 |
+
}
|
2570 |
+
$sizes[ $cache_type ][ $status ] = $cached_list;
|
2571 |
+
}
|
2572 |
+
}
|
2573 |
+
$cache_stats = array( 'generated' => time(), 'supercache' => $sizes[ 'supercache' ], 'wpcache' => $sizes[ 'wpcache' ] );
|
2574 |
+
update_option( 'supercache_stats', $cache_stats );
|
2575 |
+
return $cache_stats;
|
2576 |
+
}
|
2577 |
+
|
2578 |
function wp_cache_files() {
|
2579 |
+
global $cache_path, $file_prefix, $cache_max_time, $valid_nonce, $supercachedir, $super_cache_enabled, $blog_cache_dir, $cache_compression;
|
2580 |
global $wp_cache_object_cache, $wp_cache_preload_on;
|
2581 |
|
2582 |
if ( '/' != substr($cache_path, -1)) {
|
2609 |
|
2610 |
$cache_stats = get_option( 'supercache_stats' );
|
2611 |
if ( !is_array( $cache_stats ) || ( isset( $_GET[ 'listfiles' ] ) ) || ( $valid_nonce && array_key_exists('action', $_GET) && $_GET[ 'action' ] == 'regenerate_cache_stats' ) ) {
|
|
|
2612 |
$count = 0;
|
2613 |
$expired = 0;
|
2614 |
$now = time();
|
2625 |
$supercacheuri = trailingslashit( realpath( $cache_path . 'supercache/' . $supercacheuri ) );
|
2626 |
if ( wp_cache_confirm_delete( $supercacheuri ) ) {
|
2627 |
printf( __( "Deleting supercache file: <strong>%s</strong><br />", 'wp-super-cache' ), $supercacheuri );
|
2628 |
+
wpsc_delete_files( $supercacheuri );
|
|
|
2629 |
prune_super_cache( $supercacheuri . 'page', true );
|
2630 |
@rmdir( $supercacheuri );
|
2631 |
+
} else {
|
2632 |
+
wp_die( __( 'Warning! You are not allowed to delete that file', 'wp-super-cache' ) );
|
2633 |
}
|
2634 |
}
|
2635 |
while( false !== ( $file = readdir( $handle ) ) ) {
|
2668 |
$count++;
|
2669 |
}
|
2670 |
$wp_cache_fsize += $fsize;
|
|
|
2671 |
}
|
2672 |
}
|
2673 |
closedir($handle);
|
2684 |
} else {
|
2685 |
$wp_cache_fsize = '0KB';
|
2686 |
}
|
2687 |
+
$cache_stats = wp_cache_regenerate_cache_file_stats();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2688 |
} else {
|
2689 |
echo "<p>" . __( 'Cache stats are not automatically generated. You must click the link below to regenerate the stats on this page.', 'wp-super-cache' ) . "</p>";
|
2690 |
echo "<a href='" . wp_nonce_url( add_query_arg( array( 'page' => 'wpsupercache', 'tab' => 'contents', 'action' => 'regenerate_cache_stats' ) ), 'wp-cache' ) . "'>" . __( 'Regenerate cache stats', 'wp-super-cache' ) . "</a>";
|
2695 |
}// regerate stats cache
|
2696 |
|
2697 |
if ( is_array( $cache_stats ) ) {
|
2698 |
+
$fsize = wp_cache_format_fsize( $cache_stats[ 'wpcache' ][ 'fsize' ] / 1024 );
|
2699 |
+
echo "<p><strong>" . __( 'WP-Cache', 'wp-super-cache' ) . " ({$fsize})</strong></p>";
|
2700 |
echo "<ul><li>" . sprintf( __( '%s Cached Pages', 'wp-super-cache' ), $cache_stats[ 'wpcache' ][ 'cached' ] ) . "</li>";
|
2701 |
echo "<li>" . sprintf( __( '%s Expired Pages', 'wp-super-cache' ), $cache_stats[ 'wpcache' ][ 'expired' ] ) . "</li></ul>";
|
2702 |
$divisor = $cache_compression == 1 ? 2 : 1;
|
2704 |
$fsize = $cache_stats[ 'supercache' ][ 'fsize' ] / 1024;
|
2705 |
else
|
2706 |
$fsize = 0;
|
2707 |
+
$fsize = wp_cache_format_fsize( $fsize );
|
|
|
|
|
|
|
|
|
|
|
|
|
2708 |
echo "<p><strong>" . __( 'WP-Super-Cache', 'wp-super-cache' ) . " ({$fsize})</strong></p>";
|
2709 |
echo "<ul><li>" . sprintf( __( '%s Cached Pages', 'wp-super-cache' ), intval( $cache_stats[ 'supercache' ][ 'cached' ] / $divisor ) ) . "</li>";
|
2710 |
+
if ( isset( $now ) && isset( $cache_stats ) )
|
2711 |
+
$age = intval( ( $now - $cache_stats['generated'] ) / 60 );
|
2712 |
else
|
2713 |
$age = 0;
|
2714 |
echo "<li>" . sprintf( __( '%s Expired Pages', 'wp-super-cache' ), intval( $cache_stats[ 'supercache' ][ 'expired' ] / $divisor ) ) . "</li></ul>";
|
2715 |
if ( $valid_nonce && array_key_exists('listfiles', $_GET) && $_GET[ 'listfiles' ] ) {
|
2716 |
echo "<div style='padding: 10px; border: 1px solid #333; height: 400px; width: 90%; overflow: auto'>";
|
2717 |
+
$cache_description = array( 'supercache' => __( 'Super Cached Files', 'wp-super-cache' ), 'wpcache' => __( 'Full Cache Files', 'wp-super-cache' ) );
|
2718 |
+
foreach( $cache_stats as $type => $details ) {
|
2719 |
+
if ( is_array( $details ) == false )
|
2720 |
+
continue;
|
2721 |
+
foreach( array( 'cached_list' => 'Fresh', 'expired_list' => 'Stale' ) as $list => $description ) {
|
2722 |
+
if ( is_array( $details[ $list ] ) & !empty( $details[ $list ] ) ) {
|
2723 |
+
echo "<h4>" . sprintf( __( '%s %s Files', 'wp-super-cache' ), $description, $cache_description[ $type ] ) . "</h4>";
|
2724 |
+
echo "<table class='widefat'><tr><th>#</th><th>" . __( 'URI', 'wp-super-cache' ) . "</th><th>" . __( 'Files', 'wp-super-cache' ) . "</th><th>" . __( 'Age', 'wp-super-cache' ) . "</th><th>" . __( 'Delete', 'wp-super-cache' ) . "</th></tr>";
|
2725 |
+
$c = 1;
|
2726 |
+
$flip = 1;
|
2727 |
+
|
2728 |
+
ksort( $details[ $list ] );
|
2729 |
+
foreach( $details[ $list ] as $directory => $d ) {
|
2730 |
+
if ( isset( $d[ 'upper_age' ] ) ) {
|
2731 |
+
$age = "{$d[ 'lower_age' ]} - {$d[ 'upper_age' ]}";
|
2732 |
+
} else {
|
2733 |
+
$age = $d[ 'lower_age' ];
|
2734 |
+
}
|
2735 |
+
$bg = $flip ? 'style="background: #EAEAEA;"' : '';
|
2736 |
+
echo "<tr $bg><td>$c</td><td> <a href='http://{$directory}'>{$directory}</a></td><td>{$d[ 'files' ]}</td><td>{$age}</td><td><a href='" . wp_nonce_url( add_query_arg( array( 'page' => 'wpsupercache', 'action' => 'deletesupercache', 'uri' => base64_encode( $directory ) ) ), 'wp-cache' ) . "#listfiles'>X</a></td></tr>\n";
|
2737 |
+
$flip = !$flip;
|
2738 |
+
$c++;
|
2739 |
+
}
|
2740 |
+
echo "</table>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2741 |
}
|
2742 |
}
|
|
|
2743 |
}
|
2744 |
echo "</div>";
|
2745 |
echo "<p><a href='?page=wpsupercache&tab=contents#top'>" . __( 'Hide file list', 'wp-super-cache' ) . "</a></p>";
|
2750 |
}
|
2751 |
if ( $cache_max_time > 0 )
|
2752 |
echo "<p>" . sprintf( __( 'Expired files are files older than %s seconds. They are still used by the plugin and are deleted periodically.', 'wp-super-cache' ), $cache_max_time ) . "</p>";
|
2753 |
+
if ( $wp_cache_preload_on )
|
2754 |
+
echo "<p>" . __( 'Preload mode is enabled. Supercache files will never be expired.', 'wp-super-cache' ) . "</p>";
|
2755 |
} // cache_stats
|
2756 |
wp_cache_delete_buttons();
|
2757 |
|
2792 |
add_action( 'dashmenu', 'delete_cache_dashboard' );
|
2793 |
|
2794 |
function wpsc_dirsize($directory, $sizes) {
|
2795 |
+
global $cache_max_time, $cache_path, $valid_nonce, $wp_cache_preload_on, $file_prefix;
|
2796 |
$now = time();
|
2797 |
|
2798 |
if (is_dir($directory)) {
|
2805 |
closedir($dh);
|
2806 |
}
|
2807 |
} else {
|
2808 |
+
if ( is_file( $directory ) && strpos( $directory, 'meta-' . $file_prefix ) === false ) {
|
2809 |
+
if ( strpos( $directory, '/' . $file_prefix ) !== false ) {
|
2810 |
+
$cache_type = 'wpcache';
|
2811 |
+
} else {
|
2812 |
+
$cache_type = 'supercache';
|
2813 |
+
}
|
2814 |
+
$keep_fresh = false;
|
2815 |
+
if ( $cache_type == 'supercache' && $wp_cache_preload_on )
|
2816 |
+
$keep_fresh = true;
|
2817 |
$filem = filemtime( $directory );
|
2818 |
+
if ( $keep_fresh == false && $cache_max_time > 0 && $filem + $cache_max_time <= $now ) {
|
2819 |
+
$cache_status = 'expired';
|
|
|
|
|
2820 |
} else {
|
2821 |
+
$cache_status = 'cached';
|
2822 |
+
}
|
2823 |
+
$sizes[ $cache_type ][ $cache_status ]+=1;
|
2824 |
+
if ( $valid_nonce && isset( $_GET[ 'listfiles' ] ) ) {
|
2825 |
+
$dir = str_replace( $cache_path . 'supercache/' , '', dirname( $directory ) );
|
2826 |
+
$age = $now - $filem;
|
2827 |
+
if ( false == isset( $sizes[ $cache_type ][ $cache_status . '_list' ][ $dir ] ) ) {
|
2828 |
+
$sizes[ $cache_type ][ $cache_status . '_list' ][ $dir ][ 'lower_age' ] = $age;
|
2829 |
+
$sizes[ $cache_type ][ $cache_status . '_list' ][ $dir ][ 'files' ] = 1;
|
2830 |
+
} else {
|
2831 |
+
$sizes[ $cache_type ][ $cache_status . '_list' ][ $dir ][ 'files' ] += 1;
|
2832 |
+
if ( $age <= $sizes[ $cache_type ][ $cache_status . '_list' ][ $dir ][ 'lower_age' ] ) {
|
2833 |
+
|
2834 |
+
if ( $age < $sizes[ $cache_type ][ $cache_status . '_list' ][ $dir ][ 'lower_age' ] && !isset( $sizes[ $cache_type ][ $cache_status . '_list' ][ $dir ][ 'upper_age' ] ) )
|
2835 |
+
$sizes[ $cache_type ][ $cache_status . '_list' ][ $dir ][ 'upper_age' ] = $sizes[ $cache_type ][ $cache_status . '_list' ][ $dir ][ 'lower_age' ];
|
2836 |
+
|
2837 |
+
$sizes[ $cache_type ][ $cache_status . '_list' ][ $dir ][ 'lower_age' ] = $age;
|
2838 |
+
|
2839 |
+
} elseif ( !isset( $sizes[ $cache_type ][ $cache_status . '_list' ][ $dir ][ 'upper_age' ] ) || $age > $sizes[ $cache_type ][ $cache_status . '_list' ][ $dir ][ 'upper_age' ] ) {
|
2840 |
+
|
2841 |
+
$sizes[ $cache_type ][ $cache_status . '_list' ][ $dir ][ 'upper_age' ] = $age;
|
2842 |
+
|
2843 |
+
}
|
2844 |
+
}
|
2845 |
}
|
2846 |
if ( ! isset( $sizes[ 'fsize' ] ) )
|
2847 |
+
$sizes[ $cache_type ][ 'fsize' ] = @filesize( $directory );
|
2848 |
else
|
2849 |
+
$sizes[ $cache_type ][ 'fsize' ] += @filesize( $directory );
|
2850 |
}
|
2851 |
}
|
2852 |
return $sizes;
|
2853 |
}
|
2854 |
|
2855 |
function wp_cache_clean_cache( $file_prefix, $all = false ) {
|
2856 |
+
global $cache_path, $supercachedir, $blog_cache_dir, $wp_cache_object_cache;
|
2857 |
|
2858 |
if ( $wp_cache_object_cache && function_exists( "reset_oc_version" ) )
|
2859 |
reset_oc_version();
|
2862 |
prune_super_cache( $cache_path, true );
|
2863 |
return true;
|
2864 |
}
|
2865 |
+
if ( $supercachedir == '' )
|
2866 |
+
$supercachedir = get_supercache_dir();
|
2867 |
|
2868 |
if (function_exists ('prune_super_cache')) {
|
2869 |
if( is_dir( $supercachedir ) ) {
|
2881 |
|
2882 |
}
|
2883 |
|
2884 |
+
function wpsc_delete_url_cache( $url ) {
|
2885 |
+
$dir = str_replace( get_option( 'home' ), '', $url );
|
2886 |
+
if ( $dir != '' ) {
|
2887 |
+
$supercachedir = get_supercache_dir();
|
2888 |
+
wpsc_delete_files( $supercachedir . $dir );
|
2889 |
+
prune_super_cache( $supercachedir . $dir . '/page', true );
|
2890 |
+
return true;
|
2891 |
+
} else {
|
2892 |
+
return false;
|
2893 |
+
}
|
2894 |
+
}
|
2895 |
+
|
2896 |
+
function wpsc_delete_post_cache( $id ) {
|
2897 |
+
$post = get_post( $id );
|
2898 |
+
wpsc_delete_url_cache( get_author_posts_url( $post->post_author ) );
|
2899 |
+
$permalink = get_permalink( $id );
|
2900 |
+
if ( $permalink != '' ) {
|
2901 |
+
wpsc_delete_url_cache( $permalink );
|
2902 |
+
return true;
|
2903 |
+
} else {
|
2904 |
+
return false;
|
2905 |
+
}
|
2906 |
+
}
|
2907 |
+
|
2908 |
function wp_cache_clean_legacy_files( $dir, $file_prefix ) {
|
2909 |
global $wpdb;
|
2910 |
|
2920 |
|
2921 |
if ( strpos( $file, $file_prefix ) !== false ) {
|
2922 |
if ( strpos( $file, '.html' ) ) {
|
2923 |
+
// delete old WPCache files immediately
|
2924 |
@unlink( $dir . $file);
|
2925 |
@unlink( $dir . 'meta/' . str_replace( '.html', '.meta', $file ) );
|
2926 |
} else {
|
2937 |
}
|
2938 |
|
2939 |
function wp_cache_clean_expired($file_prefix) {
|
2940 |
+
global $cache_max_time, $blog_cache_dir, $wp_cache_preload_on;
|
2941 |
|
2942 |
if ( $cache_max_time == 0 ) {
|
2943 |
return false;
|
2983 |
}
|
2984 |
|
2985 |
$f = fopen( $filename, 'w' );
|
|
|
2986 |
if ( $markerdata ) {
|
2987 |
$state = true;
|
2988 |
foreach ( $markerdata as $n => $markerline ) {
|
3006 |
}
|
3007 |
|
3008 |
function wp_super_cache_footer() {
|
3009 |
+
?><p id='supercache'><?php printf( __( '%1$s is Stephen Fry proof thanks to caching by %2$s', 'wp-super-cache' ), get_bloginfo( 'name', 'display' ), '<a href="https://odd.blog/wp-super-cache/">WP Super Cache</a>' ); ?></p><?php
|
3010 |
}
|
3011 |
if( isset( $wp_cache_hello_world ) && $wp_cache_hello_world )
|
3012 |
add_action( 'wp_footer', 'wp_super_cache_footer' );
|
3039 |
function wp_cache_plugin_notice( $plugin ) {
|
3040 |
global $cache_enabled;
|
3041 |
if( $plugin == 'wp-super-cache/wp-cache.php' && !$cache_enabled && function_exists( "admin_url" ) )
|
3042 |
+
echo '<td colspan="5" class="plugin-update">' . sprintf( __( 'WP Super Cache must be configured. Go to <a href="%s">the admin page</a> to enable and configure the plugin.', 'wp-super-cache' ), admin_url( 'options-general.php?page=wpsupercache' ) ) . '</td>';
|
3043 |
}
|
3044 |
add_action( 'after_plugin_row', 'wp_cache_plugin_notice' );
|
3045 |
|
3046 |
function wp_cache_plugin_actions( $links, $file ) {
|
3047 |
if( $file == 'wp-super-cache/wp-cache.php' && function_exists( "admin_url" ) ) {
|
3048 |
+
$settings_link = '<a href="' . admin_url( 'options-general.php?page=wpsupercache' ) . '">' . __( 'Settings', 'wp-super-cache' ) . '</a>';
|
3049 |
array_unshift( $links, $settings_link ); // before other links
|
3050 |
}
|
3051 |
return $links;
|
3055 |
function wp_cache_admin_notice() {
|
3056 |
global $cache_enabled, $wp_cache_phase1_loaded;
|
3057 |
if( substr( $_SERVER["PHP_SELF"], -11 ) == 'plugins.php' && !$cache_enabled && function_exists( "admin_url" ) )
|
3058 |
+
echo '<div class="notice notice-info"><p><strong>' . sprintf( __('WP Super Cache is disabled. Please go to the <a href="%s">plugin admin page</a> to enable caching.', 'wp-super-cache' ), admin_url( 'options-general.php?page=wpsupercache' ) ) . '</strong></p></div>';
|
3059 |
|
3060 |
if ( defined( 'WP_CACHE' ) && WP_CACHE == true && ( defined( 'ADVANCEDCACHEPROBLEM' ) || ( $cache_enabled && false == isset( $wp_cache_phase1_loaded ) ) ) ) {
|
3061 |
+
echo '<div class="notice notice-error"><p>' . sprintf( __( 'Warning! WP Super Cache caching <strong>was</strong> broken but has been <strong>fixed</strong>! The script advanced-cache.php could not load wp-cache-phase1.php.<br /><br />The file %1$s/advanced-cache.php has been recreated and WPCACHEHOME fixed in your wp-config.php. Reload to hide this message.', 'wp-super-cache' ), WP_CONTENT_DIR ) . '</p></div>';
|
3062 |
wp_cache_create_advanced_cache();
|
3063 |
}
|
3064 |
}
|
3109 |
|
3110 |
function update_cached_mobile_ua_list( $mobile_browsers, $mobile_prefixes = 0, $mobile_groups = 0 ) {
|
3111 |
global $wp_cache_config_file, $wp_cache_mobile_browsers, $wp_cache_mobile_prefixes, $wp_cache_mobile_groups;
|
3112 |
+
wp_cache_setting( 'wp_cache_mobile_browsers', $mobile_browsers );
|
3113 |
+
wp_cache_setting( 'wp_cache_mobile_prefixes', $mobile_prefixes );
|
|
|
|
|
|
|
|
|
|
|
|
|
3114 |
if ( is_array( $mobile_groups ) ) {
|
3115 |
$wp_cache_mobile_groups = $mobile_groups;
|
3116 |
wp_cache_replace_line('^ *\$wp_cache_mobile_groups', "\$wp_cache_mobile_groups = '" . implode( ', ', $mobile_groups ) . "';", $wp_cache_config_file);
|
3195 |
}
|
3196 |
$home_path = get_home_path();
|
3197 |
$home_root = parse_url(get_bloginfo('url'));
|
3198 |
+
$home_root = isset( $home_root[ 'path' ] ) ? trailingslashit( $home_root[ 'path' ] ) : '/';
|
3199 |
+
if (
|
3200 |
+
$home_root == '/' &&
|
3201 |
+
$home_path != $_SERVER[ 'DOCUMENT_ROOT' ]
|
3202 |
+
) {
|
3203 |
+
$home_path = $_SERVER[ 'DOCUMENT_ROOT' ];
|
3204 |
+
} elseif (
|
3205 |
+
$home_root != '/' &&
|
3206 |
+
$home_path != str_replace( '//', '/', $_SERVER[ 'DOCUMENT_ROOT' ] . $home_root ) &&
|
3207 |
+
is_dir( $_SERVER[ 'DOCUMENT_ROOT' ] . $home_root )
|
3208 |
+
) {
|
3209 |
+
$home_path = str_replace( '//', '/', $_SERVER[ 'DOCUMENT_ROOT' ] . $home_root );
|
3210 |
+
}
|
3211 |
$home_root_lc = str_replace( '//', '/', strtolower( $home_root ) );
|
3212 |
$inst_root = str_replace( '//', '/', '/' . trailingslashit( str_replace( $content_dir_root, '', str_replace( '\\', '/', WP_CONTENT_DIR ) ) ) );
|
3213 |
$wprules = implode( "\n", extract_from_markers( $home_path.'.htaccess', 'WordPress' ) );
|
3225 |
$condition_rules[] = "RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\\\"]+ [NC]";
|
3226 |
$condition_rules[] = "RewriteCond %{HTTP:Profile} !^[a-z0-9\\\"]+ [NC]";
|
3227 |
if ( $wp_cache_mobile_enabled ) {
|
3228 |
+
if ( isset( $wp_cache_mobile_browsers ) && "" != $wp_cache_mobile_browsers )
|
3229 |
+
$condition_rules[] = "RewriteCond %{HTTP_USER_AGENT} !^.*(" . addcslashes( str_replace( ', ', '|', $wp_cache_mobile_browsers ), ' ' ) . ").* [NC]";
|
3230 |
+
if ( isset( $wp_cache_mobile_prefixes ) && "" != $wp_cache_mobile_prefixes )
|
3231 |
+
$condition_rules[] = "RewriteCond %{HTTP_USER_AGENT} !^(" . addcslashes( str_replace( ', ', '|', $wp_cache_mobile_prefixes ), ' ' ) . ").* [NC]";
|
3232 |
}
|
3233 |
$condition_rules = apply_filters( 'supercacherewriteconditions', $condition_rules );
|
3234 |
|
3283 |
if ( !function_exists( 'prune_super_cache' ) )
|
3284 |
include_once( 'wp-cache-phase2.php' );
|
3285 |
|
3286 |
+
wp_cache_debug( "clear_post_supercache: deleting files in $dir", 2 );
|
3287 |
+
prune_super_cache( $dir, true );
|
|
|
|
|
|
|
3288 |
}
|
3289 |
|
3290 |
function wp_cron_preload_cache() {
|
3295 |
wp_cache_debug( "wp_cron_preload_cache: preload cancelled", 1 );
|
3296 |
return true;
|
3297 |
}
|
3298 |
+
|
3299 |
+
if ( !function_exists( 'wp_cache_debug' ) )
|
3300 |
+
include_once( 'wp-cache-phase1.php' );
|
3301 |
+
if ( !function_exists( 'prune_super_cache' ) )
|
3302 |
+
include_once( 'wp-cache-phase2.php' );
|
3303 |
+
|
3304 |
$mutex = $cache_path . "preload_mutex.tmp";
|
3305 |
sleep( 3 + mt_rand( 1, 5 ) );
|
3306 |
if ( @file_exists( $mutex ) ) {
|
3325 |
|
3326 |
update_option( 'preload_cache_counter', array( 'c' => ( $c + 100 ), 't' => time() ) );
|
3327 |
|
3328 |
+
if ( $wp_cache_preload_email_volume == 'none' && $wp_cache_preload_email_me == 1 ) {
|
3329 |
+
$wp_cache_preload_email_me = 0;
|
3330 |
+
wp_cache_setting( 'wp_cache_preload_email_me', 0 );
|
3331 |
+
}
|
3332 |
if ( $wp_cache_preload_email_me && $c == 0 )
|
3333 |
wp_mail( get_option( 'admin_email' ), sprintf( __( '[%1$s] Cache Preload Started', 'wp-super-cache' ), home_url(), '' ), ' ' );
|
3334 |
|
3392 |
$types = get_post_types( array( 'public' => true, 'publicly_queryable' => true ), 'names', 'or' );
|
3393 |
$types = array_map( 'esc_sql', $types );
|
3394 |
$types = "'" . implode( "','", $types ) . "'";
|
3395 |
+
$posts = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE ( post_type IN ( $types ) ) AND post_status = 'publish' ORDER BY ID DESC LIMIT $c, 100" );
|
3396 |
wp_cache_debug( "wp_cron_preload_cache: got 100 posts from position $c.", 5 );
|
3397 |
} else {
|
3398 |
wp_cache_debug( "wp_cron_preload_cache: no more posts to get. Limit ($wp_cache_preload_posts) reached.", 5 );
|
3439 |
sleep( 1 );
|
3440 |
$count++;
|
3441 |
}
|
3442 |
+
if ( $wp_cache_preload_email_me && ( $wp_cache_preload_email_volume == 'medium' || $wp_cache_preload_email_volume == 'many' ) )
|
3443 |
wp_mail( get_option( 'admin_email' ), sprintf( __( '[%1$s] %2$d posts refreshed', 'wp-super-cache' ), home_url(), ($c+100) ), __( "Refreshed the following posts:", 'wp-super-cache' ) . "\n$msg" );
|
3444 |
if ( defined( 'DOING_CRON' ) ) {
|
3445 |
wp_cache_debug( "wp_cron_preload_cache: scheduling the next preload in 30 seconds.", 5 );
|
3510 |
add_action( 'init', 'check_up_on_preloading' ); // sometimes preloading stops working. Kickstart it.
|
3511 |
|
3512 |
function wp_cache_disable_plugin( $delete_config_file = true ) {
|
3513 |
+
global $wp_rewrite;
|
3514 |
if ( file_exists( ABSPATH . 'wp-config.php') ) {
|
3515 |
$global_config_file = ABSPATH . 'wp-config.php';
|
3516 |
} else {
|
3589 |
}
|
3590 |
add_action( 'wp_before_admin_bar_render', 'supercache_admin_bar_render' );
|
3591 |
|
3592 |
+
function wpsc_cancel_preload() {
|
3593 |
+
global $cache_path;
|
3594 |
+
$next_preload = wp_next_scheduled( 'wp_cache_preload_hook' );
|
3595 |
+
if ( $next_preload ) {
|
3596 |
+
wp_cache_debug( 'wpsc_cancel_preload: unscheduling wp_cache_preload_hook' );
|
3597 |
+
update_option( 'preload_cache_counter', array( 'c' => 0, 't' => time() ) );
|
3598 |
+
wp_unschedule_event( $next_preload, 'wp_cache_preload_hook' );
|
3599 |
+
}
|
3600 |
+
$next_preload = wp_next_scheduled( 'wp_cache_full_preload_hook' );
|
3601 |
+
if ( $next_preload ) {
|
3602 |
+
update_option( 'preload_cache_counter', array( 'c' => 0, 't' => time() ) );
|
3603 |
+
wp_cache_debug( 'wpsc_cancel_preload: unscheduling wp_cache_full_preload_hook' );
|
3604 |
+
wp_unschedule_event( $next_preload, 'wp_cache_full_preload_hook' );
|
3605 |
+
}
|
3606 |
+
wp_cache_debug( 'wpsc_cancel_preload: creating stop_preload.txt' );
|
3607 |
+
$fp = @fopen( $cache_path . "stop_preload.txt", 'w' );
|
3608 |
+
@fclose( $fp );
|
3609 |
+
}
|
3610 |
+
|
3611 |
+
function wpsc_enable_preload() {
|
3612 |
+
global $cache_path;
|
3613 |
+
|
3614 |
+
@unlink( $cache_path . "preload_mutex.tmp" );
|
3615 |
+
update_option( 'preload_cache_counter', array( 'c' => 0, 't' => time() ) );
|
3616 |
+
wp_schedule_single_event( time() + 10, 'wp_cache_full_preload_hook' );
|
3617 |
+
}
|
3618 |
+
|
3619 |
+
function wpsc_preload_settings( $min_refresh_interval = 'NA' ) {
|
3620 |
+
global $wp_cache_preload_interval, $wp_cache_preload_on, $wp_cache_preload_taxonomies, $wp_cache_preload_email_me, $wp_cache_preload_email_volume, $wp_cache_preload_posts, $wpdb;
|
3621 |
+
|
3622 |
+
$return = array();
|
3623 |
+
|
3624 |
+
if ( isset( $_POST[ 'action' ] ) == false || $_POST[ 'action' ] != 'preload' )
|
3625 |
+
return $return;
|
3626 |
+
|
3627 |
+
if ( isset( $_POST[ 'preload_off' ] ) ) {
|
3628 |
+
wpsc_cancel_preload();
|
3629 |
+
$return[] = "<p><strong>" . __( 'Scheduled preloading of cache almost cancelled. It may take up to a minute for it to cancel completely.', 'wp-super-cache' ) . "</strong></p>";
|
3630 |
+
return $return;
|
3631 |
+
} elseif ( isset( $_POST[ 'preload_now' ] ) ) {
|
3632 |
+
wpsc_enable_preload();
|
3633 |
+
return $return;
|
3634 |
+
}
|
3635 |
+
|
3636 |
+
if ( $min_refresh_interval == 'NA' ) {
|
3637 |
+
$posts_count = wp_count_posts();
|
3638 |
+
$count = $posts_count->publish;
|
3639 |
+
if ( $count > 1000 ) {
|
3640 |
+
$min_refresh_interval = 720;
|
3641 |
+
} else {
|
3642 |
+
$min_refresh_interval = 30;
|
3643 |
+
}
|
3644 |
+
}
|
3645 |
+
if ( isset( $_POST[ 'wp_cache_preload_interval' ] ) && ( $_POST[ 'wp_cache_preload_interval' ] == 0 || $_POST[ 'wp_cache_preload_interval' ] >= $min_refresh_interval ) ) {
|
3646 |
+
// if preload interval changes than unschedule any preload jobs and schedule any new one.
|
3647 |
+
$_POST[ 'wp_cache_preload_interval' ] = (int)$_POST[ 'wp_cache_preload_interval' ];
|
3648 |
+
if ( $wp_cache_preload_interval != $_POST[ 'wp_cache_preload_interval' ] ) {
|
3649 |
+
$next_preload = wp_next_scheduled( 'wp_cache_full_preload_hook' );
|
3650 |
+
if ( $next_preload ) {
|
3651 |
+
update_option( 'preload_cache_counter', array( 'c' => 0, 't' => time() ) );
|
3652 |
+
add_option( 'preload_cache_stop', 1 );
|
3653 |
+
wp_unschedule_event( $next_preload, 'wp_cache_full_preload_hook' );
|
3654 |
+
if ( $wp_cache_preload_interval == 0 ) {
|
3655 |
+
$return[] = "<p><strong>" . __( 'Scheduled preloading of cache cancelled.', 'wp-super-cache' ) . "</strong></p>";
|
3656 |
+
}
|
3657 |
+
if ( $_POST[ 'wp_cache_preload_interval' ] != 0 )
|
3658 |
+
wp_schedule_single_event( time() + ( $_POST[ 'wp_cache_preload_interval' ] * 60 ), 'wp_cache_full_preload_hook' );
|
3659 |
+
}
|
3660 |
+
}
|
3661 |
+
|
3662 |
+
$wp_cache_preload_interval = (int)$_POST[ 'wp_cache_preload_interval' ];
|
3663 |
+
wp_cache_setting( "wp_cache_preload_interval", $wp_cache_preload_interval );
|
3664 |
+
}
|
3665 |
+
|
3666 |
+
if ( $_POST[ 'wp_cache_preload_posts' ] == 'all' ) {
|
3667 |
+
$wp_cache_preload_posts = 'all';
|
3668 |
+
} else {
|
3669 |
+
$wp_cache_preload_posts = (int)$_POST[ 'wp_cache_preload_posts' ];
|
3670 |
+
}
|
3671 |
+
wp_cache_setting( 'wp_cache_preload_posts', $wp_cache_preload_posts );
|
3672 |
+
|
3673 |
+
if ( isset( $_POST[ 'wp_cache_preload_email_volume' ] ) && in_array( $_POST[ 'wp_cache_preload_email_volume' ], array( 'none', 'less', 'medium', 'many' ) ) ) {
|
3674 |
+
$wp_cache_preload_email_volume = $_POST[ 'wp_cache_preload_email_volume' ];
|
3675 |
+
} else {
|
3676 |
+
$wp_cache_preload_email_volume = 'none';
|
3677 |
+
}
|
3678 |
+
wp_cache_setting( 'wp_cache_preload_email_volume', $wp_cache_preload_email_volume );
|
3679 |
+
|
3680 |
+
if ( $wp_cache_preload_email_volume == 'none' )
|
3681 |
+
wp_cache_setting( 'wp_cache_preload_email_me', 0 );
|
3682 |
+
else
|
3683 |
+
wp_cache_setting( 'wp_cache_preload_email_me', 1 );
|
3684 |
+
|
3685 |
+
if ( isset( $_POST[ 'wp_cache_preload_taxonomies' ] ) ) {
|
3686 |
+
$wp_cache_preload_taxonomies = 1;
|
3687 |
+
} else {
|
3688 |
+
$wp_cache_preload_taxonomies = 0;
|
3689 |
+
}
|
3690 |
+
wp_cache_setting( 'wp_cache_preload_taxonomies', $wp_cache_preload_taxonomies );
|
3691 |
+
|
3692 |
+
if ( isset( $_POST[ 'wp_cache_preload_on' ] ) ) {
|
3693 |
+
$wp_cache_preload_on = 1;
|
3694 |
+
} else {
|
3695 |
+
$wp_cache_preload_on = 0;
|
3696 |
+
}
|
3697 |
+
wp_cache_setting( 'wp_cache_preload_on', $wp_cache_preload_on );
|
3698 |
+
|
3699 |
+
return $return;
|
3700 |
+
}
|
3701 |
+
|
3702 |
+
function wpsc_is_preloading() {
|
3703 |
+
if ( wp_next_scheduled( 'wp_cache_preload_hook' ) || wp_next_scheduled( 'wp_cache_full_preload_hook' ) ) {
|
3704 |
+
return true;
|
3705 |
+
} else {
|
3706 |
+
return false;
|
3707 |
+
}
|
3708 |
+
}
|
3709 |
+
|
3710 |
+
function wpsc_set_default_gc( $force = false ) {
|
3711 |
+
global $cache_path, $wp_cache_shutdown_gc, $cache_schedule_type;
|
3712 |
+
|
3713 |
+
if ( isset( $wp_cache_shutdown_gc ) && $wp_cache_shutdown_gc == 1 ) {
|
3714 |
+
return false;
|
3715 |
+
}
|
3716 |
+
|
3717 |
+
if ( $force ) {
|
3718 |
+
unset( $cache_schedule_type );
|
3719 |
+
$timestamp = wp_next_scheduled( 'wp_cache_gc' );
|
3720 |
+
if ( $timestamp ) {
|
3721 |
+
wp_unschedule_event( $timestamp, 'wp_cache_gc' );
|
3722 |
+
}
|
3723 |
+
}
|
3724 |
+
|
3725 |
+
// set up garbage collection with some default settings
|
3726 |
+
if ( false == isset( $cache_schedule_type ) && false == wp_next_scheduled( 'wp_cache_gc' ) ) {
|
3727 |
+
$cache_schedule_type = 'interval';
|
3728 |
+
$cache_time_interval = 600;
|
3729 |
+
$cache_max_time = 1800;
|
3730 |
+
$cache_schedule_interval = 'hourly';
|
3731 |
+
$cache_gc_email_me = 0;
|
3732 |
+
wp_cache_setting( 'cache_schedule_type', $cache_schedule_type );
|
3733 |
+
wp_cache_setting( 'cache_time_interval', $cache_time_interval );
|
3734 |
+
wp_cache_setting( 'cache_max_time', $cache_max_time );
|
3735 |
+
wp_cache_setting( 'cache_schedule_interval', $cache_schedule_interval );
|
3736 |
+
wp_cache_setting( 'cache_gc_email_me', $cache_gc_email_me );
|
3737 |
+
|
3738 |
+
wp_schedule_single_event( time() + 600, 'wp_cache_gc' );
|
3739 |
+
}
|
3740 |
+
|
3741 |
+
return true;
|
3742 |
+
|
3743 |
+
}
|
3744 |
+
|
3745 |
+
function add_mod_rewrite_rules() {
|
3746 |
+
return update_mod_rewrite_rules();
|
3747 |
+
}
|
3748 |
+
|
3749 |
+
function remove_mod_rewrite_rules() {
|
3750 |
+
return update_mod_rewrite_rules( false );
|
3751 |
+
}
|
3752 |
+
|
3753 |
+
function update_mod_rewrite_rules( $add_rules = true ) {
|
3754 |
+
global $cache_path, $update_mod_rewrite_rules_error;
|
3755 |
+
|
3756 |
+
$update_mod_rewrite_rules_error = false;
|
3757 |
+
|
3758 |
+
if ( defined( "DO_NOT_UPDATE_HTACCESS" ) ) {
|
3759 |
+
$update_mod_rewrite_rules_error = ".htaccess update disabled by admin: DO_NOT_UPDATE_HTACCESS defined";
|
3760 |
+
return false;
|
3761 |
+
}
|
3762 |
+
|
3763 |
+
if ( ! function_exists( 'get_home_path' ) ) {
|
3764 |
+
include_once( ABSPATH . 'wp-admin/includes/file.php' ); // get_home_path()
|
3765 |
+
include_once( ABSPATH . 'wp-admin/includes/misc.php' ); // extract_from_markers()
|
3766 |
+
}
|
3767 |
+
$home_path = trailingslashit( get_home_path() );
|
3768 |
+
$home_root = parse_url( get_bloginfo( 'url' ) );
|
3769 |
+
$home_root = isset( $home_root[ 'path' ] ) ? trailingslashit( $home_root[ 'path' ] ) : '/';
|
3770 |
+
if (
|
3771 |
+
$home_root == '/' &&
|
3772 |
+
$home_path != $_SERVER[ 'DOCUMENT_ROOT' ]
|
3773 |
+
) {
|
3774 |
+
$home_path = $_SERVER[ 'DOCUMENT_ROOT' ];
|
3775 |
+
} elseif (
|
3776 |
+
$home_root != '/' &&
|
3777 |
+
$home_path != str_replace( '//', '/', $_SERVER[ 'DOCUMENT_ROOT' ] . $home_root ) &&
|
3778 |
+
is_dir( $_SERVER[ 'DOCUMENT_ROOT' ] . $home_root )
|
3779 |
+
) {
|
3780 |
+
$home_path = str_replace( '//', '/', $_SERVER[ 'DOCUMENT_ROOT' ] . $home_root );
|
3781 |
+
}
|
3782 |
+
|
3783 |
+
if ( ! file_exists( $home_path . ".htaccess" ) ) {
|
3784 |
+
$update_mod_rewrite_rules_error = ".htaccess not found: {$home_path}.htaccess";
|
3785 |
+
return false;
|
3786 |
+
}
|
3787 |
+
|
3788 |
+
$generated_rules = wpsc_get_htaccess_info();
|
3789 |
+
|
3790 |
+
if ( $add_rules ) {
|
3791 |
+
$rules = $generated_rules[ 'rules' ];
|
3792 |
+
} else {
|
3793 |
+
$rules = '';
|
3794 |
+
}
|
3795 |
+
|
3796 |
+
$existing_rules = implode( "\n", extract_from_markers( $home_path . '.htaccess', 'WPSuperCache' ) );
|
3797 |
+
|
3798 |
+
if ( $existing_rules == $rules ) {
|
3799 |
+
$update_mod_rewrite_rules_error = "rules have not changed";
|
3800 |
+
return true;
|
3801 |
+
}
|
3802 |
+
|
3803 |
+
if ( $generated_rules[ 'wprules' ] == '' ) {
|
3804 |
+
$update_mod_rewrite_rules_error = "WordPress rules empty";
|
3805 |
+
return false;
|
3806 |
+
}
|
3807 |
+
|
3808 |
+
$url = trailingslashit( get_bloginfo( 'url' ) );
|
3809 |
+
$original_page = wp_remote_get( $url, array( 'timeout' => 60, 'blocking' => true ) );
|
3810 |
+
if ( is_wp_error( $original_page ) ) {
|
3811 |
+
$update_mod_rewrite_rules_error = "Problem loading page";
|
3812 |
+
return false;
|
3813 |
+
}
|
3814 |
+
|
3815 |
+
$backup_filename = $cache_path . 'htaccess.' . mt_rand() . ".php";
|
3816 |
+
$backup_file_contents = file_get_contents( $home_path . '.htaccess' );
|
3817 |
+
file_put_contents( $backup_filename, "<" . "?php die(); ?" . ">" . $backup_file_contents );
|
3818 |
+
$existing_gzip_rules = implode( "\n", extract_from_markers( $cache_path . '.htaccess', 'supercache' ) );
|
3819 |
+
if ( $existing_gzip_rules != $generated_rules[ 'gziprules' ] ) {
|
3820 |
+
insert_with_markers( $cache_path . '.htaccess', 'supercache', explode( "\n", $generated_rules[ 'gziprules' ] ) );
|
3821 |
+
}
|
3822 |
+
$wprules = extract_from_markers( $home_path . '.htaccess', 'WordPress' );
|
3823 |
+
wpsc_remove_marker( $home_path . '.htaccess', 'WordPress' ); // remove original WP rules so SuperCache rules go on top
|
3824 |
+
if ( insert_with_markers( $home_path . '.htaccess', 'WPSuperCache', explode( "\n", $rules ) ) && insert_with_markers( $home_path . '.htaccess', 'WordPress', $wprules ) ) {
|
3825 |
+
$new_page = wp_remote_get( $url, array( 'timeout' => 60, 'blocking' => true ) );
|
3826 |
+
if ( is_wp_error( $new_page ) || $new_page[ 'body' ] != $original_page[ 'body' ] ) {
|
3827 |
+
file_put_contents( $home_path . '.htaccess', $backup_file_contents );
|
3828 |
+
unlink( $backup_filename );
|
3829 |
+
$update_mod_rewrite_rules_error = "page error or pages do not match and original .htaccess restored";
|
3830 |
+
return false;
|
3831 |
+
}
|
3832 |
+
} else {
|
3833 |
+
file_put_contents( $home_path . '.htaccess', $backup_file_contents );
|
3834 |
+
unlink( $backup_filename );
|
3835 |
+
$update_mod_rewrite_rules_error = "problem inserting rules in .htaccess and original .htaccess restored";
|
3836 |
+
return false;
|
3837 |
+
}
|
3838 |
+
|
3839 |
+
return true;
|
3840 |
+
}
|
wp-super-cache.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the same license as the WP Super Cache package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: WP Super Cache 1.4.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-super-cache\n"
|
7 |
-
"POT-Creation-Date: 2017-02-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -20,8 +20,8 @@ msgid ""
|
|
20 |
"<code>wp-content</code> and <code>wp-includes</code> directories (except for "
|
21 |
"PHP files) on your site with the URL you provide below. That way you can "
|
22 |
"either copy all the static content to a dedicated host or mirror the files "
|
23 |
-
"to a CDN by <a href=\"
|
24 |
-
"
|
25 |
msgstr ""
|
26 |
|
27 |
#: ossdl-cdn.php:154
|
@@ -108,13 +108,13 @@ msgstr ""
|
|
108 |
|
109 |
#: plugins/awaitingmoderation.php:34 plugins/badbehaviour.php:65
|
110 |
#: plugins/domain-mapping.php:75 plugins/jetpack.php:31
|
111 |
-
#: plugins/searchengine.php:69 plugins/wptouch.php:22 wp-cache.php:
|
112 |
msgid "Enabled"
|
113 |
msgstr ""
|
114 |
|
115 |
#: plugins/awaitingmoderation.php:35 plugins/badbehaviour.php:66
|
116 |
#: plugins/domain-mapping.php:76 plugins/jetpack.php:32
|
117 |
-
#: plugins/searchengine.php:70 plugins/wptouch.php:23 wp-cache.php:
|
118 |
msgid "Disabled"
|
119 |
msgstr ""
|
120 |
|
@@ -126,8 +126,8 @@ msgstr ""
|
|
126 |
|
127 |
#: plugins/awaitingmoderation.php:40 plugins/badbehaviour.php:71
|
128 |
#: plugins/domain-mapping.php:81 plugins/jetpack.php:37
|
129 |
-
#: plugins/searchengine.php:75 plugins/wptouch.php:28 wp-cache.php:
|
130 |
-
#: wp-cache.php:
|
131 |
msgid "enabled"
|
132 |
msgstr ""
|
133 |
|
@@ -166,7 +166,7 @@ msgstr ""
|
|
166 |
msgid "Bad Behavior support is now %s"
|
167 |
msgstr ""
|
168 |
|
169 |
-
#: plugins/badbehaviour.php:83 wp-cache.php:
|
170 |
msgid "Warning!"
|
171 |
msgstr ""
|
172 |
|
@@ -216,11 +216,11 @@ msgstr ""
|
|
216 |
msgid "Cached"
|
217 |
msgstr ""
|
218 |
|
219 |
-
#: plugins/multisite.php:31 wp-cache.php:
|
220 |
msgid "Enable"
|
221 |
msgstr ""
|
222 |
|
223 |
-
#: plugins/multisite.php:33 plugins/searchengine.php:61 wp-cache.php:
|
224 |
msgid "Disable"
|
225 |
msgstr ""
|
226 |
|
@@ -262,17 +262,17 @@ msgid ""
|
|
262 |
"the WPTouch helper plugin."
|
263 |
msgstr ""
|
264 |
|
265 |
-
#: wp-cache-phase2.php:
|
266 |
msgid "Cache expiry cron job failed. Job will run again in 10 seconds."
|
267 |
msgstr ""
|
268 |
|
269 |
-
#: wp-cache-phase2.php:
|
270 |
msgid ""
|
271 |
"Cache expiry cron job took more than 30 seconds. You should probably run the "
|
272 |
"garbage collector more often."
|
273 |
msgstr ""
|
274 |
|
275 |
-
#: wp-cache-phase2.php:
|
276 |
msgid "[%1$s] WP Super Cache GC Report"
|
277 |
msgstr ""
|
278 |
|
@@ -420,7 +420,7 @@ msgid ""
|
|
420 |
"a regular basis. Use <a href=\"#expirytime\">this form</a> to enable it."
|
421 |
msgstr ""
|
422 |
|
423 |
-
#: wp-cache.php:309 wp-cache.php:337 wp-cache.php:409 wp-cache.php:
|
424 |
msgid "Dismiss"
|
425 |
msgstr ""
|
426 |
|
@@ -532,60 +532,60 @@ msgid ""
|
|
532 |
"site is hosted. This will be fixed in the future."
|
533 |
msgstr ""
|
534 |
|
535 |
-
#: wp-cache.php:
|
536 |
msgid ""
|
537 |
"<strong>Warning!</strong> You attempted to enable compression but <code>zlib."
|
538 |
"output_compression</code> is enabled. See #21 in the Troubleshooting section "
|
539 |
"of the readme file."
|
540 |
msgstr ""
|
541 |
|
542 |
-
#: wp-cache.php:
|
543 |
msgid "WP Super Cache Settings"
|
544 |
msgstr ""
|
545 |
|
546 |
-
#: wp-cache.php:
|
547 |
msgid ""
|
548 |
"Notice: <em>Mod_rewrite or Legacy caching enabled</em>. Showing Advanced "
|
549 |
"Settings Page by default."
|
550 |
msgstr ""
|
551 |
|
552 |
-
#: wp-cache.php:
|
553 |
msgid ""
|
554 |
"Configuration file changed, some values might be wrong. Load the page again "
|
555 |
"from the \"Settings\" menu to reset them."
|
556 |
msgstr ""
|
557 |
|
558 |
-
#: wp-cache.php:
|
559 |
msgid "Caching must be enabled to use this feature"
|
560 |
msgstr ""
|
561 |
|
562 |
-
#: wp-cache.php:
|
563 |
msgid "Cancel Cache Preload"
|
564 |
msgstr ""
|
565 |
|
566 |
-
#: wp-cache.php:
|
567 |
msgid ""
|
568 |
"Scheduled preloading of cache almost cancelled. It may take up to a minute "
|
569 |
"for it to cancel completely."
|
570 |
msgstr ""
|
571 |
|
572 |
-
#: wp-cache.php:
|
573 |
msgid "Scheduled preloading of cache cancelled."
|
574 |
msgstr ""
|
575 |
|
576 |
-
#: wp-cache.php:
|
577 |
msgid "Preload Cache Now"
|
578 |
msgstr ""
|
579 |
|
580 |
-
#: wp-cache.php:
|
581 |
msgid "Scheduled preloading of cache in 10 seconds."
|
582 |
msgstr ""
|
583 |
|
584 |
-
#: wp-cache.php:
|
585 |
msgid "Scheduled preloading of cache in %d minutes"
|
586 |
msgstr ""
|
587 |
|
588 |
-
#: wp-cache.php:
|
589 |
msgid ""
|
590 |
"This will cache every published post and page on your site. It will create "
|
591 |
"supercache static files so unknown visitors (including bots) will hit a "
|
@@ -593,298 +593,298 @@ msgid ""
|
|
593 |
"speed as a metric when judging websites now."
|
594 |
msgstr ""
|
595 |
|
596 |
-
#: wp-cache.php:
|
597 |
msgid ""
|
598 |
"Preloading creates lots of files however. Caching is done from the newest "
|
599 |
"post to the oldest so please consider only caching the newest if you have "
|
600 |
"lots (10,000+) of posts. This is especially important on shared hosting."
|
601 |
msgstr ""
|
602 |
|
603 |
-
#: wp-cache.php:
|
604 |
msgid ""
|
605 |
"In ’Preload Mode’ regular garbage collection will only clean out "
|
606 |
"old legacy files for known users, not the preloaded supercache files. This "
|
607 |
"is a recommended setting when the cache is preloaded."
|
608 |
msgstr ""
|
609 |
|
610 |
-
#: wp-cache.php:
|
611 |
msgid ""
|
612 |
"Refresh preloaded cache files every %s minutes. (0 to disable, minimum %d "
|
613 |
"minutes.)"
|
614 |
msgstr ""
|
615 |
|
616 |
-
#: wp-cache.php:
|
617 |
msgid "all"
|
618 |
msgstr ""
|
619 |
|
620 |
-
#: wp-cache.php:
|
621 |
msgid "Preload %s posts."
|
622 |
msgstr ""
|
623 |
|
624 |
-
#: wp-cache.php:
|
625 |
msgid ""
|
626 |
"Preload mode (garbage collection only on legacy cache files. Recommended.)"
|
627 |
msgstr ""
|
628 |
|
629 |
-
#: wp-cache.php:
|
630 |
msgid "Preload tags, categories and other taxonomies."
|
631 |
msgstr ""
|
632 |
|
633 |
-
#: wp-cache.php:
|
634 |
msgid "Send me status emails when files are refreshed."
|
635 |
msgstr ""
|
636 |
|
637 |
-
#: wp-cache.php:
|
638 |
msgid "Many emails, 2 emails per 100 posts."
|
639 |
msgstr ""
|
640 |
|
641 |
-
#: wp-cache.php:
|
642 |
msgid "Medium, 1 email per 100 posts."
|
643 |
msgstr ""
|
644 |
|
645 |
-
#: wp-cache.php:
|
646 |
msgid "Less emails, 1 at the start and 1 at the end of preloading all posts."
|
647 |
msgstr ""
|
648 |
|
649 |
-
#: wp-cache.php:
|
650 |
msgid "Refresh of cache in %d hours %d minutes and %d seconds."
|
651 |
msgstr ""
|
652 |
|
653 |
-
#: wp-cache.php:
|
654 |
msgid "Full refresh of cache in %d hours %d minutes and %d seconds."
|
655 |
msgstr ""
|
656 |
|
657 |
-
#: wp-cache.php:
|
658 |
msgid "Currently caching from post %d to %d."
|
659 |
msgstr ""
|
660 |
|
661 |
-
#: wp-cache.php:
|
662 |
msgid "<strong>Page last cached:</strong> %s"
|
663 |
msgstr ""
|
664 |
|
665 |
-
#: wp-cache.php:
|
666 |
msgid "Update Settings"
|
667 |
msgstr ""
|
668 |
|
669 |
-
#: wp-cache.php:
|
670 |
msgid ""
|
671 |
"Preloading of cache disabled. Please disable legacy page caching or talk to "
|
672 |
"your host administrator."
|
673 |
msgstr ""
|
674 |
|
675 |
-
#: wp-cache.php:
|
676 |
msgid "Caching"
|
677 |
msgstr ""
|
678 |
|
679 |
-
#: wp-cache.php:
|
680 |
msgid "Caching On"
|
681 |
msgstr ""
|
682 |
|
683 |
-
#: wp-cache.php:
|
684 |
-
#: wp-cache.php:
|
685 |
msgid "Recommended"
|
686 |
msgstr ""
|
687 |
|
688 |
-
#: wp-cache.php:
|
689 |
msgid "Caching Off"
|
690 |
msgstr ""
|
691 |
|
692 |
-
#: wp-cache.php:
|
693 |
msgid "Use mod_rewrite to serve cache files."
|
694 |
msgstr ""
|
695 |
|
696 |
-
#: wp-cache.php:
|
697 |
msgid "Use PHP to serve cache files."
|
698 |
msgstr ""
|
699 |
|
700 |
-
#: wp-cache.php:
|
701 |
msgid "Legacy page caching."
|
702 |
msgstr ""
|
703 |
|
704 |
-
#: wp-cache.php:
|
705 |
msgid ""
|
706 |
"Mod_rewrite is fastest, PHP is almost as fast and easier to get working, "
|
707 |
"while legacy caching is slower again, but more flexible and also easy to get "
|
708 |
"working. New users should use PHP caching."
|
709 |
msgstr ""
|
710 |
|
711 |
-
#: wp-cache.php:
|
712 |
msgid "Miscellaneous"
|
713 |
msgstr ""
|
714 |
|
715 |
-
#: wp-cache.php:
|
716 |
msgid "Warning! Compression is disabled as gzencode() function was not found."
|
717 |
msgstr ""
|
718 |
|
719 |
-
#: wp-cache.php:
|
720 |
msgid "Compress pages so they’re served more quickly to visitors."
|
721 |
msgstr ""
|
722 |
|
723 |
-
#: wp-cache.php:
|
724 |
msgid ""
|
725 |
"Compression is disabled by default because some hosts have problems with "
|
726 |
"compressed files. Switching it on and off clears the cache."
|
727 |
msgstr ""
|
728 |
|
729 |
-
#: wp-cache.php:
|
730 |
msgid ""
|
731 |
"Don’t cache pages for <acronym title=\"Logged in users and those that "
|
732 |
"comment\">known users</acronym>."
|
733 |
msgstr ""
|
734 |
|
735 |
-
#: wp-cache.php:
|
736 |
msgid ""
|
737 |
"Cache rebuild. Serve a supercache file to anonymous users while a new file "
|
738 |
"is being generated."
|
739 |
msgstr ""
|
740 |
|
741 |
-
#: wp-cache.php:
|
742 |
msgid ""
|
743 |
"304 Not Modified browser caching. Indicate when a page has not been modified "
|
744 |
"since it was last requested."
|
745 |
msgstr ""
|
746 |
|
747 |
-
#: wp-cache.php:
|
748 |
msgid ""
|
749 |
"Warning! 304 browser caching is only supported when mod_rewrite caching is "
|
750 |
"not used."
|
751 |
msgstr ""
|
752 |
|
753 |
-
#: wp-cache.php:
|
754 |
msgid ""
|
755 |
"304 support is disabled by default because some hosts have had problems with "
|
756 |
"the headers used in the past."
|
757 |
msgstr ""
|
758 |
|
759 |
-
#: wp-cache.php:
|
760 |
msgid "Don’t cache pages with GET parameters. (?x=y at the end of a url)"
|
761 |
msgstr ""
|
762 |
|
763 |
-
#: wp-cache.php:
|
764 |
msgid ""
|
765 |
"Make known users anonymous so they’re served supercached static files."
|
766 |
msgstr ""
|
767 |
|
768 |
-
#: wp-cache.php:
|
769 |
msgid ""
|
770 |
"Proudly tell the world your server is <a href=\"%s\">Stephen Fry proof</a>! "
|
771 |
"(places a message in your blog’s footer)"
|
772 |
msgstr ""
|
773 |
|
774 |
-
#: wp-cache.php:
|
775 |
msgid "Advanced"
|
776 |
msgstr ""
|
777 |
|
778 |
-
#: wp-cache.php:
|
779 |
msgid ""
|
780 |
"Enable dynamic caching. Requires PHP or legacy caching. (See <a href="
|
781 |
"\"http://wordpress.org/plugins/wp-super-cache/faq/\">FAQ</a> or wp-super-"
|
782 |
"cache/plugins/dynamic-cache-test.php for example code.)"
|
783 |
msgstr ""
|
784 |
|
785 |
-
#: wp-cache.php:
|
786 |
msgid ""
|
787 |
"Mobile device support. (External plugin or theme required. See the <a href="
|
788 |
"\"http://wordpress.org/plugins/wp-super-cache/faq/\">FAQ</a> for further "
|
789 |
"details.)"
|
790 |
msgstr ""
|
791 |
|
792 |
-
#: wp-cache.php:
|
793 |
msgid "Mobile Browsers"
|
794 |
msgstr ""
|
795 |
|
796 |
-
#: wp-cache.php:
|
797 |
msgid "Mobile Prefixes"
|
798 |
msgstr ""
|
799 |
|
800 |
-
#: wp-cache.php:
|
801 |
msgid ""
|
802 |
"Remove UTF8/blog charset support from .htaccess file. Only necessary if you "
|
803 |
"see odd characters or punctuation looks incorrect. Requires rewrite rules "
|
804 |
"update."
|
805 |
msgstr ""
|
806 |
|
807 |
-
#: wp-cache.php:
|
808 |
msgid "Clear all cache files when a post or page is published or updated."
|
809 |
msgstr ""
|
810 |
|
811 |
-
#: wp-cache.php:
|
812 |
msgid "Extra homepage checks. (Very occasionally stops homepage caching)"
|
813 |
msgstr ""
|
814 |
|
815 |
-
#: wp-cache.php:
|
816 |
msgid "Only refresh current page when comments made."
|
817 |
msgstr ""
|
818 |
|
819 |
-
#: wp-cache.php:
|
820 |
msgid "List the newest cached pages on this page."
|
821 |
msgstr ""
|
822 |
|
823 |
-
#: wp-cache.php:
|
824 |
msgid ""
|
825 |
"Coarse file locking. You do not need this as it will slow down your website."
|
826 |
msgstr ""
|
827 |
|
828 |
-
#: wp-cache.php:
|
829 |
msgid ""
|
830 |
"Late init. Display cached files after WordPress has loaded. Most useful in "
|
831 |
"legacy mode."
|
832 |
msgstr ""
|
833 |
|
834 |
-
#: wp-cache.php:
|
835 |
msgid "Use object cache to store cached files."
|
836 |
msgstr ""
|
837 |
|
838 |
-
#: wp-cache.php:
|
839 |
msgid "(Experimental)"
|
840 |
msgstr ""
|
841 |
|
842 |
-
#: wp-cache.php:
|
843 |
msgid "<strong>DO NOT CACHE PAGE</strong> secret key: <a href=\"%s\">%s</a>"
|
844 |
msgstr ""
|
845 |
|
846 |
-
#: wp-cache.php:
|
847 |
msgid "Cache Location"
|
848 |
msgstr ""
|
849 |
|
850 |
-
#: wp-cache.php:
|
851 |
msgid ""
|
852 |
"Change the location of your cache files. The default is WP_CONTENT_DIR . /"
|
853 |
"cache/ which translates to %s."
|
854 |
msgstr ""
|
855 |
|
856 |
-
#: wp-cache.php:
|
857 |
msgid "You must give the full path to the directory."
|
858 |
msgstr ""
|
859 |
|
860 |
-
#: wp-cache.php:
|
861 |
msgid ""
|
862 |
"If the directory does not exist, it will be created. Please make sure your "
|
863 |
"web server user has write access to the parent directory. The parent "
|
864 |
"directory must exist."
|
865 |
msgstr ""
|
866 |
|
867 |
-
#: wp-cache.php:
|
868 |
msgid ""
|
869 |
"If the new cache directory does not exist, it will be created and the "
|
870 |
"contents of the old cache directory will be moved there. Otherwise, the old "
|
871 |
"cache directory will be left where it is."
|
872 |
msgstr ""
|
873 |
|
874 |
-
#: wp-cache.php:
|
875 |
msgid ""
|
876 |
"Submit a blank entry to set it to the default directory, WP_CONTENT_DIR . /"
|
877 |
"cache/."
|
878 |
msgstr ""
|
879 |
|
880 |
-
#: wp-cache.php:
|
881 |
msgid ""
|
882 |
"The plugin detected a bare directory index in your cache directory, which "
|
883 |
"would let visitors see your cache files directly and might expose private "
|
884 |
"posts."
|
885 |
msgstr ""
|
886 |
|
887 |
-
#: wp-cache.php:
|
888 |
msgid ""
|
889 |
"You are using mod_rewrite to serve cache files so the plugin has added "
|
890 |
"<q>Options -Indexes</q> to the .htaccess file in the cache directory to "
|
@@ -893,32 +893,32 @@ msgid ""
|
|
893 |
"mode and move the cache outside of the web root."
|
894 |
msgstr ""
|
895 |
|
896 |
-
#: wp-cache.php:
|
897 |
msgid ""
|
898 |
"index.html files have been added in key directories, but unless directory "
|
899 |
"indexes are disabled, it is probably better to store the cache files outside "
|
900 |
"of the web root of %s"
|
901 |
msgstr ""
|
902 |
|
903 |
-
#: wp-cache.php:
|
904 |
msgid ""
|
905 |
"Since you are using mod_rewrite to serve cache files, you must choose a "
|
906 |
"directory in your web root which is <q>%s</q> and update the mod_rewrite "
|
907 |
"rules in the .htaccess file."
|
908 |
msgstr ""
|
909 |
|
910 |
-
#: wp-cache.php:
|
911 |
msgid "Note:"
|
912 |
msgstr ""
|
913 |
|
914 |
-
#: wp-cache.php:
|
915 |
msgid ""
|
916 |
"Uninstall this plugin on the plugins page. It will automatically clean up "
|
917 |
"after itself. If manual intervention is required, then simple instructions "
|
918 |
"are provided."
|
919 |
msgstr ""
|
920 |
|
921 |
-
#: wp-cache.php:
|
922 |
msgid ""
|
923 |
"If uninstalling this plugin, make sure the directory <em>%s</em> is "
|
924 |
"writeable by the webserver so the files <em>advanced-cache.php</em> and "
|
@@ -926,14 +926,14 @@ msgid ""
|
|
926 |
"files are writeable is probably a good idea!)"
|
927 |
msgstr ""
|
928 |
|
929 |
-
#: wp-cache.php:
|
930 |
msgid ""
|
931 |
"Please see the <a href=\"%1$s/wp-super-cache/readme.txt\">readme.txt</a> for "
|
932 |
"instructions on uninstalling this script. Look for the heading, \"How to "
|
933 |
"uninstall WP Super Cache\"."
|
934 |
msgstr ""
|
935 |
|
936 |
-
#: wp-cache.php:
|
937 |
msgid ""
|
938 |
"Need help? Check the <a href=\"%1$s\">Super Cache readme file</a>. It "
|
939 |
"includes installation documentation, a FAQ and Troubleshooting tips. The <a "
|
@@ -941,15 +941,15 @@ msgid ""
|
|
941 |
"have been answered."
|
942 |
msgstr ""
|
943 |
|
944 |
-
#: wp-cache.php:
|
945 |
msgid "Update Status"
|
946 |
msgstr ""
|
947 |
|
948 |
-
#: wp-cache.php:
|
949 |
msgid "Accepted Filenames & Rejected URIs"
|
950 |
msgstr ""
|
951 |
|
952 |
-
#: wp-cache.php:
|
953 |
msgid ""
|
954 |
"Notice: PHP caching enabled but Supercache mod_rewrite rules detected. "
|
955 |
"Cached files will be served using those rules. If your site is working ok, "
|
@@ -957,119 +957,119 @@ msgid ""
|
|
957 |
"the root of your install and remove the SuperCache rules."
|
958 |
msgstr ""
|
959 |
|
960 |
-
#: wp-cache.php:
|
961 |
msgid "Cache Tester"
|
962 |
msgstr ""
|
963 |
|
964 |
-
#: wp-cache.php:
|
965 |
msgid "Test your cached website by clicking the test button below."
|
966 |
msgstr ""
|
967 |
|
968 |
-
#: wp-cache.php:
|
969 |
msgid "Fetching %s to prime cache: "
|
970 |
msgstr ""
|
971 |
|
972 |
-
#: wp-cache.php:
|
973 |
msgid "OK"
|
974 |
msgstr ""
|
975 |
|
976 |
-
#: wp-cache.php:
|
977 |
msgid "Fetching first copy of %s: "
|
978 |
msgstr ""
|
979 |
|
980 |
-
#: wp-cache.php:
|
981 |
msgid "FAILED"
|
982 |
msgstr ""
|
983 |
|
984 |
-
#: wp-cache.php:
|
985 |
msgid "Fetching second copy of %s: "
|
986 |
msgstr ""
|
987 |
|
988 |
-
#: wp-cache.php:
|
989 |
msgid "One or more page requests failed:"
|
990 |
msgstr ""
|
991 |
|
992 |
-
#: wp-cache.php:
|
993 |
msgid "Page %d: %d (%s)"
|
994 |
msgstr ""
|
995 |
|
996 |
-
#: wp-cache.php:
|
997 |
msgid "Page 1: %s"
|
998 |
msgstr ""
|
999 |
|
1000 |
-
#: wp-cache.php:
|
1001 |
msgid "Page 2: %s"
|
1002 |
msgstr ""
|
1003 |
|
1004 |
-
#: wp-cache.php:
|
1005 |
msgid "The timestamps on both pages match!"
|
1006 |
msgstr ""
|
1007 |
|
1008 |
-
#: wp-cache.php:
|
1009 |
msgid "The pages do not match! Timestamps differ or were not found!"
|
1010 |
msgstr ""
|
1011 |
|
1012 |
-
#: wp-cache.php:
|
1013 |
msgid "Things you can do:"
|
1014 |
msgstr ""
|
1015 |
|
1016 |
-
#: wp-cache.php:
|
1017 |
msgid ""
|
1018 |
"Load your homepage in a logged out browser, check the timestamp at the end "
|
1019 |
"of the html source. Load the page again and compare the timestamp. Caching "
|
1020 |
"is working if the timestamps match."
|
1021 |
msgstr ""
|
1022 |
|
1023 |
-
#: wp-cache.php:
|
1024 |
msgid ""
|
1025 |
"Enable logging on the Debug page here. That should help you track down the "
|
1026 |
"problem."
|
1027 |
msgstr ""
|
1028 |
|
1029 |
-
#: wp-cache.php:
|
1030 |
msgid ""
|
1031 |
"You should check Page 1 and Page 2 above for errors. Your local server "
|
1032 |
"configuration may not allow your website to access itself."
|
1033 |
msgstr ""
|
1034 |
|
1035 |
-
#: wp-cache.php:
|
1036 |
msgid "Send non-secure (non https) request for homepage"
|
1037 |
msgstr ""
|
1038 |
|
1039 |
-
#: wp-cache.php:
|
1040 |
msgid "Test Cache"
|
1041 |
msgstr ""
|
1042 |
|
1043 |
-
#: wp-cache.php:
|
1044 |
msgid "Delete Cached Pages"
|
1045 |
msgstr ""
|
1046 |
|
1047 |
-
#: wp-cache.php:
|
1048 |
msgid ""
|
1049 |
"Cached pages are stored on your server as html and PHP files. If you need to "
|
1050 |
"delete them, use the button below."
|
1051 |
msgstr ""
|
1052 |
|
1053 |
-
#: wp-cache.php:
|
1054 |
-
#: wp-cache.php:
|
1055 |
msgid "Delete Cache"
|
1056 |
msgstr ""
|
1057 |
|
1058 |
-
#: wp-cache.php:
|
1059 |
msgid "Delete Cache On All Blogs"
|
1060 |
msgstr ""
|
1061 |
|
1062 |
-
#: wp-cache.php:
|
1063 |
msgid "Recommended Links and Plugins"
|
1064 |
msgstr ""
|
1065 |
|
1066 |
-
#: wp-cache.php:
|
1067 |
msgid ""
|
1068 |
"Caching is only one part of making a website faster. Here are some other "
|
1069 |
"plugins that will help:"
|
1070 |
msgstr ""
|
1071 |
|
1072 |
-
#: wp-cache.php:
|
1073 |
msgid ""
|
1074 |
"<a href=\"%s\">Yahoo! Yslow</a> is an extension for the Firefox add-on "
|
1075 |
"Firebug. It analyzes web pages and suggests ways to improve their "
|
@@ -1077,92 +1077,92 @@ msgid ""
|
|
1077 |
"the performance tools online at <a href=\"%s\">GTMetrix</a>."
|
1078 |
msgstr ""
|
1079 |
|
1080 |
-
#: wp-cache.php:
|
1081 |
msgid ""
|
1082 |
"<a href=\"%s\">Use Google Libraries</a> allows you to load some commonly "
|
1083 |
"used Javascript libraries from Google webservers. Ironically, it may reduce "
|
1084 |
"your Yslow score."
|
1085 |
msgstr ""
|
1086 |
|
1087 |
-
#: wp-cache.php:
|
1088 |
msgid ""
|
1089 |
"<strong>Advanced users only:</strong> Install an object cache. Choose from "
|
1090 |
"<a href=\"%s\">Memcached</a>, <a href=\"%s\">XCache</a>, <a href=\"%s"
|
1091 |
"\">eAcccelerator</a> and others."
|
1092 |
msgstr ""
|
1093 |
|
1094 |
-
#: wp-cache.php:
|
1095 |
msgid ""
|
1096 |
"<a href=\"%s\">Cron View</a> is a useful plugin to use when trying to debug "
|
1097 |
"garbage collection and preload problems."
|
1098 |
msgstr ""
|
1099 |
|
1100 |
-
#: wp-cache.php:
|
1101 |
msgid "Need Help?"
|
1102 |
msgstr ""
|
1103 |
|
1104 |
-
#: wp-cache.php:
|
1105 |
msgid ""
|
1106 |
"Use the debug system in the Debug tab above. It will tell you what the "
|
1107 |
"plugin is doing."
|
1108 |
msgstr ""
|
1109 |
|
1110 |
-
#: wp-cache.php:
|
1111 |
msgid "<a href=\"%1$s\">Installation Help</a>"
|
1112 |
msgstr ""
|
1113 |
|
1114 |
-
#: wp-cache.php:
|
1115 |
msgid "<a href=\"%1$s\">Frequently Asked Questions</a>"
|
1116 |
msgstr ""
|
1117 |
|
1118 |
-
#: wp-cache.php:
|
1119 |
msgid "<a href=\"%1$s\">Support Forum</a>"
|
1120 |
msgstr ""
|
1121 |
|
1122 |
-
#: wp-cache.php:
|
1123 |
msgid "<a href=\"%1$s\">Development Version</a>"
|
1124 |
msgstr ""
|
1125 |
|
1126 |
-
#: wp-cache.php:
|
1127 |
msgid "Rate This Plugin!"
|
1128 |
msgstr ""
|
1129 |
|
1130 |
-
#: wp-cache.php:
|
1131 |
msgid ""
|
1132 |
"Please <a href=\"%s\">rate</a> this plugin and tell me if it works for you "
|
1133 |
"or not. It really helps development."
|
1134 |
msgstr ""
|
1135 |
|
1136 |
-
#: wp-cache.php:
|
1137 |
msgid "Cached pages since %1$s : <strong>%2$s</strong>"
|
1138 |
msgstr ""
|
1139 |
|
1140 |
-
#: wp-cache.php:
|
1141 |
msgid "Newest Cached Pages:"
|
1142 |
msgstr ""
|
1143 |
|
1144 |
-
#: wp-cache.php:
|
1145 |
msgid "Cached %s seconds ago"
|
1146 |
msgstr ""
|
1147 |
|
1148 |
-
#: wp-cache.php:
|
1149 |
msgid "(may not always be accurate on busy sites)"
|
1150 |
msgstr ""
|
1151 |
|
1152 |
-
#: wp-cache.php:
|
1153 |
msgid ""
|
1154 |
"Cache plugins are PHP scripts that live in a plugins folder inside the wp-"
|
1155 |
"super-cache folder. They are loaded when Supercache loads, much sooner than "
|
1156 |
"regular WordPress plugins."
|
1157 |
msgstr ""
|
1158 |
|
1159 |
-
#: wp-cache.php:
|
1160 |
msgid ""
|
1161 |
"This is strictly an advanced feature only and knowledge of both PHP and "
|
1162 |
"WordPress actions is required to create them."
|
1163 |
msgstr ""
|
1164 |
|
1165 |
-
#: wp-cache.php:
|
1166 |
msgid ""
|
1167 |
"<strong>Warning</strong>! Due to the way WordPress upgrades plugins, the "
|
1168 |
"plugins you upload to wp-super-cache/plugins/ will be deleted when you "
|
@@ -1173,75 +1173,75 @@ msgid ""
|
|
1173 |
"\">developer documentation</a>."
|
1174 |
msgstr ""
|
1175 |
|
1176 |
-
#: wp-cache.php:
|
1177 |
msgid "Available Plugins"
|
1178 |
msgstr ""
|
1179 |
|
1180 |
-
#: wp-cache.php:
|
1181 |
msgid "Easy"
|
1182 |
msgstr ""
|
1183 |
|
1184 |
-
#: wp-cache.php:
|
1185 |
msgid "CDN"
|
1186 |
msgstr ""
|
1187 |
|
1188 |
-
#: wp-cache.php:
|
1189 |
msgid "Contents"
|
1190 |
msgstr ""
|
1191 |
|
1192 |
-
#: wp-cache.php:
|
1193 |
msgid "Preload"
|
1194 |
msgstr ""
|
1195 |
|
1196 |
-
#: wp-cache.php:
|
1197 |
msgid "Plugins"
|
1198 |
msgstr ""
|
1199 |
|
1200 |
-
#: wp-cache.php:
|
1201 |
msgid "Debug"
|
1202 |
msgstr ""
|
1203 |
|
1204 |
-
#: wp-cache.php:
|
1205 |
msgid ""
|
1206 |
"Notice: WP Super Cache mod_rewrite rule checks disabled unless running on <a "
|
1207 |
"href=\"%s\">the main site</a> of this network."
|
1208 |
msgstr ""
|
1209 |
|
1210 |
-
#: wp-cache.php:
|
1211 |
msgid "Mod Rewrite Rules"
|
1212 |
msgstr ""
|
1213 |
|
1214 |
-
#: wp-cache.php:
|
1215 |
msgid "WordPress MU Detected"
|
1216 |
msgstr ""
|
1217 |
|
1218 |
-
#: wp-cache.php:
|
1219 |
msgid ""
|
1220 |
"Unfortunately, the rewrite rules cannot be updated automatically when "
|
1221 |
"running WordPress MU. Please open your .htaccess and add the following "
|
1222 |
"mod_rewrite rules above any other rules in that file."
|
1223 |
msgstr ""
|
1224 |
|
1225 |
-
#: wp-cache.php:
|
1226 |
msgid "Mod Rewrite rules cannot be updated!"
|
1227 |
msgstr ""
|
1228 |
|
1229 |
-
#: wp-cache.php:
|
1230 |
msgid ""
|
1231 |
"You must have <strong>BEGIN</strong> and <strong>END</strong> markers in %s."
|
1232 |
"htaccess for the auto update to work. They look like this and surround the "
|
1233 |
"main WordPress mod_rewrite rules:"
|
1234 |
msgstr ""
|
1235 |
|
1236 |
-
#: wp-cache.php:
|
1237 |
msgid "Refresh this page when you have updated your .htaccess file."
|
1238 |
msgstr ""
|
1239 |
|
1240 |
-
#: wp-cache.php:
|
1241 |
msgid "Thank you for upgrading."
|
1242 |
msgstr ""
|
1243 |
|
1244 |
-
#: wp-cache.php:
|
1245 |
msgid ""
|
1246 |
"The mod_rewrite rules changed since you last installed this plugin. "
|
1247 |
"Unfortunately, you must remove the old supercache rules before the new ones "
|
@@ -1253,11 +1253,11 @@ msgid ""
|
|
1253 |
"brave enough to use them."
|
1254 |
msgstr ""
|
1255 |
|
1256 |
-
#: wp-cache.php:
|
1257 |
msgid "Trailing slash check required."
|
1258 |
msgstr ""
|
1259 |
|
1260 |
-
#: wp-cache.php:
|
1261 |
msgid ""
|
1262 |
"It looks like your blog has URLs that end with a \"/\". Unfortunately since "
|
1263 |
"you installed this plugin a duplicate content bug has been found where URLs "
|
@@ -1266,41 +1266,41 @@ msgid ""
|
|
1266 |
"and add these two rules to the two groups of Super Cache rules:"
|
1267 |
msgstr ""
|
1268 |
|
1269 |
-
#: wp-cache.php:
|
1270 |
msgid ""
|
1271 |
"You can see where the rules go and examine the complete rules by clicking "
|
1272 |
"the \"View mod_rewrite rules\" link below."
|
1273 |
msgstr ""
|
1274 |
|
1275 |
-
#: wp-cache.php:
|
1276 |
msgid "Mod Rewrite rules updated!"
|
1277 |
msgstr ""
|
1278 |
|
1279 |
-
#: wp-cache.php:
|
1280 |
msgid ""
|
1281 |
"%s.htaccess has been updated with the necessary mod_rewrite rules. Please "
|
1282 |
"verify they are correct. They should look like this:"
|
1283 |
msgstr ""
|
1284 |
|
1285 |
-
#: wp-cache.php:
|
1286 |
msgid "Mod Rewrite rules must be updated!"
|
1287 |
msgstr ""
|
1288 |
|
1289 |
-
#: wp-cache.php:
|
1290 |
msgid ""
|
1291 |
"Your %s.htaccess is not writable by the webserver and must be updated with "
|
1292 |
"the necessary mod_rewrite rules. The new rules go above the regular "
|
1293 |
"WordPress rules as shown in the code below:"
|
1294 |
msgstr ""
|
1295 |
|
1296 |
-
#: wp-cache.php:
|
1297 |
msgid ""
|
1298 |
"WP Super Cache mod rewrite rules were detected in your %s.htaccess file.<br /"
|
1299 |
"> Click the following link to see the lines added to that file. If you have "
|
1300 |
"upgraded the plugin, make sure these rules match."
|
1301 |
msgstr ""
|
1302 |
|
1303 |
-
#: wp-cache.php:
|
1304 |
msgid ""
|
1305 |
"A difference between the rules in your .htaccess file and the plugin rewrite "
|
1306 |
"rules has been found. This could be simple whitespace differences, but you "
|
@@ -1308,247 +1308,247 @@ msgid ""
|
|
1308 |
"Click the ’Update Mod_Rewrite Rules’ button to update the rules."
|
1309 |
msgstr ""
|
1310 |
|
1311 |
-
#: wp-cache.php:
|
1312 |
msgid "View Mod_Rewrite Rules"
|
1313 |
msgstr ""
|
1314 |
|
1315 |
-
#: wp-cache.php:
|
1316 |
msgid "Rules must be added to %s too:"
|
1317 |
msgstr ""
|
1318 |
|
1319 |
-
#: wp-cache.php:
|
1320 |
msgid "Gzip encoding rules in %s.htaccess created."
|
1321 |
msgstr ""
|
1322 |
|
1323 |
-
#: wp-cache.php:
|
1324 |
msgid "Fix Configuration"
|
1325 |
msgstr ""
|
1326 |
|
1327 |
-
#: wp-cache.php:
|
1328 |
msgid "Restore Default Configuration"
|
1329 |
msgstr ""
|
1330 |
|
1331 |
-
#: wp-cache.php:
|
1332 |
msgid ""
|
1333 |
"Comment moderation is enabled. Your comment may take some time to appear."
|
1334 |
msgstr ""
|
1335 |
|
1336 |
-
#: wp-cache.php:
|
1337 |
msgid "Lock Down:"
|
1338 |
msgstr ""
|
1339 |
|
1340 |
-
#: wp-cache.php:
|
1341 |
msgid ""
|
1342 |
"Prepare your server for an expected spike in traffic by enabling the lock "
|
1343 |
"down. When this is enabled, new comments on a post will not refresh the "
|
1344 |
"cached static files."
|
1345 |
msgstr ""
|
1346 |
|
1347 |
-
#: wp-cache.php:
|
1348 |
msgid ""
|
1349 |
"Developers: Make your plugin lock down compatible by checking the "
|
1350 |
"\"WPLOCKDOWN\" constant. The following code will make sure your plugin "
|
1351 |
"respects the WPLOCKDOWN setting."
|
1352 |
msgstr ""
|
1353 |
|
1354 |
-
#: wp-cache.php:
|
1355 |
msgid "Sorry. My blog is locked down. Updates will appear shortly"
|
1356 |
msgstr ""
|
1357 |
|
1358 |
-
#: wp-cache.php:
|
1359 |
msgid ""
|
1360 |
"WordPress is locked down. Super Cache static files will not be deleted when "
|
1361 |
"new comments are made."
|
1362 |
msgstr ""
|
1363 |
|
1364 |
-
#: wp-cache.php:
|
1365 |
msgid ""
|
1366 |
"WordPress is not locked down. New comments will refresh Super Cache static "
|
1367 |
"files as normal."
|
1368 |
msgstr ""
|
1369 |
|
1370 |
-
#: wp-cache.php:
|
1371 |
msgid "Lock Down"
|
1372 |
msgstr ""
|
1373 |
|
1374 |
-
#: wp-cache.php:
|
1375 |
msgid "Directly Cached Files"
|
1376 |
msgstr ""
|
1377 |
|
1378 |
-
#: wp-cache.php:
|
1379 |
msgid "Cannot delete directory"
|
1380 |
msgstr ""
|
1381 |
|
1382 |
-
#: wp-cache.php:
|
1383 |
msgid "%s removed!"
|
1384 |
msgstr ""
|
1385 |
|
1386 |
-
#: wp-cache.php:
|
1387 |
msgid ""
|
1388 |
"You must make %s writable to enable this feature. As this is a security "
|
1389 |
"risk, please make it read-only after your page is generated."
|
1390 |
msgstr ""
|
1391 |
|
1392 |
-
#: wp-cache.php:
|
1393 |
msgid ""
|
1394 |
"%s is writable. Please make it readonly after your page is generated as this "
|
1395 |
"is a security risk."
|
1396 |
msgstr ""
|
1397 |
|
1398 |
-
#: wp-cache.php:
|
1399 |
msgid "Existing direct page"
|
1400 |
msgstr ""
|
1401 |
|
1402 |
-
#: wp-cache.php:
|
1403 |
msgid "Delete cached file"
|
1404 |
msgstr ""
|
1405 |
|
1406 |
-
#: wp-cache.php:
|
1407 |
msgid "Add direct page:"
|
1408 |
msgstr ""
|
1409 |
|
1410 |
-
#: wp-cache.php:
|
1411 |
msgid ""
|
1412 |
"Directly cached files are files created directly off %s where your blog "
|
1413 |
"lives. This feature is only useful if you are expecting a major Digg or "
|
1414 |
"Slashdot level of traffic to one post or page."
|
1415 |
msgstr ""
|
1416 |
|
1417 |
-
#: wp-cache.php:
|
1418 |
msgid ""
|
1419 |
"For example: to cache <em>%1$sabout/</em>, you would enter %1$sabout/ or /"
|
1420 |
"about/. The cached file will be generated the next time an anonymous user "
|
1421 |
"visits that page."
|
1422 |
msgstr ""
|
1423 |
|
1424 |
-
#: wp-cache.php:
|
1425 |
msgid ""
|
1426 |
"Make the textbox blank to remove it from the list of direct pages and delete "
|
1427 |
"the cached file."
|
1428 |
msgstr ""
|
1429 |
|
1430 |
-
#: wp-cache.php:
|
1431 |
msgid "Update Direct Pages"
|
1432 |
msgstr ""
|
1433 |
|
1434 |
-
#: wp-cache.php:
|
1435 |
msgctxt "timezone date format"
|
1436 |
msgid "Y-m-d G:i:s"
|
1437 |
msgstr ""
|
1438 |
|
1439 |
-
#: wp-cache.php:
|
1440 |
msgid "Expiry Time & Garbage Collection"
|
1441 |
msgstr ""
|
1442 |
|
1443 |
-
#: wp-cache.php:
|
1444 |
msgid ""
|
1445 |
"<abbr title=\"Coordinated Universal Time\">UTC</abbr> time is <code>%s</code>"
|
1446 |
msgstr ""
|
1447 |
|
1448 |
-
#: wp-cache.php:
|
1449 |
msgid "Local time is <code>%1$s</code>"
|
1450 |
msgstr ""
|
1451 |
|
1452 |
-
#: wp-cache.php:
|
1453 |
msgid "Next scheduled garbage collection will be at <strong>%s UTC</strong>"
|
1454 |
msgstr ""
|
1455 |
|
1456 |
-
#: wp-cache.php:
|
1457 |
msgid ""
|
1458 |
"Warning! <strong>PRELOAD MODE</strong> activated. Supercache files will not "
|
1459 |
"be deleted regardless of age."
|
1460 |
msgstr ""
|
1461 |
|
1462 |
-
#: wp-cache.php:
|
1463 |
msgid "Cache Timeout"
|
1464 |
msgstr ""
|
1465 |
|
1466 |
-
#: wp-cache.php:
|
1467 |
msgid "seconds"
|
1468 |
msgstr ""
|
1469 |
|
1470 |
-
#: wp-cache.php:
|
1471 |
msgid ""
|
1472 |
"How long should cached pages remain fresh? Set to 0 to disable garbage "
|
1473 |
"collection. A good starting point is 3600 seconds."
|
1474 |
msgstr ""
|
1475 |
|
1476 |
-
#: wp-cache.php:
|
1477 |
msgid "Scheduler"
|
1478 |
msgstr ""
|
1479 |
|
1480 |
-
#: wp-cache.php:
|
1481 |
msgid "Timer:"
|
1482 |
msgstr ""
|
1483 |
|
1484 |
-
#: wp-cache.php:
|
1485 |
msgid "Check for stale cached files every <em>interval</em> seconds."
|
1486 |
msgstr ""
|
1487 |
|
1488 |
-
#: wp-cache.php:
|
1489 |
msgid "Clock:"
|
1490 |
msgstr ""
|
1491 |
|
1492 |
-
#: wp-cache.php:
|
1493 |
msgid "HH:MM"
|
1494 |
msgstr ""
|
1495 |
|
1496 |
-
#: wp-cache.php:
|
1497 |
msgid ""
|
1498 |
"Check for stale cached files at this time <strong>(UTC)</strong> or starting "
|
1499 |
"at this time every <em>interval</em> below."
|
1500 |
msgstr ""
|
1501 |
|
1502 |
-
#: wp-cache.php:
|
1503 |
msgid "Interval:"
|
1504 |
msgstr ""
|
1505 |
|
1506 |
-
#: wp-cache.php:
|
1507 |
msgid "Notification Emails"
|
1508 |
msgstr ""
|
1509 |
|
1510 |
-
#: wp-cache.php:
|
1511 |
msgid "Email me when the garbage collection runs."
|
1512 |
msgstr ""
|
1513 |
|
1514 |
-
#: wp-cache.php:
|
1515 |
msgid "Garbage Collection"
|
1516 |
msgstr ""
|
1517 |
|
1518 |
-
#: wp-cache.php:
|
1519 |
msgid ""
|
1520 |
"<em>Garbage collection</em> is the simple act of throwing out your garbage. "
|
1521 |
"For this plugin that would be old or <em>stale</em> cached files that may be "
|
1522 |
"out of date. New cached files are described as <em>fresh</em>."
|
1523 |
msgstr ""
|
1524 |
|
1525 |
-
#: wp-cache.php:
|
1526 |
msgid ""
|
1527 |
"Cached files are fresh for a limited length of time. You can set that time "
|
1528 |
"in the <em>Cache Timeout</em> text box on this page."
|
1529 |
msgstr ""
|
1530 |
|
1531 |
-
#: wp-cache.php:
|
1532 |
msgid ""
|
1533 |
"Stale cached files are not removed as soon as they become stale. They have "
|
1534 |
"to be removed by the garbage collecter. That is why you have to tell the "
|
1535 |
"plugin when the garbage collector should run."
|
1536 |
msgstr ""
|
1537 |
|
1538 |
-
#: wp-cache.php:
|
1539 |
msgid ""
|
1540 |
"Use the <em>Timer</em> or <em>Clock</em> schedulers to define when the "
|
1541 |
"garbage collector should run."
|
1542 |
msgstr ""
|
1543 |
|
1544 |
-
#: wp-cache.php:
|
1545 |
msgid ""
|
1546 |
"The <em>Timer</em> scheduler tells the plugin to run the garbage collector "
|
1547 |
"at regular intervals. When one garbage collection is done, the next run is "
|
1548 |
"scheduled."
|
1549 |
msgstr ""
|
1550 |
|
1551 |
-
#: wp-cache.php:
|
1552 |
msgid ""
|
1553 |
"Or, the <em>Clock</em> scheduler allows the garbage collection to run at "
|
1554 |
"specific times. If set to run hourly or twice daily, the garbage collector "
|
@@ -1557,42 +1557,42 @@ msgid ""
|
|
1557 |
"the time specified."
|
1558 |
msgstr ""
|
1559 |
|
1560 |
-
#: wp-cache.php:
|
1561 |
msgid ""
|
1562 |
"There are no best garbage collection settings but here are a few scenarios. "
|
1563 |
"Garbage collection is separate to other actions that clear our cached files "
|
1564 |
"like leaving a comment or publishing a post."
|
1565 |
msgstr ""
|
1566 |
|
1567 |
-
#: wp-cache.php:
|
1568 |
msgid ""
|
1569 |
"Sites that want to serve lots of newly generated data should set the "
|
1570 |
"<em>Cache Timeout</em> to 60 and use the <em>Timer</em> scheduler set to 90 "
|
1571 |
"seconds."
|
1572 |
msgstr ""
|
1573 |
|
1574 |
-
#: wp-cache.php:
|
1575 |
msgid ""
|
1576 |
"Sites with widgets and rss feeds in their sidebar should probably use a "
|
1577 |
"timeout of 3600 seconds and set the timer to 600 seconds. Stale files will "
|
1578 |
"be caught within 10 minutes of going stale."
|
1579 |
msgstr ""
|
1580 |
|
1581 |
-
#: wp-cache.php:
|
1582 |
msgid ""
|
1583 |
"Sites with lots of static content, no widgets or rss feeds in their sidebar "
|
1584 |
"can use a timeout of 86400 seconds or even more and set the timer to "
|
1585 |
"something equally long."
|
1586 |
msgstr ""
|
1587 |
|
1588 |
-
#: wp-cache.php:
|
1589 |
msgid ""
|
1590 |
"Sites where an external data source updates at a particular time every day "
|
1591 |
"should set the timeout to 86400 seconds and use the Clock scheduler set "
|
1592 |
"appropriately."
|
1593 |
msgstr ""
|
1594 |
|
1595 |
-
#: wp-cache.php:
|
1596 |
msgid ""
|
1597 |
"Checking for and deleting expired files is expensive, but it’s "
|
1598 |
"expensive leaving them there too. On a very busy site, you should set the "
|
@@ -1603,81 +1603,81 @@ msgid ""
|
|
1603 |
"using mod_rewrite or PHP caching."
|
1604 |
msgstr ""
|
1605 |
|
1606 |
-
#: wp-cache.php:
|
1607 |
msgid "Set the expiry time to 0 seconds to disable garbage collection."
|
1608 |
msgstr ""
|
1609 |
|
1610 |
-
#: wp-cache.php:
|
1611 |
msgid "Change Expiration"
|
1612 |
msgstr ""
|
1613 |
|
1614 |
-
#: wp-cache.php:
|
1615 |
msgid "Rejected User Agents"
|
1616 |
msgstr ""
|
1617 |
|
1618 |
-
#: wp-cache.php:
|
1619 |
msgid ""
|
1620 |
"Strings in the HTTP ’User Agent’ header that prevent WP-Cache "
|
1621 |
"from caching bot, spiders, and crawlers’ requests. Note that super "
|
1622 |
"cached files are still sent to these agents if they already exists."
|
1623 |
msgstr ""
|
1624 |
|
1625 |
-
#: wp-cache.php:
|
1626 |
msgid "Save UA Strings"
|
1627 |
msgstr ""
|
1628 |
|
1629 |
-
#: wp-cache.php:
|
1630 |
msgid ""
|
1631 |
"Do not cache the following page types. See the <a href=\"http://codex."
|
1632 |
"wordpress.org/Conditional_Tags\">Conditional Tags</a> documentation for a "
|
1633 |
"complete discussion on each type."
|
1634 |
msgstr ""
|
1635 |
|
1636 |
-
#: wp-cache.php:
|
1637 |
msgid "Single Posts"
|
1638 |
msgstr ""
|
1639 |
|
1640 |
-
#: wp-cache.php:
|
1641 |
msgid "Pages"
|
1642 |
msgstr ""
|
1643 |
|
1644 |
-
#: wp-cache.php:
|
1645 |
msgid "Front Page"
|
1646 |
msgstr ""
|
1647 |
|
1648 |
-
#: wp-cache.php:
|
1649 |
msgid "Home"
|
1650 |
msgstr ""
|
1651 |
|
1652 |
-
#: wp-cache.php:
|
1653 |
msgid "Archives"
|
1654 |
msgstr ""
|
1655 |
|
1656 |
-
#: wp-cache.php:
|
1657 |
msgid "Tags"
|
1658 |
msgstr ""
|
1659 |
|
1660 |
-
#: wp-cache.php:
|
1661 |
msgid "Category"
|
1662 |
msgstr ""
|
1663 |
|
1664 |
-
#: wp-cache.php:
|
1665 |
msgid "Feeds"
|
1666 |
msgstr ""
|
1667 |
|
1668 |
-
#: wp-cache.php:
|
1669 |
msgid "Search Pages"
|
1670 |
msgstr ""
|
1671 |
|
1672 |
-
#: wp-cache.php:
|
1673 |
msgid "Author Pages"
|
1674 |
msgstr ""
|
1675 |
|
1676 |
-
#: wp-cache.php:
|
1677 |
msgid "Save"
|
1678 |
msgstr ""
|
1679 |
|
1680 |
-
#: wp-cache.php:
|
1681 |
msgid ""
|
1682 |
"Add here strings (not a filename) that forces a page not to be cached. For "
|
1683 |
"example, if your URLs include year and you dont want to cache last year "
|
@@ -1686,51 +1686,51 @@ msgid ""
|
|
1686 |
"cache that page."
|
1687 |
msgstr ""
|
1688 |
|
1689 |
-
#: wp-cache.php:
|
1690 |
msgid "Save Strings"
|
1691 |
msgstr ""
|
1692 |
|
1693 |
-
#: wp-cache.php:
|
1694 |
msgid ""
|
1695 |
"Add here those filenames that can be cached, even if they match one of the "
|
1696 |
"rejected substring specified above."
|
1697 |
msgstr ""
|
1698 |
|
1699 |
-
#: wp-cache.php:
|
1700 |
msgid "Save Files"
|
1701 |
msgstr ""
|
1702 |
|
1703 |
-
#: wp-cache.php:
|
1704 |
msgid "Currently logging to: %s"
|
1705 |
msgstr ""
|
1706 |
|
1707 |
-
#: wp-cache.php:
|
1708 |
msgid ""
|
1709 |
"Fix problems with the plugin by debugging it here. It can log them to a file "
|
1710 |
"in your cache directory."
|
1711 |
msgstr ""
|
1712 |
|
1713 |
-
#: wp-cache.php:
|
1714 |
msgid "Debugging"
|
1715 |
msgstr ""
|
1716 |
|
1717 |
-
#: wp-cache.php:
|
1718 |
msgid "IP Address"
|
1719 |
msgstr ""
|
1720 |
|
1721 |
-
#: wp-cache.php:
|
1722 |
msgid "(only log requests from this IP address. Your IP is %s)"
|
1723 |
msgstr ""
|
1724 |
|
1725 |
-
#: wp-cache.php:
|
1726 |
msgid "Cache Status Messages"
|
1727 |
msgstr ""
|
1728 |
|
1729 |
-
#: wp-cache.php:
|
1730 |
msgid "Display comments at the end of every page like this:"
|
1731 |
msgstr ""
|
1732 |
|
1733 |
-
#: wp-cache.php:
|
1734 |
msgid ""
|
1735 |
"In very rare cases two problems may arise on some blogs:<ol><li> The front "
|
1736 |
"page may start downloading as a zip file.</li><li> The wrong page is "
|
@@ -1738,7 +1738,7 @@ msgid ""
|
|
1738 |
"and the permalink structure is <em>/%category%/%postname%/</em>.</li></ol>"
|
1739 |
msgstr ""
|
1740 |
|
1741 |
-
#: wp-cache.php:
|
1742 |
msgid ""
|
1743 |
"I’m 99% certain that they aren’t bugs in WP Super Cache and they "
|
1744 |
"only happen in very rare cases but you can run a simple check once every 5 "
|
@@ -1746,54 +1746,54 @@ msgid ""
|
|
1746 |
"emailed if there is a problem."
|
1747 |
msgstr ""
|
1748 |
|
1749 |
-
#: wp-cache.php:
|
1750 |
msgid "Check front page every 5 minutes."
|
1751 |
msgstr ""
|
1752 |
|
1753 |
-
#: wp-cache.php:
|
1754 |
msgid "Front page text"
|
1755 |
msgstr ""
|
1756 |
|
1757 |
-
#: wp-cache.php:
|
1758 |
msgid ""
|
1759 |
"Text to search for on your front page. If this text is missing, the cache "
|
1760 |
"will be cleared. Leave blank to disable."
|
1761 |
msgstr ""
|
1762 |
|
1763 |
-
#: wp-cache.php:
|
1764 |
msgid "Clear cache on error."
|
1765 |
msgstr ""
|
1766 |
|
1767 |
-
#: wp-cache.php:
|
1768 |
msgid "Email the blog admin when checks are made. (useful for testing)"
|
1769 |
msgstr ""
|
1770 |
|
1771 |
-
#: wp-cache.php:
|
1772 |
msgid ""
|
1773 |
"Error: GZIP compression is enabled. Disable it if you want to enable wp-"
|
1774 |
"cache."
|
1775 |
msgstr ""
|
1776 |
|
1777 |
-
#: wp-cache.php:
|
1778 |
msgid "Warning"
|
1779 |
msgstr ""
|
1780 |
|
1781 |
-
#: wp-cache.php:
|
1782 |
msgid ""
|
1783 |
"GZIP compression is enabled in WordPress, wp-cache will be bypassed until "
|
1784 |
"you disable gzip compression."
|
1785 |
msgstr ""
|
1786 |
|
1787 |
-
#: wp-cache.php:
|
1788 |
msgid "WP Super Cache Warning!"
|
1789 |
msgstr ""
|
1790 |
|
1791 |
-
#: wp-cache.php:
|
1792 |
msgid ""
|
1793 |
"All users of this site have been logged out to refresh their login cookies."
|
1794 |
msgstr ""
|
1795 |
|
1796 |
-
#: wp-cache.php:
|
1797 |
msgid ""
|
1798 |
"Your server is configured to show files and directories, which may expose "
|
1799 |
"sensitive data such as login cookies to attackers in the cache directories. "
|
@@ -1802,77 +1802,77 @@ msgid ""
|
|
1802 |
"directory on the Advanced Settings page."
|
1803 |
msgstr ""
|
1804 |
|
1805 |
-
#: wp-cache.php:
|
1806 |
msgid ""
|
1807 |
"If you just installed WP Super Cache for the first time, you can dismiss "
|
1808 |
"this message. Otherwise, you should probably refresh the login cookies of "
|
1809 |
"all logged in WordPress users here by clicking the logout link below."
|
1810 |
msgstr ""
|
1811 |
|
1812 |
-
#: wp-cache.php:
|
1813 |
msgid ""
|
1814 |
"Your site is using a very old version of WordPress. When you update to the "
|
1815 |
"latest version everyone will be logged out and cookie information updated."
|
1816 |
msgstr ""
|
1817 |
|
1818 |
-
#: wp-cache.php:
|
1819 |
msgid ""
|
1820 |
"The logout link will log out all WordPress users on this site except you. "
|
1821 |
"Your authentication cookie will be updated, but you will not be logged out."
|
1822 |
msgstr ""
|
1823 |
|
1824 |
-
#: wp-cache.php:
|
1825 |
msgid "Logout"
|
1826 |
msgstr ""
|
1827 |
|
1828 |
-
#: wp-cache.php:
|
1829 |
-
#: wp-cache.php:
|
1830 |
msgid "Error"
|
1831 |
msgstr ""
|
1832 |
|
1833 |
-
#: wp-cache.php:
|
1834 |
msgid ""
|
1835 |
"Your cache directory (<strong>%1$s</strong>) did not exist and couldn’"
|
1836 |
"t be created by the web server. Check %1$s permissions."
|
1837 |
msgstr ""
|
1838 |
|
1839 |
-
#: wp-cache.php:
|
1840 |
msgid ""
|
1841 |
"Your cache directory (<strong>%1$s</strong>) or <strong>%2$s</strong> need "
|
1842 |
"to be writable for this plugin to work. Double-check it."
|
1843 |
msgstr ""
|
1844 |
|
1845 |
-
#: wp-cache.php:
|
1846 |
msgid ""
|
1847 |
"Your WP-Cache config file (<strong>%s</strong>) is out of date and not "
|
1848 |
"writable by the Web server. Please delete it and refresh this page."
|
1849 |
msgstr ""
|
1850 |
|
1851 |
-
#: wp-cache.php:
|
1852 |
msgid ""
|
1853 |
"Configuration file missing and %1$s directory (<strong>%2$s</strong>) is "
|
1854 |
"not writable by the web server. Check its permissions."
|
1855 |
msgstr ""
|
1856 |
|
1857 |
-
#: wp-cache.php:
|
1858 |
msgid ""
|
1859 |
"Sample WP-Cache config file (<strong>%s</strong>) does not exist. Verify "
|
1860 |
"your installation."
|
1861 |
msgstr ""
|
1862 |
|
1863 |
-
#: wp-cache.php:
|
1864 |
msgid "Could not update %s!</em> WPCACHEHOME must be set in config file."
|
1865 |
msgstr ""
|
1866 |
|
1867 |
-
#: wp-cache.php:
|
1868 |
msgid "%s/advanced-cache.php</em> does not exist or cannot be updated."
|
1869 |
msgstr ""
|
1870 |
|
1871 |
-
#: wp-cache.php:
|
1872 |
msgid "1. If it already exists, please delete the file first."
|
1873 |
msgstr ""
|
1874 |
|
1875 |
-
#: wp-cache.php:
|
1876 |
msgid ""
|
1877 |
"2. Make %1$s writable using the chmod command through your ftp or server "
|
1878 |
"software. (<em>chmod 777 %1$s</em>) and refresh this page. This is only a "
|
@@ -1880,24 +1880,24 @@ msgid ""
|
|
1880 |
"again. (Change 777 to 755 in the previous command)"
|
1881 |
msgstr ""
|
1882 |
|
1883 |
-
#: wp-cache.php:
|
1884 |
msgid "3. Refresh this page to update <em>%s/advanced-cache.php</em>"
|
1885 |
msgstr ""
|
1886 |
|
1887 |
-
#: wp-cache.php:
|
1888 |
msgid ""
|
1889 |
"If that doesn’t work, make sure the file <em>%s/advanced-cache.php</"
|
1890 |
"em> doesn’t exist:"
|
1891 |
msgstr ""
|
1892 |
|
1893 |
-
#: wp-cache.php:
|
1894 |
msgid ""
|
1895 |
"<li>1. Open <em>%1$s$wp_cache_file</em> in a text editor.</li><li>2. Change "
|
1896 |
"the text <em>CACHEHOME</em> to <em>%2$s</em></li><li>3. Save the file and "
|
1897 |
"copy it to <em>%3$s</em> and refresh this page.</li>"
|
1898 |
msgstr ""
|
1899 |
|
1900 |
-
#: wp-cache.php:
|
1901 |
msgid ""
|
1902 |
"<h3>WP_CACHE constant set to false</h3><p>The WP_CACHE constant is used by "
|
1903 |
"WordPress to load the code that serves cached pages. Unfortunately, it is "
|
@@ -1906,20 +1906,20 @@ msgid ""
|
|
1906 |
"('WP_CACHE', true);</code></p>"
|
1907 |
msgstr ""
|
1908 |
|
1909 |
-
#: wp-cache.php:
|
1910 |
msgid ""
|
1911 |
"<strong>Error: WP_CACHE is not enabled</strong> in your <code>wp-config.php</"
|
1912 |
"code> file and I couldn’t modify it."
|
1913 |
msgstr ""
|
1914 |
|
1915 |
-
#: wp-cache.php:
|
1916 |
msgid ""
|
1917 |
"Edit <code>%s</code> and add the following line:<br /> <code>define"
|
1918 |
"('WP_CACHE', true);</code><br />Otherwise, <strong>WP-Cache will not be "
|
1919 |
"executed</strong> by WordPress core. "
|
1920 |
msgstr ""
|
1921 |
|
1922 |
-
#: wp-cache.php:
|
1923 |
msgid ""
|
1924 |
"<h3>WP_CACHE constant added to wp-config.php</h3><p>If you continue to see "
|
1925 |
"this warning message please see point 5 of the <a href=\"http://wordpress."
|
@@ -1927,131 +1927,131 @@ msgid ""
|
|
1927 |
"line must be moved up."
|
1928 |
msgstr ""
|
1929 |
|
1930 |
-
#: wp-cache.php:
|
1931 |
msgid "Cache Contents"
|
1932 |
msgstr ""
|
1933 |
|
1934 |
-
#: wp-cache.php:
|
1935 |
msgid "Object cache in use. No cache listing available."
|
1936 |
msgstr ""
|
1937 |
|
1938 |
-
#: wp-cache.php:
|
1939 |
msgid "Deleting supercache file: <strong>%s</strong><br />"
|
1940 |
msgstr ""
|
1941 |
|
1942 |
-
#: wp-cache.php:
|
1943 |
msgid "Deleting wp-cache file: <strong>%s</strong><br />"
|
1944 |
msgstr ""
|
1945 |
|
1946 |
-
#: wp-cache.php:
|
1947 |
msgid ""
|
1948 |
"Cache stats are not automatically generated. You must click the link below "
|
1949 |
"to regenerate the stats on this page."
|
1950 |
msgstr ""
|
1951 |
|
1952 |
-
#: wp-cache.php:
|
1953 |
msgid "Regenerate cache stats"
|
1954 |
msgstr ""
|
1955 |
|
1956 |
-
#: wp-cache.php:
|
1957 |
msgid "Cache stats last generated: %s minutes ago."
|
1958 |
msgstr ""
|
1959 |
|
1960 |
-
#: wp-cache.php:
|
1961 |
msgid "WP-Cache"
|
1962 |
msgstr ""
|
1963 |
|
1964 |
-
#: wp-cache.php:
|
1965 |
msgid "%s Cached Pages"
|
1966 |
msgstr ""
|
1967 |
|
1968 |
-
#: wp-cache.php:
|
1969 |
msgid "%s Expired Pages"
|
1970 |
msgstr ""
|
1971 |
|
1972 |
-
#: wp-cache.php:
|
1973 |
msgid "WP-Super-Cache"
|
1974 |
msgstr ""
|
1975 |
|
1976 |
-
#: wp-cache.php:
|
1977 |
msgid "Fresh WP-Cached Files"
|
1978 |
msgstr ""
|
1979 |
|
1980 |
-
#: wp-cache.php:
|
1981 |
msgid "URI"
|
1982 |
msgstr ""
|
1983 |
|
1984 |
-
#: wp-cache.php:
|
1985 |
msgid "Key"
|
1986 |
msgstr ""
|
1987 |
|
1988 |
-
#: wp-cache.php:
|
1989 |
msgid "Age"
|
1990 |
msgstr ""
|
1991 |
|
1992 |
-
#: wp-cache.php:
|
1993 |
msgid "Delete"
|
1994 |
msgstr ""
|
1995 |
|
1996 |
-
#: wp-cache.php:
|
1997 |
msgid "Stale WP-Cached Files"
|
1998 |
msgstr ""
|
1999 |
|
2000 |
-
#: wp-cache.php:
|
2001 |
msgid "Fresh Super Cached Files"
|
2002 |
msgstr ""
|
2003 |
|
2004 |
-
#: wp-cache.php:
|
2005 |
msgid "Stale Super Cached Files"
|
2006 |
msgstr ""
|
2007 |
|
2008 |
-
#: wp-cache.php:
|
2009 |
msgid "Hide file list"
|
2010 |
msgstr ""
|
2011 |
|
2012 |
-
#: wp-cache.php:
|
2013 |
msgid "Too many cached files, no listing possible."
|
2014 |
msgstr ""
|
2015 |
|
2016 |
-
#: wp-cache.php:
|
2017 |
msgid "List all cached files"
|
2018 |
msgstr ""
|
2019 |
|
2020 |
-
#: wp-cache.php:
|
2021 |
msgid ""
|
2022 |
"Expired files are files older than %s seconds. They are still used by the "
|
2023 |
"plugin and are deleted periodically."
|
2024 |
msgstr ""
|
2025 |
|
2026 |
-
#: wp-cache.php:
|
2027 |
msgid "Delete Expired"
|
2028 |
msgstr ""
|
2029 |
|
2030 |
-
#: wp-cache.php:
|
2031 |
msgid "Delete Super Cache cached files (opens in new window)"
|
2032 |
msgstr ""
|
2033 |
|
2034 |
-
#: wp-cache.php:
|
2035 |
msgid "%1$s is Stephen Fry proof thanks to caching by %2$s"
|
2036 |
msgstr ""
|
2037 |
|
2038 |
-
#: wp-cache.php:
|
2039 |
msgid ""
|
2040 |
"WP Super Cache must be configured. Go to <a href=\"%s\">the admin page</a> "
|
2041 |
"to enable and configure the plugin."
|
2042 |
msgstr ""
|
2043 |
|
2044 |
-
#: wp-cache.php:
|
2045 |
msgid "Settings"
|
2046 |
msgstr ""
|
2047 |
|
2048 |
-
#: wp-cache.php:
|
2049 |
msgid ""
|
2050 |
"WP Super Cache is disabled. Please go to the <a href=\"%s\">plugin admin "
|
2051 |
"page</a> to enable caching."
|
2052 |
msgstr ""
|
2053 |
|
2054 |
-
#: wp-cache.php:
|
2055 |
msgid ""
|
2056 |
"Warning! WP Super Cache caching <strong>was</strong> broken but has been "
|
2057 |
"<strong>fixed</strong>! The script advanced-cache.php could not load wp-"
|
@@ -2060,146 +2060,146 @@ msgid ""
|
|
2060 |
"message."
|
2061 |
msgstr ""
|
2062 |
|
2063 |
-
#: wp-cache.php:
|
2064 |
msgid "[%s] Front page is gzipped! Please clear cache!"
|
2065 |
msgstr ""
|
2066 |
|
2067 |
-
#: wp-cache.php:
|
2068 |
msgid ""
|
2069 |
"Please visit %s to clear the cache as the front page of your site is now "
|
2070 |
"downloading!"
|
2071 |
msgstr ""
|
2072 |
|
2073 |
-
#: wp-cache.php:
|
2074 |
msgid "[%s] Front page is gzipped! Cache Cleared!"
|
2075 |
msgstr ""
|
2076 |
|
2077 |
-
#: wp-cache.php:
|
2078 |
msgid ""
|
2079 |
"The cache on your blog has been cleared because the front page of your site "
|
2080 |
"is now downloading. Please visit %s to verify the cache has been cleared."
|
2081 |
msgstr ""
|
2082 |
|
2083 |
-
#: wp-cache.php:
|
2084 |
msgid "[%s] Front page is not correct! Please clear cache!"
|
2085 |
msgstr ""
|
2086 |
|
2087 |
-
#: wp-cache.php:
|
2088 |
msgid ""
|
2089 |
"Please visit %1$s to clear the cache as the front page of your site is not "
|
2090 |
"correct and missing the text, \"%2$s\"!"
|
2091 |
msgstr ""
|
2092 |
|
2093 |
-
#: wp-cache.php:
|
2094 |
msgid "[%s] Front page is not correct! Cache Cleared!"
|
2095 |
msgstr ""
|
2096 |
|
2097 |
-
#: wp-cache.php:
|
2098 |
msgid ""
|
2099 |
"The cache on your blog has been cleared because the front page of your site "
|
2100 |
"is missing the text \"%2$s\". Please visit %1$s to verify the cache has been "
|
2101 |
"cleared."
|
2102 |
msgstr ""
|
2103 |
|
2104 |
-
#: wp-cache.php:
|
2105 |
msgid "[%s] Front page check!"
|
2106 |
msgstr ""
|
2107 |
|
2108 |
-
#: wp-cache.php:
|
2109 |
msgid ""
|
2110 |
"WP Super Cache has checked the front page of your blog. Please visit %s if "
|
2111 |
"you would like to disable this."
|
2112 |
msgstr ""
|
2113 |
|
2114 |
-
#: wp-cache.php:
|
2115 |
msgid "Cannot update .htaccess"
|
2116 |
msgstr ""
|
2117 |
|
2118 |
-
#: wp-cache.php:
|
2119 |
msgid ""
|
2120 |
"The file <code>%s.htaccess</code> cannot be modified by the web server. "
|
2121 |
"Please correct this using the chmod command or your ftp client."
|
2122 |
msgstr ""
|
2123 |
|
2124 |
-
#: wp-cache.php:
|
2125 |
msgid "Refresh this page when the file permissions have been modified."
|
2126 |
msgstr ""
|
2127 |
|
2128 |
-
#: wp-cache.php:
|
2129 |
msgid ""
|
2130 |
"Alternatively, you can edit your <code>%s.htaccess</code> file manually and "
|
2131 |
"add the following code (before any WordPress rules):"
|
2132 |
msgstr ""
|
2133 |
|
2134 |
-
#: wp-cache.php:
|
2135 |
msgid ""
|
2136 |
"To serve static html files your server must have the correct mod_rewrite "
|
2137 |
"rules added to a file called <code>%s.htaccess</code>"
|
2138 |
msgstr ""
|
2139 |
|
2140 |
-
#: wp-cache.php:
|
2141 |
msgid "You can edit the file yourself. Add the following rules."
|
2142 |
msgstr ""
|
2143 |
|
2144 |
-
#: wp-cache.php:
|
2145 |
msgid " Make sure they appear before any existing WordPress rules. "
|
2146 |
msgstr ""
|
2147 |
|
2148 |
-
#: wp-cache.php:
|
2149 |
msgid "Update Mod_Rewrite Rules"
|
2150 |
msgstr ""
|
2151 |
|
2152 |
-
#: wp-cache.php:
|
2153 |
msgid "[%1$s] Cache Preload Started"
|
2154 |
msgstr ""
|
2155 |
|
2156 |
-
#: wp-cache.php:
|
2157 |
msgid "[%1$s] Refreshing %2$s taxonomy from %3$d to %4$d"
|
2158 |
msgstr ""
|
2159 |
|
2160 |
-
#: wp-cache.php:
|
2161 |
msgid "[%1$s] Refreshing posts from %2$d to %3$d"
|
2162 |
msgstr ""
|
2163 |
|
2164 |
-
#: wp-cache.php:
|
2165 |
msgid "[%1$s] Cache Preload Stopped"
|
2166 |
msgstr ""
|
2167 |
|
2168 |
-
#: wp-cache.php:
|
2169 |
msgid "[%1$s] %2$d posts refreshed"
|
2170 |
msgstr ""
|
2171 |
|
2172 |
-
#: wp-cache.php:
|
2173 |
msgid "Refreshed the following posts:"
|
2174 |
msgstr ""
|
2175 |
|
2176 |
-
#: wp-cache.php:
|
2177 |
msgid "Scheduling next preload refresh in %d minutes."
|
2178 |
msgstr ""
|
2179 |
|
2180 |
-
#: wp-cache.php:
|
2181 |
msgid "[%s] Cache Preload Completed"
|
2182 |
msgstr ""
|
2183 |
|
2184 |
-
#: wp-cache.php:
|
2185 |
msgid "Cleaning up old supercache files."
|
2186 |
msgstr ""
|
2187 |
|
2188 |
-
#: wp-cache.php:
|
2189 |
msgid "[%s] Preload may have stalled."
|
2190 |
msgstr ""
|
2191 |
|
2192 |
-
#: wp-cache.php:
|
2193 |
msgid ""
|
2194 |
"Preload has been restarted.\n"
|
2195 |
"%s"
|
2196 |
msgstr ""
|
2197 |
|
2198 |
-
#: wp-cache.php:
|
2199 |
msgid "Supercache Uninstall Problems"
|
2200 |
msgstr ""
|
2201 |
|
2202 |
-
#: wp-cache.php:
|
2203 |
msgid ""
|
2204 |
"Dear User,\n"
|
2205 |
"\n"
|
@@ -2217,7 +2217,7 @@ msgid ""
|
|
2217 |
"http://wordpress.org/plugins/wp-super-cache/"
|
2218 |
msgstr ""
|
2219 |
|
2220 |
-
#: wp-cache.php:
|
2221 |
msgid "Delete cache of the current page"
|
2222 |
msgstr ""
|
2223 |
|
2 |
# This file is distributed under the same license as the WP Super Cache package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WP Super Cache 1.4.9\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-super-cache\n"
|
7 |
+
"POT-Creation-Date: 2017-02-28 12:51:09+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
20 |
"<code>wp-content</code> and <code>wp-includes</code> directories (except for "
|
21 |
"PHP files) on your site with the URL you provide below. That way you can "
|
22 |
"either copy all the static content to a dedicated host or mirror the files "
|
23 |
+
"to a CDN by <a href=\"https://knowledgelayer.softlayer.com/faq/how-does-"
|
24 |
+
"origin-pull-work\" target=\"_blank\">origin pull</a>."
|
25 |
msgstr ""
|
26 |
|
27 |
#: ossdl-cdn.php:154
|
108 |
|
109 |
#: plugins/awaitingmoderation.php:34 plugins/badbehaviour.php:65
|
110 |
#: plugins/domain-mapping.php:75 plugins/jetpack.php:31
|
111 |
+
#: plugins/searchengine.php:69 plugins/wptouch.php:22 wp-cache.php:1500
|
112 |
msgid "Enabled"
|
113 |
msgstr ""
|
114 |
|
115 |
#: plugins/awaitingmoderation.php:35 plugins/badbehaviour.php:66
|
116 |
#: plugins/domain-mapping.php:76 plugins/jetpack.php:32
|
117 |
+
#: plugins/searchengine.php:70 plugins/wptouch.php:23 wp-cache.php:1500
|
118 |
msgid "Disabled"
|
119 |
msgstr ""
|
120 |
|
126 |
|
127 |
#: plugins/awaitingmoderation.php:40 plugins/badbehaviour.php:71
|
128 |
#: plugins/domain-mapping.php:81 plugins/jetpack.php:37
|
129 |
+
#: plugins/searchengine.php:75 plugins/wptouch.php:28 wp-cache.php:1977
|
130 |
+
#: wp-cache.php:1979
|
131 |
msgid "enabled"
|
132 |
msgstr ""
|
133 |
|
166 |
msgid "Bad Behavior support is now %s"
|
167 |
msgstr ""
|
168 |
|
169 |
+
#: plugins/badbehaviour.php:83 wp-cache.php:1593 wp-cache.php:1598
|
170 |
msgid "Warning!"
|
171 |
msgstr ""
|
172 |
|
216 |
msgid "Cached"
|
217 |
msgstr ""
|
218 |
|
219 |
+
#: plugins/multisite.php:31 wp-cache.php:1513
|
220 |
msgid "Enable"
|
221 |
msgstr ""
|
222 |
|
223 |
+
#: plugins/multisite.php:33 plugins/searchengine.php:61 wp-cache.php:1513
|
224 |
msgid "Disable"
|
225 |
msgstr ""
|
226 |
|
262 |
"the WPTouch helper plugin."
|
263 |
msgstr ""
|
264 |
|
265 |
+
#: wp-cache-phase2.php:1389
|
266 |
msgid "Cache expiry cron job failed. Job will run again in 10 seconds."
|
267 |
msgstr ""
|
268 |
|
269 |
+
#: wp-cache-phase2.php:1393
|
270 |
msgid ""
|
271 |
"Cache expiry cron job took more than 30 seconds. You should probably run the "
|
272 |
"garbage collector more often."
|
273 |
msgstr ""
|
274 |
|
275 |
+
#: wp-cache-phase2.php:1402
|
276 |
msgid "[%1$s] WP Super Cache GC Report"
|
277 |
msgstr ""
|
278 |
|
420 |
"a regular basis. Use <a href=\"#expirytime\">this form</a> to enable it."
|
421 |
msgstr ""
|
422 |
|
423 |
+
#: wp-cache.php:309 wp-cache.php:337 wp-cache.php:409 wp-cache.php:2169
|
424 |
msgid "Dismiss"
|
425 |
msgstr ""
|
426 |
|
532 |
"site is hosted. This will be fixed in the future."
|
533 |
msgstr ""
|
534 |
|
535 |
+
#: wp-cache.php:663
|
536 |
msgid ""
|
537 |
"<strong>Warning!</strong> You attempted to enable compression but <code>zlib."
|
538 |
"output_compression</code> is enabled. See #21 in the Troubleshooting section "
|
539 |
"of the readme file."
|
540 |
msgstr ""
|
541 |
|
542 |
+
#: wp-cache.php:763
|
543 |
msgid "WP Super Cache Settings"
|
544 |
msgstr ""
|
545 |
|
546 |
+
#: wp-cache.php:777
|
547 |
msgid ""
|
548 |
"Notice: <em>Mod_rewrite or Legacy caching enabled</em>. Showing Advanced "
|
549 |
"Settings Page by default."
|
550 |
msgstr ""
|
551 |
|
552 |
+
#: wp-cache.php:788
|
553 |
msgid ""
|
554 |
"Configuration file changed, some values might be wrong. Load the page again "
|
555 |
"from the \"Settings\" menu to reset them."
|
556 |
msgstr ""
|
557 |
|
558 |
+
#: wp-cache.php:820
|
559 |
msgid "Caching must be enabled to use this feature"
|
560 |
msgstr ""
|
561 |
|
562 |
+
#: wp-cache.php:838 wp-cache.php:978
|
563 |
msgid "Cancel Cache Preload"
|
564 |
msgstr ""
|
565 |
|
566 |
+
#: wp-cache.php:846
|
567 |
msgid ""
|
568 |
"Scheduled preloading of cache almost cancelled. It may take up to a minute "
|
569 |
"for it to cancel completely."
|
570 |
msgstr ""
|
571 |
|
572 |
+
#: wp-cache.php:857
|
573 |
msgid "Scheduled preloading of cache cancelled."
|
574 |
msgstr ""
|
575 |
|
576 |
+
#: wp-cache.php:889 wp-cache.php:976
|
577 |
msgid "Preload Cache Now"
|
578 |
msgstr ""
|
579 |
|
580 |
+
#: wp-cache.php:893
|
581 |
msgid "Scheduled preloading of cache in 10 seconds."
|
582 |
msgstr ""
|
583 |
|
584 |
+
#: wp-cache.php:898
|
585 |
msgid "Scheduled preloading of cache in %d minutes"
|
586 |
msgstr ""
|
587 |
|
588 |
+
#: wp-cache.php:902
|
589 |
msgid ""
|
590 |
"This will cache every published post and page on your site. It will create "
|
591 |
"supercache static files so unknown visitors (including bots) will hit a "
|
593 |
"speed as a metric when judging websites now."
|
594 |
msgstr ""
|
595 |
|
596 |
+
#: wp-cache.php:903
|
597 |
msgid ""
|
598 |
"Preloading creates lots of files however. Caching is done from the newest "
|
599 |
"post to the oldest so please consider only caching the newest if you have "
|
600 |
"lots (10,000+) of posts. This is especially important on shared hosting."
|
601 |
msgstr ""
|
602 |
|
603 |
+
#: wp-cache.php:904
|
604 |
msgid ""
|
605 |
"In ’Preload Mode’ regular garbage collection will only clean out "
|
606 |
"old legacy files for known users, not the preloaded supercache files. This "
|
607 |
"is a recommended setting when the cache is preloaded."
|
608 |
msgstr ""
|
609 |
|
610 |
+
#: wp-cache.php:908
|
611 |
msgid ""
|
612 |
"Refresh preloaded cache files every %s minutes. (0 to disable, minimum %d "
|
613 |
"minutes.)"
|
614 |
msgstr ""
|
615 |
|
616 |
+
#: wp-cache.php:921
|
617 |
msgid "all"
|
618 |
msgstr ""
|
619 |
|
620 |
+
#: wp-cache.php:934
|
621 |
msgid "Preload %s posts."
|
622 |
msgstr ""
|
623 |
|
624 |
+
#: wp-cache.php:941
|
625 |
msgid ""
|
626 |
"Preload mode (garbage collection only on legacy cache files. Recommended.)"
|
627 |
msgstr ""
|
628 |
|
629 |
+
#: wp-cache.php:944
|
630 |
msgid "Preload tags, categories and other taxonomies."
|
631 |
msgstr ""
|
632 |
|
633 |
+
#: wp-cache.php:947
|
634 |
msgid "Send me status emails when files are refreshed."
|
635 |
msgstr ""
|
636 |
|
637 |
+
#: wp-cache.php:952
|
638 |
msgid "Many emails, 2 emails per 100 posts."
|
639 |
msgstr ""
|
640 |
|
641 |
+
#: wp-cache.php:955
|
642 |
msgid "Medium, 1 email per 100 posts."
|
643 |
msgstr ""
|
644 |
|
645 |
+
#: wp-cache.php:958
|
646 |
msgid "Less emails, 1 at the start and 1 at the end of preloading all posts."
|
647 |
msgstr ""
|
648 |
|
649 |
+
#: wp-cache.php:962
|
650 |
msgid "Refresh of cache in %d hours %d minutes and %d seconds."
|
651 |
msgstr ""
|
652 |
|
653 |
+
#: wp-cache.php:963
|
654 |
msgid "Full refresh of cache in %d hours %d minutes and %d seconds."
|
655 |
msgstr ""
|
656 |
|
657 |
+
#: wp-cache.php:969
|
658 |
msgid "Currently caching from post %d to %d."
|
659 |
msgstr ""
|
660 |
|
661 |
+
#: wp-cache.php:973
|
662 |
msgid "<strong>Page last cached:</strong> %s"
|
663 |
msgstr ""
|
664 |
|
665 |
+
#: wp-cache.php:976
|
666 |
msgid "Update Settings"
|
667 |
msgstr ""
|
668 |
|
669 |
+
#: wp-cache.php:984
|
670 |
msgid ""
|
671 |
"Preloading of cache disabled. Please disable legacy page caching or talk to "
|
672 |
"your host administrator."
|
673 |
msgstr ""
|
674 |
|
675 |
+
#: wp-cache.php:1001 wp-cache.php:1146
|
676 |
msgid "Caching"
|
677 |
msgstr ""
|
678 |
|
679 |
+
#: wp-cache.php:1005 wp-cache.php:1149
|
680 |
msgid "Caching On"
|
681 |
msgstr ""
|
682 |
|
683 |
+
#: wp-cache.php:1005 wp-cache.php:1008 wp-cache.php:1024 wp-cache.php:1029
|
684 |
+
#: wp-cache.php:1030 wp-cache.php:1037 wp-cache.php:1064 wp-cache.php:1149
|
685 |
msgid "Recommended"
|
686 |
msgstr ""
|
687 |
|
688 |
+
#: wp-cache.php:1006 wp-cache.php:1150
|
689 |
msgid "Caching Off"
|
690 |
msgstr ""
|
691 |
|
692 |
+
#: wp-cache.php:1007
|
693 |
msgid "Use mod_rewrite to serve cache files."
|
694 |
msgstr ""
|
695 |
|
696 |
+
#: wp-cache.php:1008
|
697 |
msgid "Use PHP to serve cache files."
|
698 |
msgstr ""
|
699 |
|
700 |
+
#: wp-cache.php:1009
|
701 |
msgid "Legacy page caching."
|
702 |
msgstr ""
|
703 |
|
704 |
+
#: wp-cache.php:1010
|
705 |
msgid ""
|
706 |
"Mod_rewrite is fastest, PHP is almost as fast and easier to get working, "
|
707 |
"while legacy caching is slower again, but more flexible and also easy to get "
|
708 |
"working. New users should use PHP caching."
|
709 |
msgstr ""
|
710 |
|
711 |
+
#: wp-cache.php:1016
|
712 |
msgid "Miscellaneous"
|
713 |
msgstr ""
|
714 |
|
715 |
+
#: wp-cache.php:1022
|
716 |
msgid "Warning! Compression is disabled as gzencode() function was not found."
|
717 |
msgstr ""
|
718 |
|
719 |
+
#: wp-cache.php:1024
|
720 |
msgid "Compress pages so they’re served more quickly to visitors."
|
721 |
msgstr ""
|
722 |
|
723 |
+
#: wp-cache.php:1025
|
724 |
msgid ""
|
725 |
"Compression is disabled by default because some hosts have problems with "
|
726 |
"compressed files. Switching it on and off clears the cache."
|
727 |
msgstr ""
|
728 |
|
729 |
+
#: wp-cache.php:1029
|
730 |
msgid ""
|
731 |
"Don’t cache pages for <acronym title=\"Logged in users and those that "
|
732 |
"comment\">known users</acronym>."
|
733 |
msgstr ""
|
734 |
|
735 |
+
#: wp-cache.php:1030
|
736 |
msgid ""
|
737 |
"Cache rebuild. Serve a supercache file to anonymous users while a new file "
|
738 |
"is being generated."
|
739 |
msgstr ""
|
740 |
|
741 |
+
#: wp-cache.php:1037
|
742 |
msgid ""
|
743 |
"304 Not Modified browser caching. Indicate when a page has not been modified "
|
744 |
"since it was last requested."
|
745 |
msgstr ""
|
746 |
|
747 |
+
#: wp-cache.php:1040
|
748 |
msgid ""
|
749 |
"Warning! 304 browser caching is only supported when mod_rewrite caching is "
|
750 |
"not used."
|
751 |
msgstr ""
|
752 |
|
753 |
+
#: wp-cache.php:1042
|
754 |
msgid ""
|
755 |
"304 support is disabled by default because some hosts have had problems with "
|
756 |
"the headers used in the past."
|
757 |
msgstr ""
|
758 |
|
759 |
+
#: wp-cache.php:1045
|
760 |
msgid "Don’t cache pages with GET parameters. (?x=y at the end of a url)"
|
761 |
msgstr ""
|
762 |
|
763 |
+
#: wp-cache.php:1046
|
764 |
msgid ""
|
765 |
"Make known users anonymous so they’re served supercached static files."
|
766 |
msgstr ""
|
767 |
|
768 |
+
#: wp-cache.php:1047
|
769 |
msgid ""
|
770 |
"Proudly tell the world your server is <a href=\"%s\">Stephen Fry proof</a>! "
|
771 |
"(places a message in your blog’s footer)"
|
772 |
msgstr ""
|
773 |
|
774 |
+
#: wp-cache.php:1053 wp-cache.php:1350 wp-cache.php:1986
|
775 |
msgid "Advanced"
|
776 |
msgstr ""
|
777 |
|
778 |
+
#: wp-cache.php:1057
|
779 |
msgid ""
|
780 |
"Enable dynamic caching. Requires PHP or legacy caching. (See <a href="
|
781 |
"\"http://wordpress.org/plugins/wp-super-cache/faq/\">FAQ</a> or wp-super-"
|
782 |
"cache/plugins/dynamic-cache-test.php for example code.)"
|
783 |
msgstr ""
|
784 |
|
785 |
+
#: wp-cache.php:1058
|
786 |
msgid ""
|
787 |
"Mobile device support. (External plugin or theme required. See the <a href="
|
788 |
"\"http://wordpress.org/plugins/wp-super-cache/faq/\">FAQ</a> for further "
|
789 |
"details.)"
|
790 |
msgstr ""
|
791 |
|
792 |
+
#: wp-cache.php:1060
|
793 |
msgid "Mobile Browsers"
|
794 |
msgstr ""
|
795 |
|
796 |
+
#: wp-cache.php:1060
|
797 |
msgid "Mobile Prefixes"
|
798 |
msgstr ""
|
799 |
|
800 |
+
#: wp-cache.php:1062
|
801 |
msgid ""
|
802 |
"Remove UTF8/blog charset support from .htaccess file. Only necessary if you "
|
803 |
"see odd characters or punctuation looks incorrect. Requires rewrite rules "
|
804 |
"update."
|
805 |
msgstr ""
|
806 |
|
807 |
+
#: wp-cache.php:1063
|
808 |
msgid "Clear all cache files when a post or page is published or updated."
|
809 |
msgstr ""
|
810 |
|
811 |
+
#: wp-cache.php:1064
|
812 |
msgid "Extra homepage checks. (Very occasionally stops homepage caching)"
|
813 |
msgstr ""
|
814 |
|
815 |
+
#: wp-cache.php:1065
|
816 |
msgid "Only refresh current page when comments made."
|
817 |
msgstr ""
|
818 |
|
819 |
+
#: wp-cache.php:1066
|
820 |
msgid "List the newest cached pages on this page."
|
821 |
msgstr ""
|
822 |
|
823 |
+
#: wp-cache.php:1068
|
824 |
msgid ""
|
825 |
"Coarse file locking. You do not need this as it will slow down your website."
|
826 |
msgstr ""
|
827 |
|
828 |
+
#: wp-cache.php:1070
|
829 |
msgid ""
|
830 |
"Late init. Display cached files after WordPress has loaded. Most useful in "
|
831 |
"legacy mode."
|
832 |
msgstr ""
|
833 |
|
834 |
+
#: wp-cache.php:1072
|
835 |
msgid "Use object cache to store cached files."
|
836 |
msgstr ""
|
837 |
|
838 |
+
#: wp-cache.php:1072
|
839 |
msgid "(Experimental)"
|
840 |
msgstr ""
|
841 |
|
842 |
+
#: wp-cache.php:1074
|
843 |
msgid "<strong>DO NOT CACHE PAGE</strong> secret key: <a href=\"%s\">%s</a>"
|
844 |
msgstr ""
|
845 |
|
846 |
+
#: wp-cache.php:1079
|
847 |
msgid "Cache Location"
|
848 |
msgstr ""
|
849 |
|
850 |
+
#: wp-cache.php:1084
|
851 |
msgid ""
|
852 |
"Change the location of your cache files. The default is WP_CONTENT_DIR . /"
|
853 |
"cache/ which translates to %s."
|
854 |
msgstr ""
|
855 |
|
856 |
+
#: wp-cache.php:1085
|
857 |
msgid "You must give the full path to the directory."
|
858 |
msgstr ""
|
859 |
|
860 |
+
#: wp-cache.php:1086
|
861 |
msgid ""
|
862 |
"If the directory does not exist, it will be created. Please make sure your "
|
863 |
"web server user has write access to the parent directory. The parent "
|
864 |
"directory must exist."
|
865 |
msgstr ""
|
866 |
|
867 |
+
#: wp-cache.php:1087
|
868 |
msgid ""
|
869 |
"If the new cache directory does not exist, it will be created and the "
|
870 |
"contents of the old cache directory will be moved there. Otherwise, the old "
|
871 |
"cache directory will be left where it is."
|
872 |
msgstr ""
|
873 |
|
874 |
+
#: wp-cache.php:1088
|
875 |
msgid ""
|
876 |
"Submit a blank entry to set it to the default directory, WP_CONTENT_DIR . /"
|
877 |
"cache/."
|
878 |
msgstr ""
|
879 |
|
880 |
+
#: wp-cache.php:1090
|
881 |
msgid ""
|
882 |
"The plugin detected a bare directory index in your cache directory, which "
|
883 |
"would let visitors see your cache files directly and might expose private "
|
884 |
"posts."
|
885 |
msgstr ""
|
886 |
|
887 |
+
#: wp-cache.php:1092
|
888 |
msgid ""
|
889 |
"You are using mod_rewrite to serve cache files so the plugin has added "
|
890 |
"<q>Options -Indexes</q> to the .htaccess file in the cache directory to "
|
893 |
"mode and move the cache outside of the web root."
|
894 |
msgstr ""
|
895 |
|
896 |
+
#: wp-cache.php:1094
|
897 |
msgid ""
|
898 |
"index.html files have been added in key directories, but unless directory "
|
899 |
"indexes are disabled, it is probably better to store the cache files outside "
|
900 |
"of the web root of %s"
|
901 |
msgstr ""
|
902 |
|
903 |
+
#: wp-cache.php:1101
|
904 |
msgid ""
|
905 |
"Since you are using mod_rewrite to serve cache files, you must choose a "
|
906 |
"directory in your web root which is <q>%s</q> and update the mod_rewrite "
|
907 |
"rules in the .htaccess file."
|
908 |
msgstr ""
|
909 |
|
910 |
+
#: wp-cache.php:1109
|
911 |
msgid "Note:"
|
912 |
msgstr ""
|
913 |
|
914 |
+
#: wp-cache.php:1111
|
915 |
msgid ""
|
916 |
"Uninstall this plugin on the plugins page. It will automatically clean up "
|
917 |
"after itself. If manual intervention is required, then simple instructions "
|
918 |
"are provided."
|
919 |
msgstr ""
|
920 |
|
921 |
+
#: wp-cache.php:1112
|
922 |
msgid ""
|
923 |
"If uninstalling this plugin, make sure the directory <em>%s</em> is "
|
924 |
"writeable by the webserver so the files <em>advanced-cache.php</em> and "
|
926 |
"files are writeable is probably a good idea!)"
|
927 |
msgstr ""
|
928 |
|
929 |
+
#: wp-cache.php:1113
|
930 |
msgid ""
|
931 |
"Please see the <a href=\"%1$s/wp-super-cache/readme.txt\">readme.txt</a> for "
|
932 |
"instructions on uninstalling this script. Look for the heading, \"How to "
|
933 |
"uninstall WP Super Cache\"."
|
934 |
msgstr ""
|
935 |
|
936 |
+
#: wp-cache.php:1114
|
937 |
msgid ""
|
938 |
"Need help? Check the <a href=\"%1$s\">Super Cache readme file</a>. It "
|
939 |
"includes installation documentation, a FAQ and Troubleshooting tips. The <a "
|
941 |
"have been answered."
|
942 |
msgstr ""
|
943 |
|
944 |
+
#: wp-cache.php:1117 wp-cache.php:1162
|
945 |
msgid "Update Status"
|
946 |
msgstr ""
|
947 |
|
948 |
+
#: wp-cache.php:1124
|
949 |
msgid "Accepted Filenames & Rejected URIs"
|
950 |
msgstr ""
|
951 |
|
952 |
+
#: wp-cache.php:1159
|
953 |
msgid ""
|
954 |
"Notice: PHP caching enabled but Supercache mod_rewrite rules detected. "
|
955 |
"Cached files will be served using those rules. If your site is working ok, "
|
957 |
"the root of your install and remove the SuperCache rules."
|
958 |
msgstr ""
|
959 |
|
960 |
+
#: wp-cache.php:1164
|
961 |
msgid "Cache Tester"
|
962 |
msgstr ""
|
963 |
|
964 |
+
#: wp-cache.php:1165
|
965 |
msgid "Test your cached website by clicking the test button below."
|
966 |
msgstr ""
|
967 |
|
968 |
+
#: wp-cache.php:1171
|
969 |
msgid "Fetching %s to prime cache: "
|
970 |
msgstr ""
|
971 |
|
972 |
+
#: wp-cache.php:1173 wp-cache.php:1182 wp-cache.php:1194
|
973 |
msgid "OK"
|
974 |
msgstr ""
|
975 |
|
976 |
+
#: wp-cache.php:1176
|
977 |
msgid "Fetching first copy of %s: "
|
978 |
msgstr ""
|
979 |
|
980 |
+
#: wp-cache.php:1185 wp-cache.php:1196
|
981 |
msgid "FAILED"
|
982 |
msgstr ""
|
983 |
|
984 |
+
#: wp-cache.php:1188
|
985 |
msgid "Fetching second copy of %s: "
|
986 |
msgstr ""
|
987 |
|
988 |
+
#: wp-cache.php:1200
|
989 |
msgid "One or more page requests failed:"
|
990 |
msgstr ""
|
991 |
|
992 |
+
#: wp-cache.php:1219 wp-cache.php:1220
|
993 |
msgid "Page %d: %d (%s)"
|
994 |
msgstr ""
|
995 |
|
996 |
+
#: wp-cache.php:1226
|
997 |
msgid "Page 1: %s"
|
998 |
msgstr ""
|
999 |
|
1000 |
+
#: wp-cache.php:1227
|
1001 |
msgid "Page 2: %s"
|
1002 |
msgstr ""
|
1003 |
|
1004 |
+
#: wp-cache.php:1228
|
1005 |
msgid "The timestamps on both pages match!"
|
1006 |
msgstr ""
|
1007 |
|
1008 |
+
#: wp-cache.php:1230
|
1009 |
msgid "The pages do not match! Timestamps differ or were not found!"
|
1010 |
msgstr ""
|
1011 |
|
1012 |
+
#: wp-cache.php:1231
|
1013 |
msgid "Things you can do:"
|
1014 |
msgstr ""
|
1015 |
|
1016 |
+
#: wp-cache.php:1232
|
1017 |
msgid ""
|
1018 |
"Load your homepage in a logged out browser, check the timestamp at the end "
|
1019 |
"of the html source. Load the page again and compare the timestamp. Caching "
|
1020 |
"is working if the timestamps match."
|
1021 |
msgstr ""
|
1022 |
|
1023 |
+
#: wp-cache.php:1233
|
1024 |
msgid ""
|
1025 |
"Enable logging on the Debug page here. That should help you track down the "
|
1026 |
"problem."
|
1027 |
msgstr ""
|
1028 |
|
1029 |
+
#: wp-cache.php:1234
|
1030 |
msgid ""
|
1031 |
"You should check Page 1 and Page 2 above for errors. Your local server "
|
1032 |
"configuration may not allow your website to access itself."
|
1033 |
msgstr ""
|
1034 |
|
1035 |
+
#: wp-cache.php:1242
|
1036 |
msgid "Send non-secure (non https) request for homepage"
|
1037 |
msgstr ""
|
1038 |
|
1039 |
+
#: wp-cache.php:1243
|
1040 |
msgid "Test Cache"
|
1041 |
msgstr ""
|
1042 |
|
1043 |
+
#: wp-cache.php:1247
|
1044 |
msgid "Delete Cached Pages"
|
1045 |
msgstr ""
|
1046 |
|
1047 |
+
#: wp-cache.php:1248
|
1048 |
msgid ""
|
1049 |
"Cached pages are stored on your server as html and PHP files. If you need to "
|
1050 |
"delete them, use the button below."
|
1051 |
msgstr ""
|
1052 |
|
1053 |
+
#: wp-cache.php:1251 wp-cache.php:2691 wp-cache.php:2710 wp-cache.php:2901
|
1054 |
+
#: wp-cache.php:3440
|
1055 |
msgid "Delete Cache"
|
1056 |
msgstr ""
|
1057 |
|
1058 |
+
#: wp-cache.php:1258 wp-cache.php:2697
|
1059 |
msgid "Delete Cache On All Blogs"
|
1060 |
msgstr ""
|
1061 |
|
1062 |
+
#: wp-cache.php:1263
|
1063 |
msgid "Recommended Links and Plugins"
|
1064 |
msgstr ""
|
1065 |
|
1066 |
+
#: wp-cache.php:1264
|
1067 |
msgid ""
|
1068 |
"Caching is only one part of making a website faster. Here are some other "
|
1069 |
"plugins that will help:"
|
1070 |
msgstr ""
|
1071 |
|
1072 |
+
#: wp-cache.php:1265
|
1073 |
msgid ""
|
1074 |
"<a href=\"%s\">Yahoo! Yslow</a> is an extension for the Firefox add-on "
|
1075 |
"Firebug. It analyzes web pages and suggests ways to improve their "
|
1077 |
"the performance tools online at <a href=\"%s\">GTMetrix</a>."
|
1078 |
msgstr ""
|
1079 |
|
1080 |
+
#: wp-cache.php:1266
|
1081 |
msgid ""
|
1082 |
"<a href=\"%s\">Use Google Libraries</a> allows you to load some commonly "
|
1083 |
"used Javascript libraries from Google webservers. Ironically, it may reduce "
|
1084 |
"your Yslow score."
|
1085 |
msgstr ""
|
1086 |
|
1087 |
+
#: wp-cache.php:1267
|
1088 |
msgid ""
|
1089 |
"<strong>Advanced users only:</strong> Install an object cache. Choose from "
|
1090 |
"<a href=\"%s\">Memcached</a>, <a href=\"%s\">XCache</a>, <a href=\"%s"
|
1091 |
"\">eAcccelerator</a> and others."
|
1092 |
msgstr ""
|
1093 |
|
1094 |
+
#: wp-cache.php:1268
|
1095 |
msgid ""
|
1096 |
"<a href=\"%s\">Cron View</a> is a useful plugin to use when trying to debug "
|
1097 |
"garbage collection and preload problems."
|
1098 |
msgstr ""
|
1099 |
|
1100 |
+
#: wp-cache.php:1279
|
1101 |
msgid "Need Help?"
|
1102 |
msgstr ""
|
1103 |
|
1104 |
+
#: wp-cache.php:1281
|
1105 |
msgid ""
|
1106 |
"Use the debug system in the Debug tab above. It will tell you what the "
|
1107 |
"plugin is doing."
|
1108 |
msgstr ""
|
1109 |
|
1110 |
+
#: wp-cache.php:1282
|
1111 |
msgid "<a href=\"%1$s\">Installation Help</a>"
|
1112 |
msgstr ""
|
1113 |
|
1114 |
+
#: wp-cache.php:1283
|
1115 |
msgid "<a href=\"%1$s\">Frequently Asked Questions</a>"
|
1116 |
msgstr ""
|
1117 |
|
1118 |
+
#: wp-cache.php:1284
|
1119 |
msgid "<a href=\"%1$s\">Support Forum</a>"
|
1120 |
msgstr ""
|
1121 |
|
1122 |
+
#: wp-cache.php:1285
|
1123 |
msgid "<a href=\"%1$s\">Development Version</a>"
|
1124 |
msgstr ""
|
1125 |
|
1126 |
+
#: wp-cache.php:1287
|
1127 |
msgid "Rate This Plugin!"
|
1128 |
msgstr ""
|
1129 |
|
1130 |
+
#: wp-cache.php:1288
|
1131 |
msgid ""
|
1132 |
"Please <a href=\"%s\">rate</a> this plugin and tell me if it works for you "
|
1133 |
"or not. It really helps development."
|
1134 |
msgstr ""
|
1135 |
|
1136 |
+
#: wp-cache.php:1297
|
1137 |
msgid "Cached pages since %1$s : <strong>%2$s</strong>"
|
1138 |
msgstr ""
|
1139 |
|
1140 |
+
#: wp-cache.php:1298
|
1141 |
msgid "Newest Cached Pages:"
|
1142 |
msgstr ""
|
1143 |
|
1144 |
+
#: wp-cache.php:1302
|
1145 |
msgid "Cached %s seconds ago"
|
1146 |
msgstr ""
|
1147 |
|
1148 |
+
#: wp-cache.php:1305
|
1149 |
msgid "(may not always be accurate on busy sites)"
|
1150 |
msgstr ""
|
1151 |
|
1152 |
+
#: wp-cache.php:1321
|
1153 |
msgid ""
|
1154 |
"Cache plugins are PHP scripts that live in a plugins folder inside the wp-"
|
1155 |
"super-cache folder. They are loaded when Supercache loads, much sooner than "
|
1156 |
"regular WordPress plugins."
|
1157 |
msgstr ""
|
1158 |
|
1159 |
+
#: wp-cache.php:1322
|
1160 |
msgid ""
|
1161 |
"This is strictly an advanced feature only and knowledge of both PHP and "
|
1162 |
"WordPress actions is required to create them."
|
1163 |
msgstr ""
|
1164 |
|
1165 |
+
#: wp-cache.php:1323
|
1166 |
msgid ""
|
1167 |
"<strong>Warning</strong>! Due to the way WordPress upgrades plugins, the "
|
1168 |
"plugins you upload to wp-super-cache/plugins/ will be deleted when you "
|
1173 |
"\">developer documentation</a>."
|
1174 |
msgstr ""
|
1175 |
|
1176 |
+
#: wp-cache.php:1333
|
1177 |
msgid "Available Plugins"
|
1178 |
msgstr ""
|
1179 |
|
1180 |
+
#: wp-cache.php:1350
|
1181 |
msgid "Easy"
|
1182 |
msgstr ""
|
1183 |
|
1184 |
+
#: wp-cache.php:1350
|
1185 |
msgid "CDN"
|
1186 |
msgstr ""
|
1187 |
|
1188 |
+
#: wp-cache.php:1350
|
1189 |
msgid "Contents"
|
1190 |
msgstr ""
|
1191 |
|
1192 |
+
#: wp-cache.php:1350
|
1193 |
msgid "Preload"
|
1194 |
msgstr ""
|
1195 |
|
1196 |
+
#: wp-cache.php:1350
|
1197 |
msgid "Plugins"
|
1198 |
msgstr ""
|
1199 |
|
1200 |
+
#: wp-cache.php:1350
|
1201 |
msgid "Debug"
|
1202 |
msgstr ""
|
1203 |
|
1204 |
+
#: wp-cache.php:1388
|
1205 |
msgid ""
|
1206 |
"Notice: WP Super Cache mod_rewrite rule checks disabled unless running on <a "
|
1207 |
"href=\"%s\">the main site</a> of this network."
|
1208 |
msgstr ""
|
1209 |
|
1210 |
+
#: wp-cache.php:1397
|
1211 |
msgid "Mod Rewrite Rules"
|
1212 |
msgstr ""
|
1213 |
|
1214 |
+
#: wp-cache.php:1403
|
1215 |
msgid "WordPress MU Detected"
|
1216 |
msgstr ""
|
1217 |
|
1218 |
+
#: wp-cache.php:1403
|
1219 |
msgid ""
|
1220 |
"Unfortunately, the rewrite rules cannot be updated automatically when "
|
1221 |
"running WordPress MU. Please open your .htaccess and add the following "
|
1222 |
"mod_rewrite rules above any other rules in that file."
|
1223 |
msgstr ""
|
1224 |
|
1225 |
+
#: wp-cache.php:1405
|
1226 |
msgid "Mod Rewrite rules cannot be updated!"
|
1227 |
msgstr ""
|
1228 |
|
1229 |
+
#: wp-cache.php:1406
|
1230 |
msgid ""
|
1231 |
"You must have <strong>BEGIN</strong> and <strong>END</strong> markers in %s."
|
1232 |
"htaccess for the auto update to work. They look like this and surround the "
|
1233 |
"main WordPress mod_rewrite rules:"
|
1234 |
msgstr ""
|
1235 |
|
1236 |
+
#: wp-cache.php:1408
|
1237 |
msgid "Refresh this page when you have updated your .htaccess file."
|
1238 |
msgstr ""
|
1239 |
|
1240 |
+
#: wp-cache.php:1412
|
1241 |
msgid "Thank you for upgrading."
|
1242 |
msgstr ""
|
1243 |
|
1244 |
+
#: wp-cache.php:1412
|
1245 |
msgid ""
|
1246 |
"The mod_rewrite rules changed since you last installed this plugin. "
|
1247 |
"Unfortunately, you must remove the old supercache rules before the new ones "
|
1253 |
"brave enough to use them."
|
1254 |
msgstr ""
|
1255 |
|
1256 |
+
#: wp-cache.php:1416
|
1257 |
msgid "Trailing slash check required."
|
1258 |
msgstr ""
|
1259 |
|
1260 |
+
#: wp-cache.php:1416
|
1261 |
msgid ""
|
1262 |
"It looks like your blog has URLs that end with a \"/\". Unfortunately since "
|
1263 |
"you installed this plugin a duplicate content bug has been found where URLs "
|
1266 |
"and add these two rules to the two groups of Super Cache rules:"
|
1267 |
msgstr ""
|
1268 |
|
1269 |
+
#: wp-cache.php:1418
|
1270 |
msgid ""
|
1271 |
"You can see where the rules go and examine the complete rules by clicking "
|
1272 |
"the \"View mod_rewrite rules\" link below."
|
1273 |
msgstr ""
|
1274 |
|
1275 |
+
#: wp-cache.php:1432
|
1276 |
msgid "Mod Rewrite rules updated!"
|
1277 |
msgstr ""
|
1278 |
|
1279 |
+
#: wp-cache.php:1433
|
1280 |
msgid ""
|
1281 |
"%s.htaccess has been updated with the necessary mod_rewrite rules. Please "
|
1282 |
"verify they are correct. They should look like this:"
|
1283 |
msgstr ""
|
1284 |
|
1285 |
+
#: wp-cache.php:1435
|
1286 |
msgid "Mod Rewrite rules must be updated!"
|
1287 |
msgstr ""
|
1288 |
|
1289 |
+
#: wp-cache.php:1436
|
1290 |
msgid ""
|
1291 |
"Your %s.htaccess is not writable by the webserver and must be updated with "
|
1292 |
"the necessary mod_rewrite rules. The new rules go above the regular "
|
1293 |
"WordPress rules as shown in the code below:"
|
1294 |
msgstr ""
|
1295 |
|
1296 |
+
#: wp-cache.php:1441
|
1297 |
msgid ""
|
1298 |
"WP Super Cache mod rewrite rules were detected in your %s.htaccess file.<br /"
|
1299 |
"> Click the following link to see the lines added to that file. If you have "
|
1300 |
"upgraded the plugin, make sure these rules match."
|
1301 |
msgstr ""
|
1302 |
|
1303 |
+
#: wp-cache.php:1444
|
1304 |
msgid ""
|
1305 |
"A difference between the rules in your .htaccess file and the plugin rewrite "
|
1306 |
"rules has been found. This could be simple whitespace differences, but you "
|
1308 |
"Click the ’Update Mod_Rewrite Rules’ button to update the rules."
|
1309 |
msgstr ""
|
1310 |
|
1311 |
+
#: wp-cache.php:1446
|
1312 |
msgid "View Mod_Rewrite Rules"
|
1313 |
msgstr ""
|
1314 |
|
1315 |
+
#: wp-cache.php:1452 wp-cache.php:3019
|
1316 |
msgid "Rules must be added to %s too:"
|
1317 |
msgstr ""
|
1318 |
|
1319 |
+
#: wp-cache.php:1458
|
1320 |
msgid "Gzip encoding rules in %s.htaccess created."
|
1321 |
msgstr ""
|
1322 |
|
1323 |
+
#: wp-cache.php:1464
|
1324 |
msgid "Fix Configuration"
|
1325 |
msgstr ""
|
1326 |
|
1327 |
+
#: wp-cache.php:1467
|
1328 |
msgid "Restore Default Configuration"
|
1329 |
msgstr ""
|
1330 |
|
1331 |
+
#: wp-cache.php:1475
|
1332 |
msgid ""
|
1333 |
"Comment moderation is enabled. Your comment may take some time to appear."
|
1334 |
msgstr ""
|
1335 |
|
1336 |
+
#: wp-cache.php:1500
|
1337 |
msgid "Lock Down:"
|
1338 |
msgstr ""
|
1339 |
|
1340 |
+
#: wp-cache.php:1501
|
1341 |
msgid ""
|
1342 |
"Prepare your server for an expected spike in traffic by enabling the lock "
|
1343 |
"down. When this is enabled, new comments on a post will not refresh the "
|
1344 |
"cached static files."
|
1345 |
msgstr ""
|
1346 |
|
1347 |
+
#: wp-cache.php:1502
|
1348 |
msgid ""
|
1349 |
"Developers: Make your plugin lock down compatible by checking the "
|
1350 |
"\"WPLOCKDOWN\" constant. The following code will make sure your plugin "
|
1351 |
"respects the WPLOCKDOWN setting."
|
1352 |
msgstr ""
|
1353 |
|
1354 |
+
#: wp-cache.php:1504
|
1355 |
msgid "Sorry. My blog is locked down. Updates will appear shortly"
|
1356 |
msgstr ""
|
1357 |
|
1358 |
+
#: wp-cache.php:1508
|
1359 |
msgid ""
|
1360 |
"WordPress is locked down. Super Cache static files will not be deleted when "
|
1361 |
"new comments are made."
|
1362 |
msgstr ""
|
1363 |
|
1364 |
+
#: wp-cache.php:1510
|
1365 |
msgid ""
|
1366 |
"WordPress is not locked down. New comments will refresh Super Cache static "
|
1367 |
"files as normal."
|
1368 |
msgstr ""
|
1369 |
|
1370 |
+
#: wp-cache.php:1516
|
1371 |
msgid "Lock Down"
|
1372 |
msgstr ""
|
1373 |
|
1374 |
+
#: wp-cache.php:1524
|
1375 |
msgid "Directly Cached Files"
|
1376 |
msgstr ""
|
1377 |
|
1378 |
+
#: wp-cache.php:1576
|
1379 |
msgid "Cannot delete directory"
|
1380 |
msgstr ""
|
1381 |
|
1382 |
+
#: wp-cache.php:1585
|
1383 |
msgid "%s removed!"
|
1384 |
msgstr ""
|
1385 |
|
1386 |
+
#: wp-cache.php:1593
|
1387 |
msgid ""
|
1388 |
"You must make %s writable to enable this feature. As this is a security "
|
1389 |
"risk, please make it read-only after your page is generated."
|
1390 |
msgstr ""
|
1391 |
|
1392 |
+
#: wp-cache.php:1598
|
1393 |
msgid ""
|
1394 |
"%s is writable. Please make it readonly after your page is generated as this "
|
1395 |
"is a security risk."
|
1396 |
msgstr ""
|
1397 |
|
1398 |
+
#: wp-cache.php:1613
|
1399 |
msgid "Existing direct page"
|
1400 |
msgstr ""
|
1401 |
|
1402 |
+
#: wp-cache.php:1613
|
1403 |
msgid "Delete cached file"
|
1404 |
msgstr ""
|
1405 |
|
1406 |
+
#: wp-cache.php:1618
|
1407 |
msgid "Add direct page:"
|
1408 |
msgstr ""
|
1409 |
|
1410 |
+
#: wp-cache.php:1620
|
1411 |
msgid ""
|
1412 |
"Directly cached files are files created directly off %s where your blog "
|
1413 |
"lives. This feature is only useful if you are expecting a major Digg or "
|
1414 |
"Slashdot level of traffic to one post or page."
|
1415 |
msgstr ""
|
1416 |
|
1417 |
+
#: wp-cache.php:1622
|
1418 |
msgid ""
|
1419 |
"For example: to cache <em>%1$sabout/</em>, you would enter %1$sabout/ or /"
|
1420 |
"about/. The cached file will be generated the next time an anonymous user "
|
1421 |
"visits that page."
|
1422 |
msgstr ""
|
1423 |
|
1424 |
+
#: wp-cache.php:1623
|
1425 |
msgid ""
|
1426 |
"Make the textbox blank to remove it from the list of direct pages and delete "
|
1427 |
"the cached file."
|
1428 |
msgstr ""
|
1429 |
|
1430 |
+
#: wp-cache.php:1628
|
1431 |
msgid "Update Direct Pages"
|
1432 |
msgstr ""
|
1433 |
|
1434 |
+
#: wp-cache.php:1656
|
1435 |
msgctxt "timezone date format"
|
1436 |
msgid "Y-m-d G:i:s"
|
1437 |
msgstr ""
|
1438 |
|
1439 |
+
#: wp-cache.php:1728
|
1440 |
msgid "Expiry Time & Garbage Collection"
|
1441 |
msgstr ""
|
1442 |
|
1443 |
+
#: wp-cache.php:1730
|
1444 |
msgid ""
|
1445 |
"<abbr title=\"Coordinated Universal Time\">UTC</abbr> time is <code>%s</code>"
|
1446 |
msgstr ""
|
1447 |
|
1448 |
+
#: wp-cache.php:1733
|
1449 |
msgid "Local time is <code>%1$s</code>"
|
1450 |
msgstr ""
|
1451 |
|
1452 |
+
#: wp-cache.php:1737
|
1453 |
msgid "Next scheduled garbage collection will be at <strong>%s UTC</strong>"
|
1454 |
msgstr ""
|
1455 |
|
1456 |
+
#: wp-cache.php:1741
|
1457 |
msgid ""
|
1458 |
"Warning! <strong>PRELOAD MODE</strong> activated. Supercache files will not "
|
1459 |
"be deleted regardless of age."
|
1460 |
msgstr ""
|
1461 |
|
1462 |
+
#: wp-cache.php:1759
|
1463 |
msgid "Cache Timeout"
|
1464 |
msgstr ""
|
1465 |
|
1466 |
+
#: wp-cache.php:1760 wp-cache.php:1763
|
1467 |
msgid "seconds"
|
1468 |
msgstr ""
|
1469 |
|
1470 |
+
#: wp-cache.php:1761
|
1471 |
msgid ""
|
1472 |
"How long should cached pages remain fresh? Set to 0 to disable garbage "
|
1473 |
"collection. A good starting point is 3600 seconds."
|
1474 |
msgstr ""
|
1475 |
|
1476 |
+
#: wp-cache.php:1762
|
1477 |
msgid "Scheduler"
|
1478 |
msgstr ""
|
1479 |
|
1480 |
+
#: wp-cache.php:1762
|
1481 |
msgid "Timer:"
|
1482 |
msgstr ""
|
1483 |
|
1484 |
+
#: wp-cache.php:1763
|
1485 |
msgid "Check for stale cached files every <em>interval</em> seconds."
|
1486 |
msgstr ""
|
1487 |
|
1488 |
+
#: wp-cache.php:1764
|
1489 |
msgid "Clock:"
|
1490 |
msgstr ""
|
1491 |
|
1492 |
+
#: wp-cache.php:1765
|
1493 |
msgid "HH:MM"
|
1494 |
msgstr ""
|
1495 |
|
1496 |
+
#: wp-cache.php:1765
|
1497 |
msgid ""
|
1498 |
"Check for stale cached files at this time <strong>(UTC)</strong> or starting "
|
1499 |
"at this time every <em>interval</em> below."
|
1500 |
msgstr ""
|
1501 |
|
1502 |
+
#: wp-cache.php:1767
|
1503 |
msgid "Interval:"
|
1504 |
msgstr ""
|
1505 |
|
1506 |
+
#: wp-cache.php:1773
|
1507 |
msgid "Notification Emails"
|
1508 |
msgstr ""
|
1509 |
|
1510 |
+
#: wp-cache.php:1774
|
1511 |
msgid "Email me when the garbage collection runs."
|
1512 |
msgstr ""
|
1513 |
|
1514 |
+
#: wp-cache.php:1776
|
1515 |
msgid "Garbage Collection"
|
1516 |
msgstr ""
|
1517 |
|
1518 |
+
#: wp-cache.php:1777
|
1519 |
msgid ""
|
1520 |
"<em>Garbage collection</em> is the simple act of throwing out your garbage. "
|
1521 |
"For this plugin that would be old or <em>stale</em> cached files that may be "
|
1522 |
"out of date. New cached files are described as <em>fresh</em>."
|
1523 |
msgstr ""
|
1524 |
|
1525 |
+
#: wp-cache.php:1778
|
1526 |
msgid ""
|
1527 |
"Cached files are fresh for a limited length of time. You can set that time "
|
1528 |
"in the <em>Cache Timeout</em> text box on this page."
|
1529 |
msgstr ""
|
1530 |
|
1531 |
+
#: wp-cache.php:1779
|
1532 |
msgid ""
|
1533 |
"Stale cached files are not removed as soon as they become stale. They have "
|
1534 |
"to be removed by the garbage collecter. That is why you have to tell the "
|
1535 |
"plugin when the garbage collector should run."
|
1536 |
msgstr ""
|
1537 |
|
1538 |
+
#: wp-cache.php:1780
|
1539 |
msgid ""
|
1540 |
"Use the <em>Timer</em> or <em>Clock</em> schedulers to define when the "
|
1541 |
"garbage collector should run."
|
1542 |
msgstr ""
|
1543 |
|
1544 |
+
#: wp-cache.php:1781
|
1545 |
msgid ""
|
1546 |
"The <em>Timer</em> scheduler tells the plugin to run the garbage collector "
|
1547 |
"at regular intervals. When one garbage collection is done, the next run is "
|
1548 |
"scheduled."
|
1549 |
msgstr ""
|
1550 |
|
1551 |
+
#: wp-cache.php:1782
|
1552 |
msgid ""
|
1553 |
"Or, the <em>Clock</em> scheduler allows the garbage collection to run at "
|
1554 |
"specific times. If set to run hourly or twice daily, the garbage collector "
|
1557 |
"the time specified."
|
1558 |
msgstr ""
|
1559 |
|
1560 |
+
#: wp-cache.php:1784
|
1561 |
msgid ""
|
1562 |
"There are no best garbage collection settings but here are a few scenarios. "
|
1563 |
"Garbage collection is separate to other actions that clear our cached files "
|
1564 |
"like leaving a comment or publishing a post."
|
1565 |
msgstr ""
|
1566 |
|
1567 |
+
#: wp-cache.php:1786
|
1568 |
msgid ""
|
1569 |
"Sites that want to serve lots of newly generated data should set the "
|
1570 |
"<em>Cache Timeout</em> to 60 and use the <em>Timer</em> scheduler set to 90 "
|
1571 |
"seconds."
|
1572 |
msgstr ""
|
1573 |
|
1574 |
+
#: wp-cache.php:1787
|
1575 |
msgid ""
|
1576 |
"Sites with widgets and rss feeds in their sidebar should probably use a "
|
1577 |
"timeout of 3600 seconds and set the timer to 600 seconds. Stale files will "
|
1578 |
"be caught within 10 minutes of going stale."
|
1579 |
msgstr ""
|
1580 |
|
1581 |
+
#: wp-cache.php:1788
|
1582 |
msgid ""
|
1583 |
"Sites with lots of static content, no widgets or rss feeds in their sidebar "
|
1584 |
"can use a timeout of 86400 seconds or even more and set the timer to "
|
1585 |
"something equally long."
|
1586 |
msgstr ""
|
1587 |
|
1588 |
+
#: wp-cache.php:1789
|
1589 |
msgid ""
|
1590 |
"Sites where an external data source updates at a particular time every day "
|
1591 |
"should set the timeout to 86400 seconds and use the Clock scheduler set "
|
1592 |
"appropriately."
|
1593 |
msgstr ""
|
1594 |
|
1595 |
+
#: wp-cache.php:1791
|
1596 |
msgid ""
|
1597 |
"Checking for and deleting expired files is expensive, but it’s "
|
1598 |
"expensive leaving them there too. On a very busy site, you should set the "
|
1603 |
"using mod_rewrite or PHP caching."
|
1604 |
msgstr ""
|
1605 |
|
1606 |
+
#: wp-cache.php:1792
|
1607 |
msgid "Set the expiry time to 0 seconds to disable garbage collection."
|
1608 |
msgstr ""
|
1609 |
|
1610 |
+
#: wp-cache.php:1793
|
1611 |
msgid "Change Expiration"
|
1612 |
msgstr ""
|
1613 |
|
1614 |
+
#: wp-cache.php:1837
|
1615 |
msgid "Rejected User Agents"
|
1616 |
msgstr ""
|
1617 |
|
1618 |
+
#: wp-cache.php:1838
|
1619 |
msgid ""
|
1620 |
"Strings in the HTTP ’User Agent’ header that prevent WP-Cache "
|
1621 |
"from caching bot, spiders, and crawlers’ requests. Note that super "
|
1622 |
"cached files are still sent to these agents if they already exists."
|
1623 |
msgstr ""
|
1624 |
|
1625 |
+
#: wp-cache.php:1845
|
1626 |
msgid "Save UA Strings"
|
1627 |
msgstr ""
|
1628 |
|
1629 |
+
#: wp-cache.php:1868
|
1630 |
msgid ""
|
1631 |
"Do not cache the following page types. See the <a href=\"http://codex."
|
1632 |
"wordpress.org/Conditional_Tags\">Conditional Tags</a> documentation for a "
|
1633 |
"complete discussion on each type."
|
1634 |
msgstr ""
|
1635 |
|
1636 |
+
#: wp-cache.php:1871
|
1637 |
msgid "Single Posts"
|
1638 |
msgstr ""
|
1639 |
|
1640 |
+
#: wp-cache.php:1872
|
1641 |
msgid "Pages"
|
1642 |
msgstr ""
|
1643 |
|
1644 |
+
#: wp-cache.php:1873
|
1645 |
msgid "Front Page"
|
1646 |
msgstr ""
|
1647 |
|
1648 |
+
#: wp-cache.php:1874
|
1649 |
msgid "Home"
|
1650 |
msgstr ""
|
1651 |
|
1652 |
+
#: wp-cache.php:1875
|
1653 |
msgid "Archives"
|
1654 |
msgstr ""
|
1655 |
|
1656 |
+
#: wp-cache.php:1876
|
1657 |
msgid "Tags"
|
1658 |
msgstr ""
|
1659 |
|
1660 |
+
#: wp-cache.php:1877
|
1661 |
msgid "Category"
|
1662 |
msgstr ""
|
1663 |
|
1664 |
+
#: wp-cache.php:1878
|
1665 |
msgid "Feeds"
|
1666 |
msgstr ""
|
1667 |
|
1668 |
+
#: wp-cache.php:1879
|
1669 |
msgid "Search Pages"
|
1670 |
msgstr ""
|
1671 |
|
1672 |
+
#: wp-cache.php:1880
|
1673 |
msgid "Author Pages"
|
1674 |
msgstr ""
|
1675 |
|
1676 |
+
#: wp-cache.php:1882 wp-cache.php:1996
|
1677 |
msgid "Save"
|
1678 |
msgstr ""
|
1679 |
|
1680 |
+
#: wp-cache.php:1899
|
1681 |
msgid ""
|
1682 |
"Add here strings (not a filename) that forces a page not to be cached. For "
|
1683 |
"example, if your URLs include year and you dont want to cache last year "
|
1686 |
"cache that page."
|
1687 |
msgstr ""
|
1688 |
|
1689 |
+
#: wp-cache.php:1905
|
1690 |
msgid "Save Strings"
|
1691 |
msgstr ""
|
1692 |
|
1693 |
+
#: wp-cache.php:1921
|
1694 |
msgid ""
|
1695 |
"Add here those filenames that can be cached, even if they match one of the "
|
1696 |
"rejected substring specified above."
|
1697 |
msgstr ""
|
1698 |
|
1699 |
+
#: wp-cache.php:1927
|
1700 |
msgid "Save Files"
|
1701 |
msgstr ""
|
1702 |
|
1703 |
+
#: wp-cache.php:1970
|
1704 |
msgid "Currently logging to: %s"
|
1705 |
msgstr ""
|
1706 |
|
1707 |
+
#: wp-cache.php:1973
|
1708 |
msgid ""
|
1709 |
"Fix problems with the plugin by debugging it here. It can log them to a file "
|
1710 |
"in your cache directory."
|
1711 |
msgstr ""
|
1712 |
|
1713 |
+
#: wp-cache.php:1977
|
1714 |
msgid "Debugging"
|
1715 |
msgstr ""
|
1716 |
|
1717 |
+
#: wp-cache.php:1978
|
1718 |
msgid "IP Address"
|
1719 |
msgstr ""
|
1720 |
|
1721 |
+
#: wp-cache.php:1978
|
1722 |
msgid "(only log requests from this IP address. Your IP is %s)"
|
1723 |
msgstr ""
|
1724 |
|
1725 |
+
#: wp-cache.php:1979
|
1726 |
msgid "Cache Status Messages"
|
1727 |
msgstr ""
|
1728 |
|
1729 |
+
#: wp-cache.php:1980
|
1730 |
msgid "Display comments at the end of every page like this:"
|
1731 |
msgstr ""
|
1732 |
|
1733 |
+
#: wp-cache.php:1986
|
1734 |
msgid ""
|
1735 |
"In very rare cases two problems may arise on some blogs:<ol><li> The front "
|
1736 |
"page may start downloading as a zip file.</li><li> The wrong page is "
|
1738 |
"and the permalink structure is <em>/%category%/%postname%/</em>.</li></ol>"
|
1739 |
msgstr ""
|
1740 |
|
1741 |
+
#: wp-cache.php:1987
|
1742 |
msgid ""
|
1743 |
"I’m 99% certain that they aren’t bugs in WP Super Cache and they "
|
1744 |
"only happen in very rare cases but you can run a simple check once every 5 "
|
1746 |
"emailed if there is a problem."
|
1747 |
msgstr ""
|
1748 |
|
1749 |
+
#: wp-cache.php:1989
|
1750 |
msgid "Check front page every 5 minutes."
|
1751 |
msgstr ""
|
1752 |
|
1753 |
+
#: wp-cache.php:1990
|
1754 |
msgid "Front page text"
|
1755 |
msgstr ""
|
1756 |
|
1757 |
+
#: wp-cache.php:1990
|
1758 |
msgid ""
|
1759 |
"Text to search for on your front page. If this text is missing, the cache "
|
1760 |
"will be cleared. Leave blank to disable."
|
1761 |
msgstr ""
|
1762 |
|
1763 |
+
#: wp-cache.php:1991
|
1764 |
msgid "Clear cache on error."
|
1765 |
msgstr ""
|
1766 |
|
1767 |
+
#: wp-cache.php:1992
|
1768 |
msgid "Email the blog admin when checks are made. (useful for testing)"
|
1769 |
msgstr ""
|
1770 |
|
1771 |
+
#: wp-cache.php:2006
|
1772 |
msgid ""
|
1773 |
"Error: GZIP compression is enabled. Disable it if you want to enable wp-"
|
1774 |
"cache."
|
1775 |
msgstr ""
|
1776 |
|
1777 |
+
#: wp-cache.php:2056 wp-cache.php:2355 wp-cache.php:2391
|
1778 |
msgid "Warning"
|
1779 |
msgstr ""
|
1780 |
|
1781 |
+
#: wp-cache.php:2056
|
1782 |
msgid ""
|
1783 |
"GZIP compression is enabled in WordPress, wp-cache will be bypassed until "
|
1784 |
"you disable gzip compression."
|
1785 |
msgstr ""
|
1786 |
|
1787 |
+
#: wp-cache.php:2153 wp-cache.php:2159
|
1788 |
msgid "WP Super Cache Warning!"
|
1789 |
msgstr ""
|
1790 |
|
1791 |
+
#: wp-cache.php:2154
|
1792 |
msgid ""
|
1793 |
"All users of this site have been logged out to refresh their login cookies."
|
1794 |
msgstr ""
|
1795 |
|
1796 |
+
#: wp-cache.php:2160
|
1797 |
msgid ""
|
1798 |
"Your server is configured to show files and directories, which may expose "
|
1799 |
"sensitive data such as login cookies to attackers in the cache directories. "
|
1802 |
"directory on the Advanced Settings page."
|
1803 |
msgstr ""
|
1804 |
|
1805 |
+
#: wp-cache.php:2162
|
1806 |
msgid ""
|
1807 |
"If you just installed WP Super Cache for the first time, you can dismiss "
|
1808 |
"this message. Otherwise, you should probably refresh the login cookies of "
|
1809 |
"all logged in WordPress users here by clicking the logout link below."
|
1810 |
msgstr ""
|
1811 |
|
1812 |
+
#: wp-cache.php:2165
|
1813 |
msgid ""
|
1814 |
"Your site is using a very old version of WordPress. When you update to the "
|
1815 |
"latest version everyone will be logged out and cookie information updated."
|
1816 |
msgstr ""
|
1817 |
|
1818 |
+
#: wp-cache.php:2167
|
1819 |
msgid ""
|
1820 |
"The logout link will log out all WordPress users on this site except you. "
|
1821 |
"Your authentication cookie will be updated, but you will not be logged out."
|
1822 |
msgstr ""
|
1823 |
|
1824 |
+
#: wp-cache.php:2171
|
1825 |
msgid "Logout"
|
1826 |
msgstr ""
|
1827 |
|
1828 |
+
#: wp-cache.php:2275 wp-cache.php:2280 wp-cache.php:2314 wp-cache.php:2319
|
1829 |
+
#: wp-cache.php:2325
|
1830 |
msgid "Error"
|
1831 |
msgstr ""
|
1832 |
|
1833 |
+
#: wp-cache.php:2275
|
1834 |
msgid ""
|
1835 |
"Your cache directory (<strong>%1$s</strong>) did not exist and couldn’"
|
1836 |
"t be created by the web server. Check %1$s permissions."
|
1837 |
msgstr ""
|
1838 |
|
1839 |
+
#: wp-cache.php:2280
|
1840 |
msgid ""
|
1841 |
"Your cache directory (<strong>%1$s</strong>) or <strong>%2$s</strong> need "
|
1842 |
"to be writable for this plugin to work. Double-check it."
|
1843 |
msgstr ""
|
1844 |
|
1845 |
+
#: wp-cache.php:2314
|
1846 |
msgid ""
|
1847 |
"Your WP-Cache config file (<strong>%s</strong>) is out of date and not "
|
1848 |
"writable by the Web server. Please delete it and refresh this page."
|
1849 |
msgstr ""
|
1850 |
|
1851 |
+
#: wp-cache.php:2319
|
1852 |
msgid ""
|
1853 |
"Configuration file missing and %1$s directory (<strong>%2$s</strong>) is "
|
1854 |
"not writable by the web server. Check its permissions."
|
1855 |
msgstr ""
|
1856 |
|
1857 |
+
#: wp-cache.php:2325
|
1858 |
msgid ""
|
1859 |
"Sample WP-Cache config file (<strong>%s</strong>) does not exist. Verify "
|
1860 |
"your installation."
|
1861 |
msgstr ""
|
1862 |
|
1863 |
+
#: wp-cache.php:2355
|
1864 |
msgid "Could not update %s!</em> WPCACHEHOME must be set in config file."
|
1865 |
msgstr ""
|
1866 |
|
1867 |
+
#: wp-cache.php:2391
|
1868 |
msgid "%s/advanced-cache.php</em> does not exist or cannot be updated."
|
1869 |
msgstr ""
|
1870 |
|
1871 |
+
#: wp-cache.php:2392
|
1872 |
msgid "1. If it already exists, please delete the file first."
|
1873 |
msgstr ""
|
1874 |
|
1875 |
+
#: wp-cache.php:2393
|
1876 |
msgid ""
|
1877 |
"2. Make %1$s writable using the chmod command through your ftp or server "
|
1878 |
"software. (<em>chmod 777 %1$s</em>) and refresh this page. This is only a "
|
1880 |
"again. (Change 777 to 755 in the previous command)"
|
1881 |
msgstr ""
|
1882 |
|
1883 |
+
#: wp-cache.php:2394
|
1884 |
msgid "3. Refresh this page to update <em>%s/advanced-cache.php</em>"
|
1885 |
msgstr ""
|
1886 |
|
1887 |
+
#: wp-cache.php:2395
|
1888 |
msgid ""
|
1889 |
"If that doesn’t work, make sure the file <em>%s/advanced-cache.php</"
|
1890 |
"em> doesn’t exist:"
|
1891 |
msgstr ""
|
1892 |
|
1893 |
+
#: wp-cache.php:2396
|
1894 |
msgid ""
|
1895 |
"<li>1. Open <em>%1$s$wp_cache_file</em> in a text editor.</li><li>2. Change "
|
1896 |
"the text <em>CACHEHOME</em> to <em>%2$s</em></li><li>3. Save the file and "
|
1897 |
"copy it to <em>%3$s</em> and refresh this page.</li>"
|
1898 |
msgstr ""
|
1899 |
|
1900 |
+
#: wp-cache.php:2419
|
1901 |
msgid ""
|
1902 |
"<h3>WP_CACHE constant set to false</h3><p>The WP_CACHE constant is used by "
|
1903 |
"WordPress to load the code that serves cached pages. Unfortunately, it is "
|
1906 |
"('WP_CACHE', true);</code></p>"
|
1907 |
msgstr ""
|
1908 |
|
1909 |
+
#: wp-cache.php:2421
|
1910 |
msgid ""
|
1911 |
"<strong>Error: WP_CACHE is not enabled</strong> in your <code>wp-config.php</"
|
1912 |
"code> file and I couldn’t modify it."
|
1913 |
msgstr ""
|
1914 |
|
1915 |
+
#: wp-cache.php:2422
|
1916 |
msgid ""
|
1917 |
"Edit <code>%s</code> and add the following line:<br /> <code>define"
|
1918 |
"('WP_CACHE', true);</code><br />Otherwise, <strong>WP-Cache will not be "
|
1919 |
"executed</strong> by WordPress core. "
|
1920 |
msgstr ""
|
1921 |
|
1922 |
+
#: wp-cache.php:2426
|
1923 |
msgid ""
|
1924 |
"<h3>WP_CACHE constant added to wp-config.php</h3><p>If you continue to see "
|
1925 |
"this warning message please see point 5 of the <a href=\"http://wordpress."
|
1927 |
"line must be moved up."
|
1928 |
msgstr ""
|
1929 |
|
1930 |
+
#: wp-cache.php:2454
|
1931 |
msgid "Cache Contents"
|
1932 |
msgstr ""
|
1933 |
|
1934 |
+
#: wp-cache.php:2457
|
1935 |
msgid "Object cache in use. No cache listing available."
|
1936 |
msgstr ""
|
1937 |
|
1938 |
+
#: wp-cache.php:2481
|
1939 |
msgid "Deleting supercache file: <strong>%s</strong><br />"
|
1940 |
msgstr ""
|
1941 |
|
1942 |
+
#: wp-cache.php:2502
|
1943 |
msgid "Deleting wp-cache file: <strong>%s</strong><br />"
|
1944 |
msgstr ""
|
1945 |
|
1946 |
+
#: wp-cache.php:2569
|
1947 |
msgid ""
|
1948 |
"Cache stats are not automatically generated. You must click the link below "
|
1949 |
"to regenerate the stats on this page."
|
1950 |
msgstr ""
|
1951 |
|
1952 |
+
#: wp-cache.php:2570
|
1953 |
msgid "Regenerate cache stats"
|
1954 |
msgstr ""
|
1955 |
|
1956 |
+
#: wp-cache.php:2572
|
1957 |
msgid "Cache stats last generated: %s minutes ago."
|
1958 |
msgstr ""
|
1959 |
|
1960 |
+
#: wp-cache.php:2578
|
1961 |
msgid "WP-Cache"
|
1962 |
msgstr ""
|
1963 |
|
1964 |
+
#: wp-cache.php:2579 wp-cache.php:2594
|
1965 |
msgid "%s Cached Pages"
|
1966 |
msgstr ""
|
1967 |
|
1968 |
+
#: wp-cache.php:2580 wp-cache.php:2599
|
1969 |
msgid "%s Expired Pages"
|
1970 |
msgstr ""
|
1971 |
|
1972 |
+
#: wp-cache.php:2593
|
1973 |
msgid "WP-Super-Cache"
|
1974 |
msgstr ""
|
1975 |
|
1976 |
+
#: wp-cache.php:2603
|
1977 |
msgid "Fresh WP-Cached Files"
|
1978 |
msgstr ""
|
1979 |
|
1980 |
+
#: wp-cache.php:2604 wp-cache.php:2620 wp-cache.php:2636 wp-cache.php:2652
|
1981 |
msgid "URI"
|
1982 |
msgstr ""
|
1983 |
|
1984 |
+
#: wp-cache.php:2604 wp-cache.php:2620
|
1985 |
msgid "Key"
|
1986 |
msgstr ""
|
1987 |
|
1988 |
+
#: wp-cache.php:2604 wp-cache.php:2620 wp-cache.php:2636 wp-cache.php:2652
|
1989 |
msgid "Age"
|
1990 |
msgstr ""
|
1991 |
|
1992 |
+
#: wp-cache.php:2604 wp-cache.php:2620 wp-cache.php:2636 wp-cache.php:2652
|
1993 |
msgid "Delete"
|
1994 |
msgstr ""
|
1995 |
|
1996 |
+
#: wp-cache.php:2619
|
1997 |
msgid "Stale WP-Cached Files"
|
1998 |
msgstr ""
|
1999 |
|
2000 |
+
#: wp-cache.php:2635
|
2001 |
msgid "Fresh Super Cached Files"
|
2002 |
msgstr ""
|
2003 |
|
2004 |
+
#: wp-cache.php:2651
|
2005 |
msgid "Stale Super Cached Files"
|
2006 |
msgstr ""
|
2007 |
|
2008 |
+
#: wp-cache.php:2667
|
2009 |
msgid "Hide file list"
|
2010 |
msgstr ""
|
2011 |
|
2012 |
+
#: wp-cache.php:2669
|
2013 |
msgid "Too many cached files, no listing possible."
|
2014 |
msgstr ""
|
2015 |
|
2016 |
+
#: wp-cache.php:2671
|
2017 |
msgid "List all cached files"
|
2018 |
msgstr ""
|
2019 |
|
2020 |
+
#: wp-cache.php:2674
|
2021 |
msgid ""
|
2022 |
"Expired files are files older than %s seconds. They are still used by the "
|
2023 |
"plugin and are deleted periodically."
|
2024 |
msgstr ""
|
2025 |
|
2026 |
+
#: wp-cache.php:2685
|
2027 |
msgid "Delete Expired"
|
2028 |
msgstr ""
|
2029 |
|
2030 |
+
#: wp-cache.php:2710
|
2031 |
msgid "Delete Super Cache cached files (opens in new window)"
|
2032 |
msgstr ""
|
2033 |
|
2034 |
+
#: wp-cache.php:2877
|
2035 |
msgid "%1$s is Stephen Fry proof thanks to caching by %2$s"
|
2036 |
msgstr ""
|
2037 |
|
2038 |
+
#: wp-cache.php:2910
|
2039 |
msgid ""
|
2040 |
"WP Super Cache must be configured. Go to <a href=\"%s\">the admin page</a> "
|
2041 |
"to enable and configure the plugin."
|
2042 |
msgstr ""
|
2043 |
|
2044 |
+
#: wp-cache.php:2916
|
2045 |
msgid "Settings"
|
2046 |
msgstr ""
|
2047 |
|
2048 |
+
#: wp-cache.php:2926
|
2049 |
msgid ""
|
2050 |
"WP Super Cache is disabled. Please go to the <a href=\"%s\">plugin admin "
|
2051 |
"page</a> to enable caching."
|
2052 |
msgstr ""
|
2053 |
|
2054 |
+
#: wp-cache.php:2929
|
2055 |
msgid ""
|
2056 |
"Warning! WP Super Cache caching <strong>was</strong> broken but has been "
|
2057 |
"<strong>fixed</strong>! The script advanced-cache.php could not load wp-"
|
2060 |
"message."
|
2061 |
msgstr ""
|
2062 |
|
2063 |
+
#: wp-cache.php:2950
|
2064 |
msgid "[%s] Front page is gzipped! Please clear cache!"
|
2065 |
msgstr ""
|
2066 |
|
2067 |
+
#: wp-cache.php:2950
|
2068 |
msgid ""
|
2069 |
"Please visit %s to clear the cache as the front page of your site is now "
|
2070 |
"downloading!"
|
2071 |
msgstr ""
|
2072 |
|
2073 |
+
#: wp-cache.php:2953
|
2074 |
msgid "[%s] Front page is gzipped! Cache Cleared!"
|
2075 |
msgstr ""
|
2076 |
|
2077 |
+
#: wp-cache.php:2953
|
2078 |
msgid ""
|
2079 |
"The cache on your blog has been cleared because the front page of your site "
|
2080 |
"is now downloading. Please visit %s to verify the cache has been cleared."
|
2081 |
msgstr ""
|
2082 |
|
2083 |
+
#: wp-cache.php:2960
|
2084 |
msgid "[%s] Front page is not correct! Please clear cache!"
|
2085 |
msgstr ""
|
2086 |
|
2087 |
+
#: wp-cache.php:2960
|
2088 |
msgid ""
|
2089 |
"Please visit %1$s to clear the cache as the front page of your site is not "
|
2090 |
"correct and missing the text, \"%2$s\"!"
|
2091 |
msgstr ""
|
2092 |
|
2093 |
+
#: wp-cache.php:2963
|
2094 |
msgid "[%s] Front page is not correct! Cache Cleared!"
|
2095 |
msgstr ""
|
2096 |
|
2097 |
+
#: wp-cache.php:2963
|
2098 |
msgid ""
|
2099 |
"The cache on your blog has been cleared because the front page of your site "
|
2100 |
"is missing the text \"%2$s\". Please visit %1$s to verify the cache has been "
|
2101 |
"cleared."
|
2102 |
msgstr ""
|
2103 |
|
2104 |
+
#: wp-cache.php:2968
|
2105 |
msgid "[%s] Front page check!"
|
2106 |
msgstr ""
|
2107 |
|
2108 |
+
#: wp-cache.php:2968
|
2109 |
msgid ""
|
2110 |
"WP Super Cache has checked the front page of your blog. Please visit %s if "
|
2111 |
"you would like to disable this."
|
2112 |
msgstr ""
|
2113 |
|
2114 |
+
#: wp-cache.php:3011
|
2115 |
msgid "Cannot update .htaccess"
|
2116 |
msgstr ""
|
2117 |
|
2118 |
+
#: wp-cache.php:3011
|
2119 |
msgid ""
|
2120 |
"The file <code>%s.htaccess</code> cannot be modified by the web server. "
|
2121 |
"Please correct this using the chmod command or your ftp client."
|
2122 |
msgstr ""
|
2123 |
|
2124 |
+
#: wp-cache.php:3011
|
2125 |
msgid "Refresh this page when the file permissions have been modified."
|
2126 |
msgstr ""
|
2127 |
|
2128 |
+
#: wp-cache.php:3011
|
2129 |
msgid ""
|
2130 |
"Alternatively, you can edit your <code>%s.htaccess</code> file manually and "
|
2131 |
"add the following code (before any WordPress rules):"
|
2132 |
msgstr ""
|
2133 |
|
2134 |
+
#: wp-cache.php:3015
|
2135 |
msgid ""
|
2136 |
"To serve static html files your server must have the correct mod_rewrite "
|
2137 |
"rules added to a file called <code>%s.htaccess</code>"
|
2138 |
msgstr ""
|
2139 |
|
2140 |
+
#: wp-cache.php:3016
|
2141 |
msgid "You can edit the file yourself. Add the following rules."
|
2142 |
msgstr ""
|
2143 |
|
2144 |
+
#: wp-cache.php:3017
|
2145 |
msgid " Make sure they appear before any existing WordPress rules. "
|
2146 |
msgstr ""
|
2147 |
|
2148 |
+
#: wp-cache.php:3025
|
2149 |
msgid "Update Mod_Rewrite Rules"
|
2150 |
msgstr ""
|
2151 |
|
2152 |
+
#: wp-cache.php:3188
|
2153 |
msgid "[%1$s] Cache Preload Started"
|
2154 |
msgstr ""
|
2155 |
|
2156 |
+
#: wp-cache.php:3218
|
2157 |
msgid "[%1$s] Refreshing %2$s taxonomy from %3$d to %4$d"
|
2158 |
msgstr ""
|
2159 |
|
2160 |
+
#: wp-cache.php:3267
|
2161 |
msgid "[%1$s] Refreshing posts from %2$d to %3$d"
|
2162 |
msgstr ""
|
2163 |
|
2164 |
+
#: wp-cache.php:3288
|
2165 |
msgid "[%1$s] Cache Preload Stopped"
|
2166 |
msgstr ""
|
2167 |
|
2168 |
+
#: wp-cache.php:3298
|
2169 |
msgid "[%1$s] %2$d posts refreshed"
|
2170 |
msgstr ""
|
2171 |
|
2172 |
+
#: wp-cache.php:3298
|
2173 |
msgid "Refreshed the following posts:"
|
2174 |
msgstr ""
|
2175 |
|
2176 |
+
#: wp-cache.php:3308
|
2177 |
msgid "Scheduling next preload refresh in %d minutes."
|
2178 |
msgstr ""
|
2179 |
|
2180 |
+
#: wp-cache.php:3319
|
2181 |
msgid "[%s] Cache Preload Completed"
|
2182 |
msgstr ""
|
2183 |
|
2184 |
+
#: wp-cache.php:3319
|
2185 |
msgid "Cleaning up old supercache files."
|
2186 |
msgstr ""
|
2187 |
|
2188 |
+
#: wp-cache.php:3361
|
2189 |
msgid "[%s] Preload may have stalled."
|
2190 |
msgstr ""
|
2191 |
|
2192 |
+
#: wp-cache.php:3361
|
2193 |
msgid ""
|
2194 |
"Preload has been restarted.\n"
|
2195 |
"%s"
|
2196 |
msgstr ""
|
2197 |
|
2198 |
+
#: wp-cache.php:3404
|
2199 |
msgid "Supercache Uninstall Problems"
|
2200 |
msgstr ""
|
2201 |
|
2202 |
+
#: wp-cache.php:3404
|
2203 |
msgid ""
|
2204 |
"Dear User,\n"
|
2205 |
"\n"
|
2217 |
"http://wordpress.org/plugins/wp-super-cache/"
|
2218 |
msgstr ""
|
2219 |
|
2220 |
+
#: wp-cache.php:3441
|
2221 |
msgid "Delete cache of the current page"
|
2222 |
msgstr ""
|
2223 |
|