Make WordPress Core


Ignore:
Timestamp:
05/09/2004 09:30:57 PM (22 years ago)
Author:
michelvaldrighi
Message:

fixed GMT upgrade issues, should fix showstopper bug?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/upgrade-functions.php

    r1244 r1251  
    752752        }
    753753
    754         // Add post_date_gmt, post_modified_gmt, comment_date_gmt fields
    755         $got_gmt_fields = 0;
    756         foreach ($wpdb->get_col("DESC $tableposts", 0) as $column ) {
    757                 if ($debug) echo("checking $column == $column_name<br />");
    758                 if ($column == 'post_date_gmt') {
    759                         $got_gmt_fields++;
    760                 }
    761         }
     754        // Check if we already set the GMT fields (if we did, then
     755        // MAX(post_date_gmt) can't be '0000-00-00 00:00:00'
     756        // <michel_v> I just slapped myself silly for not thinking about it earlier
     757        $got_gmt_fields = ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $tableposts") == '0000-00-00 00:00:00') ? false : true;
     758
    762759        if (!$got_gmt_fields) {
    763760
     
    766763                $add_minutes = intval(60 * ($diff_gmt_weblogger - $add_hours));
    767764                $wpdb->query("UPDATE $tableposts SET post_date_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
    768                 $wpdb->query("UPDATE $tableposts SET post_modified_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE) WHERE post_modified != '0000-00-00 00:00:00'");
     765                $wpdb->query("UPDATE $tableposts SET post_modified = post_date");
     766                $wpdb->query("UPDATE $tableposts SET post_modified_gmt = DATE_ADD(post_modified, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE) WHERE post_modified != '0000-00-00 00:00:00'");
    769767                $wpdb->query("UPDATE $tablecomments SET comment_date_gmt = DATE_ADD(comment_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
    770768                $wpdb->query("UPDATE $tableusers SET dateYMDhour = DATE_ADD(dateYMDhour, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
Note: See TracChangeset for help on using the changeset viewer.