WordPress.org

Make WordPress Core

Changeset 1042


Ignore:
Timestamp:
03/31/2004 06:06:45 PM (17 years ago)
Author:
michelvaldrighi
Message:

tweaked get_lastpostdate and get_lastpostmodified a bit for consistency

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r1035 r1042  
    102102    $add_seconds_blog = get_settings('gmt_offset') * 3600;
    103103    $add_seconds_server = date('Z');
    104     $now = current_time('mysql');
     104    $now = current_time('mysql', 1);
    105105    if ((!isset($cache_lastpostdate[$timezone])) OR (!$use_cache)) {
    106106        switch(strtolower($timezone)) {
    107107            case 'gmt':
    108                 $lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $tableposts WHERE post_date <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
     108                $lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $tableposts WHERE post_date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
    109109                break;
    110110            case 'blog':
    111                 $lastpostdate = $wpdb->get_var("SELECT post_date FROM $tableposts WHERE post_date <= '$now' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1");
     111                $lastpostdate = $wpdb->get_var("SELECT post_date FROM $tableposts WHERE post_date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
    112112                break;
    113113            case 'server':
    114                 $lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $tableposts WHERE post_date <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
     114                $lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $tableposts WHERE post_date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
    115115                break;
    116116        }
     
    126126    $add_seconds_blog = get_settings('gmt_offset') * 3600;
    127127    $add_seconds_server = date('Z');
    128     $now = gmdate('Y-m-d H:i:s');
     128    $now = current_time('mysql', 1);
    129129    if ((!isset($cache_lastpostmodified[$timezone])) OR (!$use_cache)) {
    130         switch($timezone) {
     130        switch(strtolower($timezone)) {
    131131            case 'gmt':
    132                 $lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $tableposts WHERE post_modified <= '$now' AND post_status = 'publish' ORDER BY post_modified DESC LIMIT 1");
     132                $lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $tableposts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
    133133                break;
    134134            case 'blog':
    135                 $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $tableposts WHERE post_modified <= '$now' AND post_status = 'publish' ORDER BY post_modified DESC LIMIT 1");
     135                $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $tableposts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
    136136                break;
    137137            case 'server':
    138                 $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $tableposts WHERE post_modified <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
     138                $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $tableposts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
    139139                break;
    140140        }
Note: See TracChangeset for help on using the changeset viewer.