mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
If wp_cache_incr() is not available fallback to get()/set(). fixes #22024
git-svn-id: http://core.svn.wordpress.org/trunk@22110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3c2b9a6901
commit
a9e25d964e
@ -1290,7 +1290,12 @@ function wp_insert_comment($commentdata) {
|
|||||||
$comment = get_comment($id);
|
$comment = get_comment($id);
|
||||||
do_action('wp_insert_comment', $id, $comment);
|
do_action('wp_insert_comment', $id, $comment);
|
||||||
|
|
||||||
|
if ( function_exists( 'wp_cache_incr' ) ) {
|
||||||
wp_cache_incr( 'last_changed', 1, 'comment' );
|
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;
|
return $id;
|
||||||
}
|
}
|
||||||
@ -1963,7 +1968,12 @@ function clean_comment_cache($ids) {
|
|||||||
foreach ( (array) $ids as $id )
|
foreach ( (array) $ids as $id )
|
||||||
wp_cache_delete($id, 'comment');
|
wp_cache_delete($id, 'comment');
|
||||||
|
|
||||||
|
if ( function_exists( 'wp_cache_incr' ) ) {
|
||||||
wp_cache_incr( 'last_changed', 1, 'comment' );
|
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' );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user