Version Description
Download this release
Release Info
Developer | donncha |
Plugin | WP Super Cache |
Version | 0.8.8 |
Comparing to | |
See all releases |
Code changes from version 0.8.7 to 0.8.8
- Changelog.txt +58 -0
- readme.txt +2 -2
- wp-cache-config-sample.php +4 -0
- wp-cache-phase1.php +9 -1
- wp-cache-phase2.php +51 -17
- wp-cache.php +26 -9
Changelog.txt
CHANGED
@@ -1,3 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
2009-01-09 11:04 donncha
|
2 |
|
3 |
* readme.txt, wp-cache.php: Bump version to 0.8.7
|
1 |
+
2009-01-16 17:03 donncha
|
2 |
+
|
3 |
+
* wp-cache-config-sample.php, wp-cache-phase1.php,
|
4 |
+
wp-cache-phase2.php: Added simple DEBUG mode. Activate by setting
|
5 |
+
$wp_cache_debug to your email address in wp-cache-config.php
|
6 |
+
Sends debug emails on: cron job, failed job, when gzip headers
|
7 |
+
are missing from wp-cache meta file.
|
8 |
+
|
9 |
+
2009-01-16 16:14 donncha
|
10 |
+
|
11 |
+
* readme.txt, wp-cache.php: Bump version to 0.8.8
|
12 |
+
|
13 |
+
2009-01-16 16:10 donncha
|
14 |
+
|
15 |
+
* wp-cache.php: Added "Delete Cache" link to Favourites menu
|
16 |
+
|
17 |
+
2009-01-15 23:16 donncha
|
18 |
+
|
19 |
+
* wp-cache-phase2.php: We clean up files as well as directories.
|
20 |
+
Should fix issue with non-updating blogs
|
21 |
+
|
22 |
+
2009-01-14 22:47 donncha
|
23 |
+
|
24 |
+
* wp-cache-config-sample.php, wp-cache-phase1.php,
|
25 |
+
wp-cache-phase2.php: Remove debugging code
|
26 |
+
|
27 |
+
2009-01-14 18:51 donncha
|
28 |
+
|
29 |
+
* wp-cache-config-sample.php, wp-cache-phase1.php,
|
30 |
+
wp-cache-phase2.php: Lots of debug code
|
31 |
+
|
32 |
+
2009-01-14 14:33 donncha
|
33 |
+
|
34 |
+
* readme.txt: Updated the "How do I know my blog is being cached?"
|
35 |
+
FAQ
|
36 |
+
|
37 |
+
2009-01-12 17:51 donncha
|
38 |
+
|
39 |
+
* wp-cache-phase2.php: Don't overwrite $dh directory handler
|
40 |
+
|
41 |
+
2009-01-12 17:38 donncha
|
42 |
+
|
43 |
+
* wp-cache-phase2.php: When reading large directories, create array
|
44 |
+
of files. The opendir handle seems to die.
|
45 |
+
|
46 |
+
2009-01-11 09:16 donncha
|
47 |
+
|
48 |
+
* wp-cache-phase2.php, wp-cache.php: Use opendir()/readdir()
|
49 |
+
instead of glob()
|
50 |
+
|
51 |
+
2009-01-09 21:16 donncha
|
52 |
+
|
53 |
+
* wp-cache-phase2.php: Minor typo
|
54 |
+
|
55 |
+
2009-01-09 11:04 donncha
|
56 |
+
|
57 |
+
* Changelog.txt: Updated changelog
|
58 |
+
|
59 |
2009-01-09 11:04 donncha
|
60 |
|
61 |
* readme.txt, wp-cache.php: Bump version to 0.8.7
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: donncha
|
3 |
Tags: performance,caching,wp-cache,wp-super-cache
|
4 |
Tested up to: 2.7
|
5 |
-
Stable tag: 0.8.
|
6 |
Requires at least: 2.2
|
7 |
|
8 |
A very fast caching engine for WordPress that produces static html files.
|
@@ -85,7 +85,7 @@ The [changelog](http://svn.wp-plugins.org/wp-super-cache/trunk/Changelog.txt) is
|
|
85 |
|
86 |
= How do I know my blog is being cached? =
|
87 |
|
88 |
-
View the source of any page on your site. When a page is first created, you'll see the text "Dynamic Page Served (once) in X.XXXXX seconds" at the end of the source code. On reload, a cached page
|
89 |
|
90 |
= Why is WP-Super-Cache better than WP-Cache? =
|
91 |
|
2 |
Contributors: donncha
|
3 |
Tags: performance,caching,wp-cache,wp-super-cache
|
4 |
Tested up to: 2.7
|
5 |
+
Stable tag: 0.8.8
|
6 |
Requires at least: 2.2
|
7 |
|
8 |
A very fast caching engine for WordPress that produces static html files.
|
85 |
|
86 |
= How do I know my blog is being cached? =
|
87 |
|
88 |
+
View the source of any page on your site. When a page is first created, you'll see the text "Dynamic Page Served (once) in X.XXXXX 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. If 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. WP-Cache (PHP) cached pages will have the header "WP-Super-Cache: WP-Cache". I used the <a href="https://addons.mozilla.org/en-US/firefox/addon/3829">Live HTTP Headers</a> extension for Firefox to examine the headers. You should also check your cache directory in wp-content/cache/supercache/hostname/ for static cache files.
|
89 |
|
90 |
= Why is WP-Super-Cache better than WP-Cache? =
|
91 |
|
wp-cache-config-sample.php
CHANGED
@@ -47,6 +47,10 @@ $cache_rejected_user_agent = array ( 0 => 'bot', 1 => 'ia_archive', 2 => 'slurp'
|
|
47 |
// generated.
|
48 |
$cache_rebuild_files = 0;
|
49 |
|
|
|
|
|
|
|
|
|
50 |
// Just modify it if you have conflicts with semaphores
|
51 |
$sem_id = 5419;
|
52 |
|
47 |
// generated.
|
48 |
$cache_rebuild_files = 0;
|
49 |
|
50 |
+
// DEBUG mode. Change this to your email address to be sent debug emails.
|
51 |
+
// Remove comment (//) to enable and add back to disable.
|
52 |
+
//$wp_cache_debug = "you@example.com";
|
53 |
+
|
54 |
// Just modify it if you have conflicts with semaphores
|
55 |
$sem_id = 5419;
|
56 |
|
wp-cache-phase1.php
CHANGED
@@ -18,7 +18,6 @@ if(defined('DOING_CRON')) {
|
|
18 |
$mutex_filename = 'wp_cache_mutex.lock';
|
19 |
$new_cache = false;
|
20 |
|
21 |
-
|
22 |
// Don't change variables behind this point
|
23 |
|
24 |
$plugins = glob( WPCACHEHOME . 'plugins/*.php' );
|
@@ -70,6 +69,7 @@ if( file_exists( $cache_file ) && ($mtime = @filemtime($meta_pathname)) ) {
|
|
70 |
array_push($meta->headers, 'Content-Encoding: ' . $wp_cache_gzip_encoding);
|
71 |
array_push($meta->headers, 'Vary: Accept-Encoding, Cookie');
|
72 |
array_push($meta->headers, 'Content-Length: ' . filesize( $cache_file ) );
|
|
|
73 |
}
|
74 |
foreach ($meta->headers as $header) {
|
75 |
// 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/
|
@@ -131,4 +131,12 @@ function do_cacheaction( $action, $value = '' ) {
|
|
131 |
return $value;
|
132 |
}
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
?>
|
18 |
$mutex_filename = 'wp_cache_mutex.lock';
|
19 |
$new_cache = false;
|
20 |
|
|
|
21 |
// Don't change variables behind this point
|
22 |
|
23 |
$plugins = glob( WPCACHEHOME . 'plugins/*.php' );
|
69 |
array_push($meta->headers, 'Content-Encoding: ' . $wp_cache_gzip_encoding);
|
70 |
array_push($meta->headers, 'Vary: Accept-Encoding, Cookie');
|
71 |
array_push($meta->headers, 'Content-Length: ' . filesize( $cache_file ) );
|
72 |
+
wp_cache_debug( "Had to add gzip headers to the page {$_SERVER[ 'REQUEST_URI' ]}." );
|
73 |
}
|
74 |
foreach ($meta->headers as $header) {
|
75 |
// 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/
|
131 |
return $value;
|
132 |
}
|
133 |
|
134 |
+
function wp_cache_debug( $message ) {
|
135 |
+
global $wp_cache_debug;
|
136 |
+
if( !isset( $wp_cache_debug ) )
|
137 |
+
return;
|
138 |
+
$message .= "\n\nDisable these emails by commenting out or deleting the line containing\n\$wp_cache_debug in wp-content/wp-cache-config.php on your server.\n";
|
139 |
+
mail( $wp_cache_debug, '[' . addslashes( $_SERVER[ 'HTTP_HOST' ] ) . "] WP Super Cache Debug", $message );
|
140 |
+
}
|
141 |
+
|
142 |
?>
|
wp-cache-phase2.php
CHANGED
@@ -311,13 +311,18 @@ function wp_cache_phase2_clean_cache($file_prefix) {
|
|
311 |
|
312 |
if( !wp_cache_writers_entry() )
|
313 |
return false;
|
314 |
-
if ( ($handle = opendir( $cache_path )) ) {
|
315 |
-
while ( false !== ($file = readdir($handle))) {
|
316 |
if ( preg_match("/^$file_prefix/", $file) ) {
|
317 |
-
|
318 |
}
|
319 |
}
|
320 |
closedir($handle);
|
|
|
|
|
|
|
|
|
|
|
321 |
}
|
322 |
wp_cache_writers_exit();
|
323 |
}
|
@@ -325,7 +330,7 @@ function wp_cache_phase2_clean_cache($file_prefix) {
|
|
325 |
function prune_super_cache( $directory, $force = false, $rename = false ) {
|
326 |
global $gc_file_counter;
|
327 |
$c = 0;
|
328 |
-
while( $c < 20
|
329 |
$gc_file_counter = 0;
|
330 |
sc_garbage_collection( $directory, $force, $rename );
|
331 |
$c++;
|
@@ -350,21 +355,36 @@ function sc_garbage_collection( $directory, $force = false, $rename = false ) {
|
|
350 |
|
351 |
$oktodelete = false;
|
352 |
if (is_dir($directory)) {
|
353 |
-
$
|
354 |
-
|
355 |
-
|
356 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
if( $gc_file_counter < 100 ) {
|
358 |
sc_garbage_collection( $entry, $force, $rename );
|
359 |
}
|
360 |
// If entry is a directory, AND it's not a protected one, AND we're either forcing the delete, OR the file is out of date,
|
361 |
-
if( is_dir( $entry ) &&
|
362 |
-
!in_array( $entry, $protected_directories ) &&
|
363 |
-
( $force || @filemtime( $entry ) + $cache_max_time <= $now ) ) {
|
364 |
// if the directory isn't empty can't delete it
|
365 |
-
if(
|
366 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
}
|
|
|
|
|
368 |
if( !$rename ) {
|
369 |
@rmdir( $entry );
|
370 |
$gc_file_counter++;
|
@@ -403,6 +423,12 @@ function wp_cache_phase2_clean_expired($file_prefix) {
|
|
403 |
$now = time();
|
404 |
if ( ($handle = opendir( $cache_path )) ) {
|
405 |
while ( false !== ($file = readdir($handle))) {
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
if ( preg_match("/^$file_prefix/", $file) &&
|
407 |
(filemtime($cache_path . $file) + $cache_max_time) <= $now ) {
|
408 |
@unlink($cache_path . $file);
|
@@ -416,11 +442,11 @@ function wp_cache_phase2_clean_expired($file_prefix) {
|
|
416 |
}
|
417 |
}
|
418 |
}
|
419 |
-
closedir($handle);
|
420 |
prune_super_cache( $cache_path . 'supercache' );
|
421 |
}
|
422 |
|
423 |
wp_cache_writers_exit();
|
|
|
424 |
}
|
425 |
|
426 |
function wp_cache_shutdown_callback() {
|
@@ -537,7 +563,7 @@ function wp_cache_get_postid_from_comment($comment_id) {
|
|
537 |
// http://ocaoimh.ie/2006/12/05/caching-wordpress-with-wp-cache-in-a-spam-filled-world
|
538 |
if( !preg_match('/wp-admin\//', $_SERVER['REQUEST_URI']) )
|
539 |
if( $comment['comment_approved'] == 'spam' ) { // changed from 1 to "spam"
|
540 |
-
return $
|
541 |
} elseif( $comment['comment_approved'] == '0' ) {
|
542 |
$super_cache_enabled = 0; // don't remove the super cache static file until comment is approved
|
543 |
}
|
@@ -587,6 +613,12 @@ function wp_cache_post_change($post_id) {
|
|
587 |
$matches = array();
|
588 |
if ( ($handle = opendir( $cache_path . 'meta/' )) ) {
|
589 |
while ( false !== ($file = readdir($handle))) {
|
|
|
|
|
|
|
|
|
|
|
|
|
590 |
if ( preg_match("/^({$file_prefix}{$blogcacheid}.*)\.meta/", $file, $matches) ) {
|
591 |
$meta_pathname = $cache_path . 'meta/' . $file;
|
592 |
$content_pathname = $cache_path . $matches[1] . ".html";
|
@@ -603,7 +635,6 @@ function wp_cache_post_change($post_id) {
|
|
603 |
|
604 |
}
|
605 |
}
|
606 |
-
closedir($handle);
|
607 |
}
|
608 |
wp_cache_writers_exit();
|
609 |
return $post_id;
|
@@ -632,8 +663,11 @@ function wp_cache_gc_cron() {
|
|
632 |
if( !isset( $wp_cache_gc ) )
|
633 |
$wp_cache_gc = 600;
|
634 |
|
635 |
-
|
|
|
|
|
636 |
update_option( 'wpsupercache_gc_time', time() - ( $wp_cache_gc - 300 ) ); // if GC failed then run it again in 5 minutes
|
|
|
637 |
}
|
638 |
|
639 |
?>
|
311 |
|
312 |
if( !wp_cache_writers_entry() )
|
313 |
return false;
|
314 |
+
if ( ($handle = @opendir( $cache_path )) ) {
|
315 |
+
while ( false !== ($file = @readdir($handle))) {
|
316 |
if ( preg_match("/^$file_prefix/", $file) ) {
|
317 |
+
$files[] = $file;
|
318 |
}
|
319 |
}
|
320 |
closedir($handle);
|
321 |
+
if( is_array( $files ) )
|
322 |
+
reset( $files );
|
323 |
+
foreach( (array)$files as $file ) {
|
324 |
+
@unlink($cache_path . $file);
|
325 |
+
}
|
326 |
}
|
327 |
wp_cache_writers_exit();
|
328 |
}
|
330 |
function prune_super_cache( $directory, $force = false, $rename = false ) {
|
331 |
global $gc_file_counter;
|
332 |
$c = 0;
|
333 |
+
while( $c < 20 ) {
|
334 |
$gc_file_counter = 0;
|
335 |
sc_garbage_collection( $directory, $force, $rename );
|
336 |
$c++;
|
355 |
|
356 |
$oktodelete = false;
|
357 |
if (is_dir($directory)) {
|
358 |
+
if( $dh = @opendir( $directory ) ) {
|
359 |
+
$directory = trailingslashit( $directory );
|
360 |
+
while( ( $entry = @readdir( $dh ) ) !== false ) {
|
361 |
+
if ($entry == '.' || $entry == '..')
|
362 |
+
continue;
|
363 |
+
if( $gc_file_counter < 100 )
|
364 |
+
$files[] = $entry;
|
365 |
+
}
|
366 |
+
closedir($dh);
|
367 |
+
if( is_array( $files ) )
|
368 |
+
reset( $files );
|
369 |
+
foreach( (array)$files as $entry ) {
|
370 |
+
$entry = $directory . $entry;
|
371 |
if( $gc_file_counter < 100 ) {
|
372 |
sc_garbage_collection( $entry, $force, $rename );
|
373 |
}
|
374 |
// If entry is a directory, AND it's not a protected one, AND we're either forcing the delete, OR the file is out of date,
|
375 |
+
if( is_dir( $entry ) && !in_array( $entry, $protected_directories ) && ( $force || @filemtime( $entry ) + $cache_max_time <= $now ) ) {
|
|
|
|
|
376 |
// if the directory isn't empty can't delete it
|
377 |
+
if( $handle = @opendir( $entry ) ) {
|
378 |
+
$donotdelete = false;
|
379 |
+
while( !$donotdelete && ( $file = @readdir( $handle ) ) !== false ) {
|
380 |
+
if ($file == '.' || $file == '..')
|
381 |
+
continue;
|
382 |
+
$donotdelete = true;
|
383 |
+
}
|
384 |
+
closedir($handle);
|
385 |
}
|
386 |
+
if( $donotdelete )
|
387 |
+
continue;
|
388 |
if( !$rename ) {
|
389 |
@rmdir( $entry );
|
390 |
$gc_file_counter++;
|
423 |
$now = time();
|
424 |
if ( ($handle = opendir( $cache_path )) ) {
|
425 |
while ( false !== ($file = readdir($handle))) {
|
426 |
+
$files[] = $file;
|
427 |
+
}
|
428 |
+
closedir($handle);
|
429 |
+
if( is_array( $files ) )
|
430 |
+
reset( $files );
|
431 |
+
foreach( (array)$files as $file ) {
|
432 |
if ( preg_match("/^$file_prefix/", $file) &&
|
433 |
(filemtime($cache_path . $file) + $cache_max_time) <= $now ) {
|
434 |
@unlink($cache_path . $file);
|
442 |
}
|
443 |
}
|
444 |
}
|
|
|
445 |
prune_super_cache( $cache_path . 'supercache' );
|
446 |
}
|
447 |
|
448 |
wp_cache_writers_exit();
|
449 |
+
return true;
|
450 |
}
|
451 |
|
452 |
function wp_cache_shutdown_callback() {
|
563 |
// http://ocaoimh.ie/2006/12/05/caching-wordpress-with-wp-cache-in-a-spam-filled-world
|
564 |
if( !preg_match('/wp-admin\//', $_SERVER['REQUEST_URI']) )
|
565 |
if( $comment['comment_approved'] == 'spam' ) { // changed from 1 to "spam"
|
566 |
+
return $postid;
|
567 |
} elseif( $comment['comment_approved'] == '0' ) {
|
568 |
$super_cache_enabled = 0; // don't remove the super cache static file until comment is approved
|
569 |
}
|
613 |
$matches = array();
|
614 |
if ( ($handle = opendir( $cache_path . 'meta/' )) ) {
|
615 |
while ( false !== ($file = readdir($handle))) {
|
616 |
+
$files[] = $file;
|
617 |
+
}
|
618 |
+
closedir($handle);
|
619 |
+
if( is_array( $files ) )
|
620 |
+
reset( $files );
|
621 |
+
foreach( (array)$files as $file ) {
|
622 |
if ( preg_match("/^({$file_prefix}{$blogcacheid}.*)\.meta/", $file, $matches) ) {
|
623 |
$meta_pathname = $cache_path . 'meta/' . $file;
|
624 |
$content_pathname = $cache_path . $matches[1] . ".html";
|
635 |
|
636 |
}
|
637 |
}
|
|
|
638 |
}
|
639 |
wp_cache_writers_exit();
|
640 |
return $post_id;
|
663 |
if( !isset( $wp_cache_gc ) )
|
664 |
$wp_cache_gc = 600;
|
665 |
|
666 |
+
wp_cache_debug( 'Cache Expiry cron job called.' );
|
667 |
+
if( !wp_cache_phase2_clean_expired($file_prefix ) ) {
|
668 |
+
wp_cache_debug( 'Cache Expiry cron job failed. Probably mutex locked.' );
|
669 |
update_option( 'wpsupercache_gc_time', time() - ( $wp_cache_gc - 300 ) ); // if GC failed then run it again in 5 minutes
|
670 |
+
}
|
671 |
}
|
672 |
|
673 |
?>
|
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 activated, you must <a href="options-general.php?page=wpsupercache">enable the cache</a>.
|
6 |
-
Version: 0.8.
|
7 |
Author: Donncha O Caoimh
|
8 |
Author URI: http://ocaoimh.ie/
|
9 |
*/
|
@@ -1082,11 +1082,13 @@ function wp_cache_files() {
|
|
1082 |
$sizes = array( 'expired' => 0, 'cached' => 0, 'ts' => 0 );
|
1083 |
|
1084 |
if (is_dir($supercachedir)) {
|
1085 |
-
$
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
|
|
1089 |
}
|
|
|
1090 |
}
|
1091 |
} else {
|
1092 |
if(is_file($supercachedir) && filemtime( $supercachedir ) + $cache_max_time <= $now )
|
@@ -1137,11 +1139,13 @@ function wpsc_dirsize($directory, $sizes) {
|
|
1137 |
$now = time();
|
1138 |
|
1139 |
if (is_dir($directory)) {
|
1140 |
-
$
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
|
|
1144 |
}
|
|
|
1145 |
}
|
1146 |
} else {
|
1147 |
if(is_file($directory) ) {
|
@@ -1266,4 +1270,17 @@ function wp_cache_catch_404() {
|
|
1266 |
}
|
1267 |
add_action( 'template_redirect', 'wp_cache_catch_404' );
|
1268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1269 |
?>
|
3 |
Plugin Name: WP Super Cache
|
4 |
Plugin URI: http://ocaoimh.ie/wp-super-cache/
|
5 |
Description: Very fast caching module for WordPress. Once activated, you must <a href="options-general.php?page=wpsupercache">enable the cache</a>.
|
6 |
+
Version: 0.8.8
|
7 |
Author: Donncha O Caoimh
|
8 |
Author URI: http://ocaoimh.ie/
|
9 |
*/
|
1082 |
$sizes = array( 'expired' => 0, 'cached' => 0, 'ts' => 0 );
|
1083 |
|
1084 |
if (is_dir($supercachedir)) {
|
1085 |
+
if( $dh = opendir( $supercachedir ) ) {
|
1086 |
+
while( ( $entry = readdir( $dh ) ) !== false ) {
|
1087 |
+
if ($entry != '.' && $entry != '..') {
|
1088 |
+
$sizes = wpsc_dirsize( trailingslashit( $supercachedir ) . $entry, $sizes );
|
1089 |
+
}
|
1090 |
}
|
1091 |
+
closedir($dh);
|
1092 |
}
|
1093 |
} else {
|
1094 |
if(is_file($supercachedir) && filemtime( $supercachedir ) + $cache_max_time <= $now )
|
1139 |
$now = time();
|
1140 |
|
1141 |
if (is_dir($directory)) {
|
1142 |
+
if( $dh = opendir( $directory ) ) {
|
1143 |
+
while( ( $entry = readdir( $dh ) ) !== false ) {
|
1144 |
+
if ($entry != '.' && $entry != '..') {
|
1145 |
+
$sizes = wpsc_dirsize( trailingslashit( $directory ) . $entry, $sizes );
|
1146 |
+
}
|
1147 |
}
|
1148 |
+
closedir($dh);
|
1149 |
}
|
1150 |
} else {
|
1151 |
if(is_file($directory) ) {
|
1270 |
}
|
1271 |
add_action( 'template_redirect', 'wp_cache_catch_404' );
|
1272 |
|
1273 |
+
function wp_cache_favorite_action( $actions ) {
|
1274 |
+
if( function_exists( 'is_site_admin' ) && !is_site_admin() )
|
1275 |
+
return false;
|
1276 |
+
|
1277 |
+
if( function_exists('current_user_can') && !current_user_can('manage_options') )
|
1278 |
+
return false;
|
1279 |
+
|
1280 |
+
$actions[ wp_nonce_url( 'options-general.php?page=wpsupercache&wp_delete_cache=1#list', 'wp-cache' ) ] = array( __( 'Delete Cache' ), 'manage_options' );
|
1281 |
+
|
1282 |
+
return $actions;
|
1283 |
+
}
|
1284 |
+
add_filter( 'favorite_actions', 'wp_cache_favorite_action' );
|
1285 |
+
|
1286 |
?>
|