From 7442b3894b8e9a5d07954e3d865a0ab045bfeb51 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 22 Jan 2013 15:46:16 +0000 Subject: [PATCH] Explicitly set last_changed to 1 instead of the result of wp_cache_set(). Avoids ambiguity and works with cache backends that return void instead of boolean. see #23167 git-svn-id: https://develop.svn.wordpress.org/trunk@23319 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/comment.php | 6 ++++-- wp-includes/post.php | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 4f602066ea..6ac4aef338 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -250,8 +250,10 @@ class WP_Comment_Query { // $args can be whatever, only use the args defined in defaults to compute the key $key = md5( serialize( compact(array_keys($defaults)) ) ); $last_changed = wp_cache_get( 'last_changed', 'comment' ); - if ( ! $last_changed ) - $last_changed = wp_cache_set( 'last_changed', 1, 'comment' ); + if ( ! $last_changed ) { + wp_cache_set( 'last_changed', 1, 'comment' ); + $last_changed = 1; + } $cache_key = "get_comments:$key:$last_changed"; if ( $cache = wp_cache_get( $cache_key, 'comment' ) ) diff --git a/wp-includes/post.php b/wp-includes/post.php index a28b133718..0ae90a3d54 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -3652,8 +3652,10 @@ function get_pages($args = '') { // $args can be whatever, only use the args defined in defaults to compute the key $key = md5( serialize( compact(array_keys($defaults)) ) ); $last_changed = wp_cache_get( 'last_changed', 'posts' ); - if ( ! $last_changed ) - $last_changed = wp_cache_set( 'last_changed', 1, 'posts' ); + if ( ! $last_changed ) { + wp_cache_set( 'last_changed', 1, 'posts' ); + $last_changed = 1; + } $cache_key = "get_pages:$key:$last_changed"; if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) {