fixed GMT upgrade issues, should fix showstopper bug?
git-svn-id: https://develop.svn.wordpress.org/trunk@1251 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
859b82387e
commit
16fa949f55
|
@ -751,21 +751,19 @@ function upgrade_110() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add post_date_gmt, post_modified_gmt, comment_date_gmt fields
|
// Check if we already set the GMT fields (if we did, then
|
||||||
$got_gmt_fields = 0;
|
// MAX(post_date_gmt) can't be '0000-00-00 00:00:00'
|
||||||
foreach ($wpdb->get_col("DESC $tableposts", 0) as $column ) {
|
// <michel_v> I just slapped myself silly for not thinking about it earlier
|
||||||
if ($debug) echo("checking $column == $column_name<br />");
|
$got_gmt_fields = ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $tableposts") == '0000-00-00 00:00:00') ? false : true;
|
||||||
if ($column == 'post_date_gmt') {
|
|
||||||
$got_gmt_fields++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$got_gmt_fields) {
|
if (!$got_gmt_fields) {
|
||||||
|
|
||||||
// Add or substract time to all dates, to get GMT dates
|
// Add or substract time to all dates, to get GMT dates
|
||||||
$add_hours = intval($diff_gmt_weblogger);
|
$add_hours = intval($diff_gmt_weblogger);
|
||||||
$add_minutes = intval(60 * ($diff_gmt_weblogger - $add_hours));
|
$add_minutes = intval(60 * ($diff_gmt_weblogger - $add_hours));
|
||||||
$wpdb->query("UPDATE $tableposts SET post_date_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
|
$wpdb->query("UPDATE $tableposts SET post_date_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
|
||||||
$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'");
|
$wpdb->query("UPDATE $tableposts SET post_modified = post_date");
|
||||||
|
$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'");
|
||||||
$wpdb->query("UPDATE $tablecomments SET comment_date_gmt = DATE_ADD(comment_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
|
$wpdb->query("UPDATE $tablecomments SET comment_date_gmt = DATE_ADD(comment_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
|
||||||
$wpdb->query("UPDATE $tableusers SET dateYMDhour = DATE_ADD(dateYMDhour, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
|
$wpdb->query("UPDATE $tableusers SET dateYMDhour = DATE_ADD(dateYMDhour, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue