Ticket #21115: 21115.diff
File 21115.diff, 2.3 KB (added by , 12 years ago) |
---|
-
wp-includes/comment.php
406 406 */ 407 407 function get_lastcommentmodified($timezone = 'server') { 408 408 global $wpdb; 409 static $cache_lastcommentmodified = array();410 409 411 if ( isset($cache_lastcommentmodified[$timezone]) ) 412 return $cache_lastcommentmodified[$timezone]; 410 $timezone = strtolower( $timezone ); 411 if ( ! in_array( $timezone, array( 'gmt', 'blog', 'server' ) ) ) 412 return; 413 413 414 if ( $last_modified = wp_cache_get( "lastmodified:$timezone", 'comment' ) ) 415 return $last_modified; 416 414 417 $add_seconds_server = date('Z'); 415 418 416 switch ( strtolower($timezone)) {419 switch ( $timezone ) { 417 420 case 'gmt': 418 $last commentmodified = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1");421 $last_modified = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1"); 419 422 break; 420 423 case 'blog': 421 $last commentmodified = $wpdb->get_var("SELECT comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1");424 $last_modified = $wpdb->get_var("SELECT comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1"); 422 425 break; 423 426 case 'server': 424 $last commentmodified = $wpdb->get_var($wpdb->prepare("SELECT DATE_ADD(comment_date_gmt, INTERVAL %s SECOND) FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1", $add_seconds_server));427 $last_modified = $wpdb->get_var($wpdb->prepare("SELECT DATE_ADD(comment_date_gmt, INTERVAL %s SECOND) FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1", $add_seconds_server)); 425 428 break; 426 429 } 427 430 428 $cache_lastcommentmodified[$timezone] = $lastcommentmodified; 429 430 return $lastcommentmodified; 431 wp_cache_add( "lastmodified:$timezone", $last_modified, 'comment' ); 432 return $last_modified; 431 433 } 432 434 433 435 /** … … 1930 1932 wp_cache_delete($id, 'comment'); 1931 1933 1932 1934 wp_cache_set('last_changed', time(), 'comment'); 1935 wp_cache_delete( 'lastmodified:gmt', 'comment' ); 1936 wp_cache_delete( 'lastmodified:server', 'comment' ); 1937 wp_cache_delete( 'lastmodified:blog', 'comment' ); 1933 1938 } 1934 1939 1935 1940 /**