mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Date/Time: XML-RPC: Сalculate the proper offset for GMT in wp.newPost, wp.editComment, mw.newPost, mw.editPost when post_date or comment_date is set.
Previously, `post_date` or `comment_date` was assumed to be GMT, which is only true if the timezone string for the site matches GMT. Add unit tests. Props Rarst, smerriman, justdaiv, wonderboymusic, noyle. Fixes #30429. git-svn-id: https://develop.svn.wordpress.org/trunk@46864 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1469,8 +1469,8 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$post_data['edit_date'] = false;
|
||||
|
||||
if ( ! empty( $dateCreated ) ) {
|
||||
$post_data['post_date'] = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) );
|
||||
$post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, 'GMT' );
|
||||
$post_data['post_date'] = iso8601_to_datetime( $dateCreated );
|
||||
$post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, 'gmt' );
|
||||
|
||||
// Flag the post date to be edited.
|
||||
$post_data['edit_date'] = true;
|
||||
@@ -3766,8 +3766,8 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
if ( ! empty( $content_struct['date_created_gmt'] ) ) {
|
||||
// We know this is supposed to be GMT, so we're going to slap that Z on there by force
|
||||
$dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z';
|
||||
$comment['comment_date'] = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) );
|
||||
$comment['comment_date_gmt'] = iso8601_to_datetime( $dateCreated, 'GMT' );
|
||||
$comment['comment_date'] = get_date_from_gmt( $dateCreated );
|
||||
$comment['comment_date_gmt'] = iso8601_to_datetime( $dateCreated, 'gmt' );
|
||||
}
|
||||
|
||||
if ( isset( $content_struct['content'] ) ) {
|
||||
@@ -5485,8 +5485,8 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
}
|
||||
|
||||
if ( ! empty( $dateCreated ) ) {
|
||||
$post_date = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) );
|
||||
$post_date_gmt = iso8601_to_datetime( $dateCreated, 'GMT' );
|
||||
$post_date = iso8601_to_datetime( $dateCreated );
|
||||
$post_date_gmt = iso8601_to_datetime( $dateCreated, 'gmt' );
|
||||
} else {
|
||||
$post_date = '';
|
||||
$post_date_gmt = '';
|
||||
@@ -5874,8 +5874,8 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$edit_date = false;
|
||||
|
||||
if ( ! empty( $dateCreated ) ) {
|
||||
$post_date = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) );
|
||||
$post_date_gmt = iso8601_to_datetime( $dateCreated, 'GMT' );
|
||||
$post_date = iso8601_to_datetime( $dateCreated );
|
||||
$post_date_gmt = iso8601_to_datetime( $dateCreated, 'gmt' );
|
||||
|
||||
// Flag the post date to be edited.
|
||||
$edit_date = true;
|
||||
|
||||
Reference in New Issue
Block a user