Version Description
Download this release
Release Info
Developer | donncha |
Plugin | WP Super Cache |
Version | 0.3 |
Comparing to | |
See all releases |
Code changes from version 0.2 to 0.3
- readme.txt +1 -2
- wp-cache-phase1.php +3 -0
- wp-cache-phase2.php +24 -1
- wp-cache.php +20 -6
readme.txt
CHANGED
@@ -1,9 +1,8 @@
|
|
1 |
=== WP Super Cache ===
|
2 |
Contributors: donncha
|
3 |
-
Donate link: http://ocaoimh.ie/
|
4 |
Tags: performance,caching,wp-cache
|
5 |
Tested up to: 2.3.1
|
6 |
-
Stable
|
7 |
|
8 |
A modification of WP-Cache that produces static html files.
|
9 |
|
1 |
=== WP Super Cache ===
|
2 |
Contributors: donncha
|
|
|
3 |
Tags: performance,caching,wp-cache
|
4 |
Tested up to: 2.3.1
|
5 |
+
Stable tag: 0.3
|
6 |
|
7 |
A modification of WP-Cache that produces static html files.
|
8 |
|
wp-cache-phase1.php
CHANGED
@@ -33,6 +33,9 @@ $meta_file = '';
|
|
33 |
$wp_cache_gzip_encoding = '';
|
34 |
|
35 |
function gzip_accepted(){
|
|
|
|
|
|
|
36 |
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') === false) return false;
|
37 |
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') === false) return 'gzip';
|
38 |
return 'x-gzip';
|
33 |
$wp_cache_gzip_encoding = '';
|
34 |
|
35 |
function gzip_accepted(){
|
36 |
+
if( ini_get( 'zlib.output_compression' ) ) // don't compress WP-Cache data files when PHP is already doing it
|
37 |
+
return false;
|
38 |
+
|
39 |
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') === false) return false;
|
40 |
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') === false) return 'gzip';
|
41 |
return 'x-gzip';
|
wp-cache-phase2.php
CHANGED
@@ -312,7 +312,30 @@ function wp_cache_shutdown_callback() {
|
|
312 |
array_push($wp_cache_meta_object->headers, "Last-Modified: $value");
|
313 |
}
|
314 |
if (!$response{'Content-Type'} && !$response{'Content-type'}) {
|
315 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
316 |
@header("Content-Type: $value");
|
317 |
array_push($wp_cache_meta_object->headers, "Content-Type: $value");
|
318 |
}
|
312 |
array_push($wp_cache_meta_object->headers, "Last-Modified: $value");
|
313 |
}
|
314 |
if (!$response{'Content-Type'} && !$response{'Content-type'}) {
|
315 |
+
// On some systems, headers set by PHP can't be fetched from
|
316 |
+
// the output buffer. This is a last ditch effort to set the
|
317 |
+
// correct Content-Type header for feeds, if we didn't see
|
318 |
+
// it in the response headers already. -- dougal
|
319 |
+
if (is_feed()) {
|
320 |
+
$type = get_query_var('feed');
|
321 |
+
$type = str_replace('/','',$type);
|
322 |
+
switch ($type) {
|
323 |
+
case 'atom':
|
324 |
+
$value = "application/atom+xml";
|
325 |
+
break;
|
326 |
+
case 'rdf':
|
327 |
+
$value = "application/rdf+xml";
|
328 |
+
break;
|
329 |
+
case 'rss':
|
330 |
+
case 'rss2':
|
331 |
+
default:
|
332 |
+
$value = "application/rss+xml";
|
333 |
+
}
|
334 |
+
} else { // not a feed
|
335 |
+
$value = 'text/html';
|
336 |
+
}
|
337 |
+
$value .= "; charset=\"" . get_settings('blog_charset') . "\"";
|
338 |
+
|
339 |
@header("Content-Type: $value");
|
340 |
array_push($wp_cache_meta_object->headers, "Content-Type: $value");
|
341 |
}
|
wp-cache.php
CHANGED
@@ -54,11 +54,13 @@ function get_wpcachehome() {
|
|
54 |
}
|
55 |
|
56 |
function wp_cache_add_pages() {
|
57 |
-
if( function_exists( 'is_site_admin' ) )
|
58 |
-
if(
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
62 |
}
|
63 |
|
64 |
function wp_cache_manager() {
|
@@ -169,7 +171,11 @@ function wp_cache_manager() {
|
|
169 |
wp_cache_restore();
|
170 |
|
171 |
ob_start();
|
172 |
-
|
|
|
|
|
|
|
|
|
173 |
$out = ob_get_contents();
|
174 |
ob_end_clean();
|
175 |
if( $out != '' ) {
|
@@ -465,10 +471,18 @@ function wp_cache_check_link() {
|
|
465 |
|
466 |
if ( basename(@readlink($wp_cache_link)) != basename($wp_cache_file)) {
|
467 |
@unlink($wp_cache_link);
|
|
|
468 |
if (!@symlink ($wp_cache_file, $wp_cache_link)) {
|
469 |
echo "<code>advanced-cache.php</code> link does not exist<br />";
|
470 |
echo "Create it by executing: <br /><code>ln -s $wp_cache_file $wp_cache_link</code><br /> in your server<br />";
|
471 |
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
}
|
473 |
}
|
474 |
return true;
|
54 |
}
|
55 |
|
56 |
function wp_cache_add_pages() {
|
57 |
+
if( function_exists( 'is_site_admin' ) ) {
|
58 |
+
if( is_site_admin() ) {
|
59 |
+
add_submenu_page('wpmu-admin.php', __('WP Super Cache'), __('WP Super Cache'), 'administrator', __FILE__, 'wp_cache_manager');
|
60 |
+
}
|
61 |
+
} else {
|
62 |
+
add_options_page('WP Super Cache', 'WP Super Cache', 'administrator', __FILE__, 'wp_cache_manager');
|
63 |
+
}
|
64 |
}
|
65 |
|
66 |
function wp_cache_manager() {
|
171 |
wp_cache_restore();
|
172 |
|
173 |
ob_start();
|
174 |
+
if( !function_exists( 'do_cacheaction' ) ) {
|
175 |
+
die( 'Install is not complete. Please delete wp-content/advanced-cache.php' );
|
176 |
+
} else {
|
177 |
+
do_cacheaction( 'cache_admin_page' );
|
178 |
+
}
|
179 |
$out = ob_get_contents();
|
180 |
ob_end_clean();
|
181 |
if( $out != '' ) {
|
471 |
|
472 |
if ( basename(@readlink($wp_cache_link)) != basename($wp_cache_file)) {
|
473 |
@unlink($wp_cache_link);
|
474 |
+
if( function_exists( 'symlink' ) ) {
|
475 |
if (!@symlink ($wp_cache_file, $wp_cache_link)) {
|
476 |
echo "<code>advanced-cache.php</code> link does not exist<br />";
|
477 |
echo "Create it by executing: <br /><code>ln -s $wp_cache_file $wp_cache_link</code><br /> in your server<br />";
|
478 |
return false;
|
479 |
+
} else {
|
480 |
+
if( !@copy( $wp_cache_file, $wp_cache_link ) ) {
|
481 |
+
echo "<code>advanced-cache.php</code> does not exist<br />";
|
482 |
+
echo "Create it by copying $wp_cache_file to $wp_cache_link<br /> in your server<br />";
|
483 |
+
return false;
|
484 |
+
}
|
485 |
+
}
|
486 |
}
|
487 |
}
|
488 |
return true;
|