Changeset 1799 for trunk/wp-includes/functions.php
- Timestamp:
- 10/14/2004 08:27:56 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r1794 r1799 140 140 } 141 141 return $lastpostmodified; 142 } 143 144 function get_lastcommentmodified($timezone = 'server') { 145 global $tablecomments, $cache_lastcommentmodified, $pagenow, $wpdb; 146 $add_seconds_blog = get_settings('gmt_offset') * 3600; 147 $add_seconds_server = date('Z'); 148 $now = current_time('mysql', 1); 149 if ( !isset($cache_lastcommentmodified[$timezone]) ) { 150 switch(strtolower($timezone)) { 151 case 'gmt': 152 $lastcommentmodified = $wpdb->get_var("SELECT comment_date_gmt FROM $tablecomments WHERE comment_date_gmt <= '$now' ORDER BY comment_date_gmt DESC LIMIT 1"); 153 break; 154 case 'blog': 155 $lastcommentmodified = $wpdb->get_var("SELECT comment_date FROM $tablecomments WHERE comment_date_gmt <= '$now' ORDER BY comment_date_gmt DESC LIMIT 1"); 156 break; 157 case 'server': 158 $lastcommentmodified = $wpdb->get_var("SELECT DATE_ADD(comment_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $tablecomments WHERE comment_date_gmt <= '$now' ORDER BY comment_date_gmt DESC LIMIT 1"); 159 break; 160 } 161 $cache_lastcommentmodified[$timezone] = $lastcommentmodified; 162 } else { 163 $lastcommentmodified = $cache_lastcommentmodified[$timezone]; 164 } 165 return $lastcommentmodified; 142 166 } 143 167
Note: See TracChangeset
for help on using the changeset viewer.