Changeset 43729 for branches/5.0/src/wp-includes/comment.php
- Timestamp:
- 10/15/2018 11:45:16 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-includes/comment.php
r43468 r43729 423 423 * @return int|bool Meta ID on success, false on failure. 424 424 */ 425 function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false) { 426 $added = add_metadata( 'comment', $comment_id, $meta_key, $meta_value, $unique ); 427 if ( $added ) { 428 wp_cache_set( 'last_changed', microtime(), 'comment' ); 429 } 430 return $added; 425 function add_comment_meta( $comment_id, $meta_key, $meta_value, $unique = false ) { 426 return add_metadata( 'comment', $comment_id, $meta_key, $meta_value, $unique ); 431 427 } 432 428 … … 446 442 * @return bool True on success, false on failure. 447 443 */ 448 function delete_comment_meta($comment_id, $meta_key, $meta_value = '') { 449 $deleted = delete_metadata( 'comment', $comment_id, $meta_key, $meta_value ); 450 if ( $deleted ) { 451 wp_cache_set( 'last_changed', microtime(), 'comment' ); 452 } 453 return $deleted; 444 function delete_comment_meta( $comment_id, $meta_key, $meta_value = '' ) { 445 return delete_metadata( 'comment', $comment_id, $meta_key, $meta_value ); 454 446 } 455 447 … … 466 458 * is true. 467 459 */ 468 function get_comment_meta( $comment_id, $key = '', $single = false) {469 return get_metadata( 'comment', $comment_id, $key, $single);460 function get_comment_meta( $comment_id, $key = '', $single = false ) { 461 return get_metadata( 'comment', $comment_id, $key, $single ); 470 462 } 471 463 … … 487 479 * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure. 488 480 */ 489 function update_comment_meta($comment_id, $meta_key, $meta_value, $prev_value = '') { 490 $updated = update_metadata( 'comment', $comment_id, $meta_key, $meta_value, $prev_value ); 491 if ( $updated ) { 492 wp_cache_set( 'last_changed', microtime(), 'comment' ); 493 } 494 return $updated; 481 function update_comment_meta( $comment_id, $meta_key, $meta_value, $prev_value = '' ) { 482 return update_metadata( 'comment', $comment_id, $meta_key, $meta_value, $prev_value ); 495 483 } 496 484 … … 3062 3050 */ 3063 3051 do_action( 'comment_on_draft', $comment_post_ID ); 3064 3052 3065 3053 if ( current_user_can( 'read_post', $comment_post_ID ) ) { 3066 3054 return new WP_Error( 'comment_on_draft', __( 'Sorry, comments are not allowed for this item.' ), 403 ); … … 3388 3376 ); 3389 3377 } 3378 3379 /** 3380 * Sets the last changed time for the 'comment' cache group. 3381 * 3382 * @since 5.0.0 3383 */ 3384 function wp_cache_set_comments_last_changed() { 3385 wp_cache_set( 'last_changed', microtime(), 'comment' ); 3386 }
Note: See TracChangeset
for help on using the changeset viewer.