Ticket #5680: ticket_5680.patch

File ticket_5680.patch, 3.0 KB (added by rubys, 4 years ago)

Allow AtomPub to update the updated/modified date for entries

  • wp-includes/post.php

     
    18831883        if ( empty($post_date_gmt) ) 
    18841884                $post_date_gmt = current_time('mysql', 1); 
    18851885 
     1886        if ( empty($post_modified) ) 
     1887                $post_modified = $post_date; 
     1888        if ( empty($post_modified_gmt) ) 
     1889                $post_modified_gmt = $post_date_gmt; 
     1890 
    18861891        if ( empty($comment_status) ) { 
    18871892                if ( $update ) 
    18881893                        $comment_status = 'closed'; 
  • wp-app.php

     
    332332                $post_title = $parsed->title[1]; 
    333333                $post_content = $parsed->content[1]; 
    334334                $post_excerpt = $parsed->summary[1]; 
    335                 $pubtimes = $this->get_publish_time($parsed->published); 
     335                $pubtimes = $this->get_publish_time($entry->published); 
    336336                $post_date = $pubtimes[0]; 
    337337                $post_date_gmt = $pubtimes[1]; 
     338                $pubtimes = $this->get_publish_time($parsed->updated); 
     339                $post_modified = $pubtimes[0]; 
     340                $post_modified_gmt = $pubtimes[1]; 
    338341 
    339342                // let's not go backwards and make something draft again. 
    340343                if(!$publish && $post_status == 'draft') { 
     
    343346                        $post_status = 'publish'; 
    344347                } 
    345348 
    346                 $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_date', 'post_date_gmt'); 
     349                $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt'); 
    347350                $this->escape($postdata); 
    348351 
    349352                $result = wp_update_post($postdata); 
     
    472475 
    473476                $post_title = $parsed->title[1]; 
    474477                $post_content = $parsed->content[1]; 
     478                $pubtimes = $this->get_publish_time($parsed->updated); 
     479                $post_modified = $pubtimes[0]; 
     480                $post_modified_gmt = $pubtimes[1]; 
    475481 
    476                 $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt'); 
     482                $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_modified', 'post_modified_gmt'); 
    477483                $this->escape($postdata); 
    478484 
    479485                $result = wp_update_post($postdata); 
     
    581587                $pubtimes = $this->get_publish_time($entry->published); 
    582588                $post_date = $pubtimes[0]; 
    583589                $post_date_gmt = $pubtimes[1]; 
     590                $pubtimes = $this->get_publish_time($parsed->updated); 
     591                $post_modified = $pubtimes[0]; 
     592                $post_modified_gmt = $pubtimes[1]; 
    584593 
    585                 $post_data = compact('ID', 'post_date', 'post_date_gmt'); 
     594                $post_data = compact('ID', 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt'); 
    586595                $result = wp_update_post($post_data); 
    587596 
    588597                if (!$result) { 
     
    708717 
    709718                $count = get_option('posts_per_rss'); 
    710719 
    711                 wp('what_to_show=posts&posts_per_page=' . $count . '&offset=' . ($count * ($page-1) )); 
     720                wp('what_to_show=posts&posts_per_page=' . $count . '&offset=' . ($count * ($page-1) . '&orderby=modified')); 
    712721 
    713722                $post = $GLOBALS['post']; 
    714723                $posts = $GLOBALS['posts'];