WP Super Cache Date Display Issue

7/10/2009 by Tim Flight Leave a reply »

The WP Super Cache plugin is finally playing well enough in my environment that I’ve been able to update from the ancient, abandoned WP-Cache plugin. I did notice however an issue with displaying dates in WordPress 2.8 and 2.8.1. The “Last” and “Next” Garbage Collection times are incorrect. Yet when I go to the WordPress Setting –> General page, the URC time and the Local Time are correct. It seems like the WP Super Cache plugin might be applying the UTC offset to the local time.

I don’t pretend that I have any clue what I’m doing, but making the following change in my wp-cache.php file fixed the issue, and now the times are displaying correctly.

@@ -1240,8 +1240,8 @@
 	$last_gc = get_option( "wpsupercache_gc_time" );
 	if( $last_gc ) {
 		$next_gc = $cache_max_time < 1800 ? $cache_max_time : 600;
-		echo "

Garbage CollectionLast: " . date( "Y-m-d H:i:s", ( $last_gc + ( get_option( 'gmt_offset' ) * 3600 ) ) ) . "";
-		echo "Next: " . date( "Y-m-d H:i:s", ( $next_gc + $last_gc + ( get_option( 'gmt_offset' ) * 3600 ) ) ) . "";
+		echo "

Garbage CollectionLast: " . date( "Y-m-d H:i:s", ( $last_gc ) ) . "";
+		echo "Next: " . date( "Y-m-d H:i:s", ( $next_gc + $last_gc ) ) . "

";
 	}

 	echo "

Expired files are files older than $cache_max_time seconds. They are still used by the plugin and are deleted periodically.

";

That was it… just taking out a couple of tiny segments “+ ( get_option( ‘gmt_offset’ ) * 3600 ) ” from a couple of lines did the trick for me.

Advertisement

Comments are closed.