Make WordPress Core

Changeset 1002


Ignore:
Timestamp:
03/25/2004 02:37:47 AM (22 years ago)
Author:
michelvaldrighi
Message:

fixed get_lastpostdate and get_lastpostmodified

File:
1 edited

Legend:

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

    r1001 r1002  
    102102    $add_seconds_blog = get_settings('gmt_offset') * 3600;
    103103    $add_seconds_server = date('Z');
    104     $now = gmdate('Y-m-d H:i:s');
     104    $now = current_time('mysql');
    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");
     109                break;
     110            case 'blog':
    108111                $lastpostdate = $wpdb->get_var("SELECT post_date FROM $tableposts WHERE post_date <= '$now' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1");
    109112                break;
    110             case 'blog':
    111                 $lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date, INTERVAL '$add_seconds_blog' SECOND) FROM $tableposts WHERE post_date <= '$now' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1");
    112                 break;
    113113            case 'server':
    114                 $lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date, INTERVAL '$add_seconds_server' SECOND) FROM $tableposts WHERE post_date <= '$now' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1");
     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");
    115115                break;
    116116        }
     
    130130        switch($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");
     133                break;
     134            case 'blog':
    132135                $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $tableposts WHERE post_modified <= '$now' AND post_status = 'publish' ORDER BY post_modified DESC LIMIT 1");
    133136                break;
    134             case 'blog':
    135                 $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified, INTERVAL '$add_seconds_blog' SECOND) FROM $tableposts WHERE post_modified <= '$now' AND post_status = 'publish' ORDER BY post_modified DESC LIMIT 1");
    136                 break;
    137137            case 'server':
    138                 $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified, INTERVAL '$add_seconds_server' SECOND) FROM $tableposts WHERE post_modified <= '$now' AND post_status = 'publish' ORDER BY post_modified DESC LIMIT 1");
     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");
    139139                break;
    140140        }
Note: See TracChangeset for help on using the changeset viewer.