Version Description
Download this release
Release Info
| Developer | donncha |
| Plugin | |
| Version | 0.6.4 |
| Comparing to | |
| See all releases | |
Code changes from version 0.6.3 to 0.6.4
- Changelog.txt +35 -0
- readme.txt +4 -2
- wp-cache-phase1.php +3 -1
- wp-cache-phase2.php +13 -12
- wp-cache.php +6 -5
Changelog.txt
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
2008-04-24 19:14 donncha
|
| 2 |
|
| 3 |
* readme.txt: Added changelog link
|
| 1 |
+
2008-05-14 12:21 donncha
|
| 2 |
+
|
| 3 |
+
* wp-cache-phase2.php: Clean up the supercache if no post_id is
|
| 4 |
+
defined
|
| 5 |
+
|
| 6 |
+
2008-05-14 12:11 donncha
|
| 7 |
+
|
| 8 |
+
* wp-cache.php: Move menu code up
|
| 9 |
+
|
| 10 |
+
2008-05-13 14:57 donncha
|
| 11 |
+
|
| 12 |
+
* wp-cache-phase2.php: Only prune files in the supercache directory
|
| 13 |
+
Remove expired files 1/500's of the time
|
| 14 |
+
|
| 15 |
+
2008-05-11 08:51 donncha
|
| 16 |
+
|
| 17 |
+
* wp-cache.php: Allow the "digg proof" message to be styled
|
| 18 |
+
Removed whitespace
|
| 19 |
+
|
| 20 |
+
2008-05-05 09:49 donncha
|
| 21 |
+
|
| 22 |
+
* wp-cache-phase1.php: Removed Last-Modified header so plugin works
|
| 23 |
+
on godaddy servers. props Brad @
|
| 24 |
+
http://www.littleredrails.com/blog/2007/09/08/using-wp-cache-on-godaddy-500-error/
|
| 25 |
+
|
| 26 |
+
2008-05-05 09:44 donncha
|
| 27 |
+
|
| 28 |
+
* readme.txt, wp-cache.php: Added rewrite rules to stop POST
|
| 29 |
+
requests to html static files. props eharris @
|
| 30 |
+
http://wordpress.org/support/topic/173972?replies=2
|
| 31 |
+
|
| 32 |
+
2008-04-24 19:14 donncha
|
| 33 |
+
|
| 34 |
+
* Changelog.txt: Update Changelog
|
| 35 |
+
|
| 36 |
2008-04-24 19:14 donncha
|
| 37 |
|
| 38 |
* readme.txt: Added changelog link
|
readme.txt
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
=== WP Super Cache ===
|
| 2 |
Contributors: donncha
|
| 3 |
Tags: performance,caching,wp-cache
|
| 4 |
-
Tested up to: 2.5
|
| 5 |
-
Stable tag: 0.6.
|
| 6 |
Requires at least: 2.2
|
| 7 |
|
| 8 |
A very fast caching engine for WordPress that produces static html files.
|
|
@@ -38,6 +38,7 @@ The [changelog](http://svn.wp-plugins.org/wp-super-cache/trunk/Changelog.txt) is
|
|
| 38 |
`RewriteEngine On`
|
| 39 |
`RewriteBase /`
|
| 40 |
|
|
|
|
| 41 |
`RewriteCond %{QUERY_STRING} !.*s=.*`
|
| 42 |
`RewriteCond %{QUERY_STRING} !.*attachment_id=.*`
|
| 43 |
`RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$`
|
|
@@ -45,6 +46,7 @@ The [changelog](http://svn.wp-plugins.org/wp-super-cache/trunk/Changelog.txt) is
|
|
| 45 |
`RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f`
|
| 46 |
`RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz [L]`
|
| 47 |
|
|
|
|
| 48 |
`RewriteCond %{QUERY_STRING} !.*s=.*`
|
| 49 |
`RewriteCond %{QUERY_STRING} !.*attachment_id=.*`
|
| 50 |
`RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$`
|
| 1 |
=== WP Super Cache ===
|
| 2 |
Contributors: donncha
|
| 3 |
Tags: performance,caching,wp-cache
|
| 4 |
+
Tested up to: 2.5.1
|
| 5 |
+
Stable tag: 0.6.4
|
| 6 |
Requires at least: 2.2
|
| 7 |
|
| 8 |
A very fast caching engine for WordPress that produces static html files.
|
| 38 |
`RewriteEngine On`
|
| 39 |
`RewriteBase /`
|
| 40 |
|
| 41 |
+
`RewriteCond %{REQUEST_METHOD} !=POST`
|
| 42 |
`RewriteCond %{QUERY_STRING} !.*s=.*`
|
| 43 |
`RewriteCond %{QUERY_STRING} !.*attachment_id=.*`
|
| 44 |
`RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$`
|
| 46 |
`RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f`
|
| 47 |
`RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz [L]`
|
| 48 |
|
| 49 |
+
`RewriteCond %{REQUEST_METHOD} !=POST`
|
| 50 |
`RewriteCond %{QUERY_STRING} !.*s=.*`
|
| 51 |
`RewriteCond %{QUERY_STRING} !.*attachment_id=.*`
|
| 52 |
`RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$`
|
wp-cache-phase1.php
CHANGED
|
@@ -56,7 +56,9 @@ if( ($mtime = @filemtime($meta_pathname)) ) {
|
|
| 56 |
if (! ($meta = unserialize(@file_get_contents($meta_pathname))) )
|
| 57 |
return;
|
| 58 |
foreach ($meta->headers as $header) {
|
| 59 |
-
|
|
|
|
|
|
|
| 60 |
}
|
| 61 |
if ( !($content_size = @filesize($cache_file)) > 0 || $mtime < @filemtime($cache_file))
|
| 62 |
return;
|
| 56 |
if (! ($meta = unserialize(@file_get_contents($meta_pathname))) )
|
| 57 |
return;
|
| 58 |
foreach ($meta->headers as $header) {
|
| 59 |
+
// godaddy fix, via http://blog.gneu.org/2008/05/wp-supercache-on-godaddy/ and http://www.littleredrails.com/blog/2007/09/08/using-wp-cache-on-godaddy-500-error/
|
| 60 |
+
if( strpos( $header, 'Last-Modified:' ) === false )
|
| 61 |
+
header($header);
|
| 62 |
}
|
| 63 |
if ( !($content_size = @filesize($cache_file)) > 0 || $mtime < @filemtime($cache_file))
|
| 64 |
return;
|
wp-cache-phase2.php
CHANGED
|
@@ -299,12 +299,11 @@ function wp_cache_phase2_clean_expired($file_prefix) {
|
|
| 299 |
if( is_dir( $cache_path . $file ) == false && (filemtime($cache_path . $file) + $cache_max_time) <= $now ) {
|
| 300 |
if( substr( $file, -9 ) != '.htaccess' )
|
| 301 |
@unlink($cache_path . $file);
|
| 302 |
-
} elseif( is_dir( $cache_path . $file ) ) {
|
| 303 |
-
prune_super_cache( $cache_path . $file );
|
| 304 |
}
|
| 305 |
}
|
| 306 |
}
|
| 307 |
closedir($handle);
|
|
|
|
| 308 |
}
|
| 309 |
|
| 310 |
wp_cache_writers_exit();
|
|
@@ -382,9 +381,8 @@ function wp_cache_shutdown_callback() {
|
|
| 382 |
wp_cache_writers_exit();
|
| 383 |
}
|
| 384 |
|
| 385 |
-
if (
|
| 386 |
return;
|
| 387 |
-
}
|
| 388 |
|
| 389 |
// we delete expired files
|
| 390 |
flush(); //Ensure we send data to the client
|
|
@@ -420,18 +418,21 @@ function wp_cache_post_change($post_id) {
|
|
| 420 |
global $file_prefix, $cache_path, $blog_id, $blogcacheid, $super_cache_enabled;
|
| 421 |
static $last_processed = -1;
|
| 422 |
|
| 423 |
-
// Avoid cleaning twice the same pages
|
| 424 |
if ($post_id == $last_processed) return $post_id;
|
| 425 |
$last_processed = $post_id;
|
| 426 |
$permalink = trailingslashit( str_replace( get_option( 'siteurl' ), '', post_permalink( $post_id ) ) );
|
| 427 |
if( $super_cache_enabled ) {
|
| 428 |
-
$
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 435 |
}
|
| 436 |
}
|
| 437 |
|
| 299 |
if( is_dir( $cache_path . $file ) == false && (filemtime($cache_path . $file) + $cache_max_time) <= $now ) {
|
| 300 |
if( substr( $file, -9 ) != '.htaccess' )
|
| 301 |
@unlink($cache_path . $file);
|
|
|
|
|
|
|
| 302 |
}
|
| 303 |
}
|
| 304 |
}
|
| 305 |
closedir($handle);
|
| 306 |
+
prune_super_cache( $cache_path . 'supercache' );
|
| 307 |
}
|
| 308 |
|
| 309 |
wp_cache_writers_exit();
|
| 381 |
wp_cache_writers_exit();
|
| 382 |
}
|
| 383 |
|
| 384 |
+
if( mt_rand( 0, 500 ) != 1 )
|
| 385 |
return;
|
|
|
|
| 386 |
|
| 387 |
// we delete expired files
|
| 388 |
flush(); //Ensure we send data to the client
|
| 418 |
global $file_prefix, $cache_path, $blog_id, $blogcacheid, $super_cache_enabled;
|
| 419 |
static $last_processed = -1;
|
| 420 |
|
|
|
|
| 421 |
if ($post_id == $last_processed) return $post_id;
|
| 422 |
$last_processed = $post_id;
|
| 423 |
$permalink = trailingslashit( str_replace( get_option( 'siteurl' ), '', post_permalink( $post_id ) ) );
|
| 424 |
if( $super_cache_enabled ) {
|
| 425 |
+
$siteurl = strtolower( preg_replace( '/:.*$/', '', str_replace( 'http://', '', get_option( 'siteurl' ) ) ) );
|
| 426 |
+
if( $post_id == 0 ) {
|
| 427 |
+
prune_super_cache( $cache_path . 'supercache/' . $siteurl );
|
| 428 |
+
} else {
|
| 429 |
+
$permalink = trailingslashit( str_replace( get_option( 'siteurl' ), '', post_permalink( $post_id ) ) );
|
| 430 |
+
$dir = $cache_path . 'supercache/' . $siteurl;
|
| 431 |
+
$files_to_delete = array( $dir . '/index.html', $dir . '/feed/index.html', $dir . $permalink . 'index.html', $dir . $permalink . 'feed/index.html' );
|
| 432 |
+
foreach( $files_to_delete as $cache_file ) {
|
| 433 |
+
@unlink( $cache_file );
|
| 434 |
+
@unlink( $cache_file . '.gz' );
|
| 435 |
+
}
|
| 436 |
}
|
| 437 |
}
|
| 438 |
|
wp-cache.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Plugin Name: WP Super Cache
|
| 4 |
Plugin URI: http://ocaoimh.ie/wp-super-cache/
|
| 5 |
Description: Very fast caching module for WordPress. Once enabled, you must <a href="options-general.php?page=wp-super-cache/wp-cache.php">enable the cache</a>. Based on WP-Cache by <a href="http://mnm.uib.es/gallir/">Ricardo Galli Granada</a>.
|
| 6 |
-
Version: 0.6.
|
| 7 |
Author: Donncha O Caoimh
|
| 8 |
Author URI: http://ocaoimh.ie/
|
| 9 |
*/
|
|
@@ -63,6 +63,7 @@ function wp_cache_add_pages() {
|
|
| 63 |
add_options_page('WP Super Cache', 'WP Super Cache', 'manage_options', __FILE__, 'wp_cache_manager');
|
| 64 |
}
|
| 65 |
}
|
|
|
|
| 66 |
|
| 67 |
function wp_cache_manager() {
|
| 68 |
global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world;
|
|
@@ -96,7 +97,7 @@ function toggleLayer( whichLayer ) {
|
|
| 96 |
// -->
|
| 97 |
</script>
|
| 98 |
<?php
|
| 99 |
-
|
| 100 |
echo "<h2>WP Super Cache Manager</h2>\n";
|
| 101 |
if( ini_get( 'safe_mode' ) ) {
|
| 102 |
?><h3>Warning! PHP safe mode enabled!</h3>
|
|
@@ -236,6 +237,7 @@ function toggleLayer( whichLayer ) {
|
|
| 236 |
$rules .= "RewriteBase $home_root\n"; // props Chris Messina
|
| 237 |
$charset = get_option('blog_charset') == '' ? 'UTF-8' : get_option('blog_charset');
|
| 238 |
$rules .= "AddDefaultCharset {$charset}\n";
|
|
|
|
| 239 |
$rules .= "RewriteCond %{QUERY_STRING} !.*s=.*\n";
|
| 240 |
$rules .= "RewriteCond %{QUERY_STRING} !.*attachment_id=.*\n";
|
| 241 |
$rules .= "RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$\n";
|
|
@@ -243,6 +245,7 @@ function toggleLayer( whichLayer ) {
|
|
| 243 |
$rules .= "RewriteCond %{DOCUMENT_ROOT}{$home_root}wp-content/cache/supercache/%{HTTP_HOST}{$home_root}$1/index.html.gz -f\n";
|
| 244 |
$rules .= "RewriteRule ^(.*) {$home_root}wp-content/cache/supercache/%{HTTP_HOST}{$home_root}$1/index.html.gz [L]\n\n";
|
| 245 |
|
|
|
|
| 246 |
$rules .= "RewriteCond %{QUERY_STRING} !.*s=.*\n";
|
| 247 |
$rules .= "RewriteCond %{QUERY_STRING} !.*attachment_id=.*\n";
|
| 248 |
$rules .= "RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$\n";
|
|
@@ -1037,8 +1040,6 @@ function wp_cache_clean_expired($file_prefix) {
|
|
| 1037 |
}
|
| 1038 |
}
|
| 1039 |
|
| 1040 |
-
add_action('admin_menu', 'wp_cache_add_pages');
|
| 1041 |
-
|
| 1042 |
function wpsc_remove_marker( $filename, $marker ) {
|
| 1043 |
if (!file_exists( $filename ) || is_writeable( $filename ) ) {
|
| 1044 |
if (!file_exists( $filename ) ) {
|
|
@@ -1072,7 +1073,7 @@ function wpsc_remove_marker( $filename, $marker ) {
|
|
| 1072 |
}
|
| 1073 |
|
| 1074 |
function wp_super_cache_footer() {
|
| 1075 |
-
?><p><?php bloginfo('name'); ?> is Digg proof thanks to caching by <a href="http://ocaoimh.ie/wp-super-cache/">WP Super Cache</a>!</p><?php
|
| 1076 |
}
|
| 1077 |
if( isset( $wp_cache_hello_world ) && $wp_cache_hello_world )
|
| 1078 |
add_action( 'wp_footer', 'wp_super_cache_footer' );
|
| 3 |
Plugin Name: WP Super Cache
|
| 4 |
Plugin URI: http://ocaoimh.ie/wp-super-cache/
|
| 5 |
Description: Very fast caching module for WordPress. Once enabled, you must <a href="options-general.php?page=wp-super-cache/wp-cache.php">enable the cache</a>. Based on WP-Cache by <a href="http://mnm.uib.es/gallir/">Ricardo Galli Granada</a>.
|
| 6 |
+
Version: 0.6.4
|
| 7 |
Author: Donncha O Caoimh
|
| 8 |
Author URI: http://ocaoimh.ie/
|
| 9 |
*/
|
| 63 |
add_options_page('WP Super Cache', 'WP Super Cache', 'manage_options', __FILE__, 'wp_cache_manager');
|
| 64 |
}
|
| 65 |
}
|
| 66 |
+
add_action('admin_menu', 'wp_cache_add_pages');
|
| 67 |
|
| 68 |
function wp_cache_manager() {
|
| 69 |
global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world;
|
| 97 |
// -->
|
| 98 |
</script>
|
| 99 |
<?php
|
| 100 |
+
echo '<div class="wrap">';
|
| 101 |
echo "<h2>WP Super Cache Manager</h2>\n";
|
| 102 |
if( ini_get( 'safe_mode' ) ) {
|
| 103 |
?><h3>Warning! PHP safe mode enabled!</h3>
|
| 237 |
$rules .= "RewriteBase $home_root\n"; // props Chris Messina
|
| 238 |
$charset = get_option('blog_charset') == '' ? 'UTF-8' : get_option('blog_charset');
|
| 239 |
$rules .= "AddDefaultCharset {$charset}\n";
|
| 240 |
+
$rules .= "RewriteCond %{REQUEST_METHOD} !=POST\n";
|
| 241 |
$rules .= "RewriteCond %{QUERY_STRING} !.*s=.*\n";
|
| 242 |
$rules .= "RewriteCond %{QUERY_STRING} !.*attachment_id=.*\n";
|
| 243 |
$rules .= "RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$\n";
|
| 245 |
$rules .= "RewriteCond %{DOCUMENT_ROOT}{$home_root}wp-content/cache/supercache/%{HTTP_HOST}{$home_root}$1/index.html.gz -f\n";
|
| 246 |
$rules .= "RewriteRule ^(.*) {$home_root}wp-content/cache/supercache/%{HTTP_HOST}{$home_root}$1/index.html.gz [L]\n\n";
|
| 247 |
|
| 248 |
+
$rules .= "RewriteCond %{REQUEST_METHOD} !=POST\n";
|
| 249 |
$rules .= "RewriteCond %{QUERY_STRING} !.*s=.*\n";
|
| 250 |
$rules .= "RewriteCond %{QUERY_STRING} !.*attachment_id=.*\n";
|
| 251 |
$rules .= "RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$\n";
|
| 1040 |
}
|
| 1041 |
}
|
| 1042 |
|
|
|
|
|
|
|
| 1043 |
function wpsc_remove_marker( $filename, $marker ) {
|
| 1044 |
if (!file_exists( $filename ) || is_writeable( $filename ) ) {
|
| 1045 |
if (!file_exists( $filename ) ) {
|
| 1073 |
}
|
| 1074 |
|
| 1075 |
function wp_super_cache_footer() {
|
| 1076 |
+
?><p id='supercache'><?php bloginfo('name'); ?> is Digg proof thanks to caching by <a href="http://ocaoimh.ie/wp-super-cache/">WP Super Cache</a>!</p><?php
|
| 1077 |
}
|
| 1078 |
if( isset( $wp_cache_hello_world ) && $wp_cache_hello_world )
|
| 1079 |
add_action( 'wp_footer', 'wp_super_cache_footer' );
|
