From 980fd4fc3d2753820adbfa4b19a86a00830f9517 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 4 Oct 2012 13:25:58 +0000 Subject: [PATCH] If wp_cache_incr() is not available fallback to get()/set(). fixes #22024 git-svn-id: https://develop.svn.wordpress.org/trunk@22110 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/comment.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index d8ca7859da..225e786b43 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -1290,7 +1290,12 @@ function wp_insert_comment($commentdata) { $comment = get_comment($id); do_action('wp_insert_comment', $id, $comment); - wp_cache_incr( 'last_changed', 1, 'comment' ); + if ( function_exists( 'wp_cache_incr' ) ) { + wp_cache_incr( 'last_changed', 1, 'comment' ); + } else { + $last_changed = wp_cache_get( 'last_changed', 'comment' ); + wp_cache_set( 'last_changed', $last_changed + 1, 'comment' ); + } return $id; } @@ -1963,7 +1968,12 @@ function clean_comment_cache($ids) { foreach ( (array) $ids as $id ) wp_cache_delete($id, 'comment'); - wp_cache_incr( 'last_changed', 1, 'comment' ); + if ( function_exists( 'wp_cache_incr' ) ) { + wp_cache_incr( 'last_changed', 1, 'comment' ); + } else { + $last_changed = wp_cache_get( 'last_changed', 'comment' ); + wp_cache_set( 'last_changed', $last_changed + 1, 'comment' ); + } } /**