From 839ea6c294833a043e9bc159e632d117297a0513 Mon Sep 17 00:00:00 2001 From: westi Date: Wed, 23 Jan 2008 20:25:08 +0000 Subject: [PATCH] Fix the updated times when publishing/editing with APP. See #5680 props rubys. git-svn-id: http://svn.automattic.com/wordpress/trunk@6645 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-app.php | 19 ++++++++++++++----- wp-includes/post.php | 5 +++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/wp-app.php b/wp-app.php index a4df2f27a7..acd5d90254 100644 --- a/wp-app.php +++ b/wp-app.php @@ -332,9 +332,12 @@ EOD; $post_title = $parsed->title[1]; $post_content = $parsed->content[1]; $post_excerpt = $parsed->summary[1]; - $pubtimes = $this->get_publish_time($parsed->published); + $pubtimes = $this->get_publish_time($entry->published); $post_date = $pubtimes[0]; $post_date_gmt = $pubtimes[1]; + $pubtimes = $this->get_publish_time($parsed->updated); + $post_modified = $pubtimes[0]; + $post_modified_gmt = $pubtimes[1]; // let's not go backwards and make something draft again. if(!$publish && $post_status == 'draft') { @@ -343,7 +346,7 @@ EOD; $post_status = 'publish'; } - $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_date', 'post_date_gmt'); + $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt'); $this->escape($postdata); $result = wp_update_post($postdata); @@ -472,8 +475,11 @@ EOD; $post_title = $parsed->title[1]; $post_content = $parsed->content[1]; + $pubtimes = $this->get_publish_time($parsed->updated); + $post_modified = $pubtimes[0]; + $post_modified_gmt = $pubtimes[1]; - $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt'); + $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_modified', 'post_modified_gmt'); $this->escape($postdata); $result = wp_update_post($postdata); @@ -581,8 +587,11 @@ EOD; $pubtimes = $this->get_publish_time($entry->published); $post_date = $pubtimes[0]; $post_date_gmt = $pubtimes[1]; + $pubtimes = $this->get_publish_time($parsed->updated); + $post_modified = $pubtimes[0]; + $post_modified_gmt = $pubtimes[1]; - $post_data = compact('ID', 'post_date', 'post_date_gmt'); + $post_data = compact('ID', 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt'); $result = wp_update_post($post_data); if (!$result) { @@ -708,7 +717,7 @@ EOD; $count = get_option('posts_per_rss'); - wp('what_to_show=posts&posts_per_page=' . $count . '&offset=' . ($count * ($page-1) )); + wp('what_to_show=posts&posts_per_page=' . $count . '&offset=' . ($count * ($page-1) . '&orderby=modified')); $post = $GLOBALS['post']; $posts = $GLOBALS['posts']; diff --git a/wp-includes/post.php b/wp-includes/post.php index 29ca1d1efb..97b3e2c025 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1883,6 +1883,11 @@ function wp_insert_attachment($object, $file = false, $parent = 0) { if ( empty($post_date_gmt) ) $post_date_gmt = current_time('mysql', 1); + if ( empty($post_modified) ) + $post_modified = $post_date; + if ( empty($post_modified_gmt) ) + $post_modified_gmt = $post_date_gmt; + if ( empty($comment_status) ) { if ( $update ) $comment_status = 'closed';