Created
May 29, 2012 23:21
-
-
Save peterchester/2831422 to your computer and use it in GitHub Desktop.
More wp-super-cache notice fixes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/wp-content/plugins/wp-super-cache/wp-cache-phase2.php b/wp-content/plugins/wp-super-cache/wp-cache-phase2.php | |
index 739512e..86f6086 100644 | |
--- a/wp-content/plugins/wp-super-cache/wp-cache-phase2.php | |
+++ b/wp-content/plugins/wp-super-cache/wp-cache-phase2.php | |
@@ -59,7 +59,7 @@ function wp_cache_phase2() { | |
return false; | |
} | |
- if ( $wp_cache_object_cache && !empty( $_GET ) ) { | |
+ if ( isset( $wp_cache_object_cache ) && $wp_cache_object_cache && !empty( $_GET ) ) { | |
if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( 'Not caching GET request while object cache storage enabled.', 5 ); | |
return false; | |
} | |
@@ -413,7 +413,7 @@ function wp_cache_get_ob(&$buffer) { | |
if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( 'Not caching for known user.', 5 ); | |
} | |
- if ( $wp_cache_object_cache ) { // half on mode when using the object cache | |
+ if ( isset( $wp_cache_object_cache ) && $wp_cache_object_cache ) { // half on mode when using the object cache | |
if ( wp_cache_get_cookies_values() != '' ) { | |
$cache_enabled = false; | |
$cache_error = 'Known User and using object. Only anonymous users cached.'; | |
@@ -435,7 +435,7 @@ function wp_cache_get_ob(&$buffer) { | |
$fr = $fr2 = $gz = false; | |
// Open wp-cache cache file | |
if ( !$supercacheonly ) { | |
- if ( false == $wp_cache_object_cache ) { | |
+ if ( !isset( $wp_cache_object_cache ) || false == $wp_cache_object_cache ) { | |
$fr = @fopen($tmp_wpcache_filename, 'w'); | |
if (!$fr) { | |
if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( "Error. Supercache could not write to " . str_replace( ABSPATH, '', $cache_path ) . $cache_filename, 1 ); | |
@@ -499,7 +499,7 @@ function wp_cache_get_ob(&$buffer) { | |
if ( false == isset( $wp_super_cache_late_init ) || ( isset( $wp_super_cache_late_init ) && $wp_super_cache_late_init == 0 ) ) | |
$buffer .= '<!-- Super Cache dynamic page detected but $wp_super_cache_late_init not set. See the readme.txt for further details. -->'; | |
- if ( false == $wp_cache_object_cache ) { | |
+ if ( !isset( $wp_cache_object_cache ) || false == $wp_cache_object_cache ) { | |
if( $fr ) { // legacy caching | |
fputs($fr, $store); | |
} elseif ( isset( $fr2 ) ) { // supercache active | |
@@ -537,7 +537,7 @@ function wp_cache_get_ob(&$buffer) { | |
$wp_cache_meta[ 'headers' ][ 'Content-Encoding' ] = 'Content-Encoding: ' . $wp_cache_gzip_encoding; | |
$wp_cache_meta[ 'headers' ][ 'Vary' ] = 'Vary: Accept-Encoding, Cookie'; | |
// Return uncompressed data & store compressed for later use | |
- if ( false == $wp_cache_object_cache ) { | |
+ if ( !isset( $wp_cache_object_cache ) || false == $wp_cache_object_cache ) { | |
if( $fr ) { | |
if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( "Writing gzipped buffer to wp-cache cache file.", 5 ); | |
fputs($fr, $gzdata); | |
@@ -548,7 +548,7 @@ function wp_cache_get_ob(&$buffer) { | |
} | |
} else { // no compression | |
$wp_cache_meta[ 'headers' ][ 'Vary' ] = 'Vary: Cookie'; | |
- if ( false == $wp_cache_object_cache ) { | |
+ if ( !isset( $wp_cache_object_cache ) || false == $wp_cache_object_cache ) { | |
if( $fr ) { | |
if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( "Writing non-gzipped buffer to wp-cache cache file.", 5 ); | |
fputs($fr, $buffer); | |
@@ -558,7 +558,7 @@ function wp_cache_get_ob(&$buffer) { | |
$added_cache = 1; | |
} | |
} | |
- if ( false == $wp_cache_object_cache ) { | |
+ if ( !isset( $wp_cache_object_cache ) || false == $wp_cache_object_cache ) { | |
if( $fr2 ) { | |
if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( "Writing non-gzipped buffer to supercache file.", 5 ); | |
fputs($fr2, $buffer . '<!-- super cache -->' ); | |
@@ -570,7 +570,7 @@ function wp_cache_get_ob(&$buffer) { | |
} | |
} | |
$new_cache = true; | |
- if ( false == $wp_cache_object_cache ) { | |
+ if ( !isset( $wp_cache_object_cache ) || false == $wp_cache_object_cache ) { | |
if( $fr ) { | |
$supercacheonly = false; | |
fclose($fr); | |
@@ -868,7 +868,7 @@ function wp_cache_shutdown_callback() { | |
$serial = serialize($wp_cache_meta); | |
if( wp_cache_writers_entry() ) { | |
if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( "Writing meta file: {$blog_cache_dir}meta/{$meta_file}", 2 ); | |
- if ( false == $wp_cache_object_cache ) { | |
+ if ( !isset( $wp_cache_object_cache ) || false == $wp_cache_object_cache ) { | |
$tmp_meta_filename = $blog_cache_dir . 'meta/' . uniqid( mt_rand(), true ) . '.tmp'; | |
$fr = @fopen( $tmp_meta_filename, 'w'); | |
if( !$fr ) | |
@@ -966,7 +966,7 @@ function wp_cache_clear_cache_on_menu() { | |
/* Clear out the cache directory. */ | |
function wp_cache_clear_cache( $blog_id = 0 ) { | |
global $cache_path, $wp_cache_object_cache; | |
- if ( $wp_cache_object_cache ) { | |
+ if ( isset( $wp_cache_object_cache ) && $wp_cache_object_cache ) { | |
reset_oc_version(); | |
} else { | |
if ( $blog_id == 0 ) { | |
@@ -983,7 +983,7 @@ function wp_cache_clear_cache( $blog_id = 0 ) { | |
/* check if we want to clear out all cached files on post updates, otherwise call standard wp_cache_post_change() */ | |
function wp_cache_post_edit($post_id) { | |
- global $wp_cache_clear_on_post_edit, $cache_path, $blog_cache_dir; | |
+ global $wp_cache_clear_on_post_edit, $cache_path, $blog_cache_dir, $wp_cache_object_cache; | |
static $last_post_edited = -1; | |
if ( $post_id == $last_post_edited ) return $post_id; | |
@@ -996,7 +996,7 @@ function wp_cache_post_edit($post_id) { | |
} | |
if( $wp_cache_clear_on_post_edit ) { | |
if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( "Clearing cache $blog_cache_dir and {$cache_path}supercache/ on post edit per config.", 2 ); | |
- if ( $wp_cache_object_cache ) { | |
+ if ( isset( $wp_cache_object_cache ) && $wp_cache_object_cache ) { | |
reset_oc_version(); | |
} else { | |
prune_super_cache( $blog_cache_dir, true ); | |
@@ -1010,8 +1010,8 @@ function wp_cache_post_edit($post_id) { | |
function wp_cache_post_id_gc( $siteurl, $post_id, $all = 'all' ) { | |
global $cache_path, $wp_cache_object_cache, $wp_cache_refresh_single_only; | |
- | |
- if ( $wp_cache_object_cache ) | |
+ | |
+ if ( isset( $wp_cache_object_cache ) && $wp_cache_object_cache ) | |
reset_oc_version(); | |
$post_id = intval( $post_id ); | |
@@ -1065,7 +1065,7 @@ function wp_cache_post_change( $post_id ) { | |
$all = true; | |
} | |
- if ( $wp_cache_object_cache ) | |
+ if ( isset( $wp_cache_object_cache ) && $wp_cache_object_cache ) | |
reset_oc_version(); | |
$permalink = trailingslashit( str_replace( get_option( 'siteurl' ), '', post_permalink( $post_id ) ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment