Making WordPress.org


Ignore:
Timestamp:
01/05/2024 01:25:28 AM (3 years ago)
Author:
dd32
Message:

Markdown Importer: Don't constantly update posts which have fields derrived from the manifest.

This avoids calling wp_update_post() with no changes, which causes the post_modified dates to be bumped every 15 minutes.

See https://github.com/WordPress/wporg-developer/issues/456

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-markdown/inc/class-importer.php

    r12504 r13089  
    397397                }
    398398
     399                // Check to see if this differs from the actual post.
     400                if ( $post_data ) {
     401                        $post = get_post( $post_id );
     402                        foreach ( $post_data as $field => $value ) {
     403                                if ( $value == $post->$field ) {
     404                                        // Unset it to prevent calling `wp_update_post()` with this and bumping the last_modified date.
     405                                        unset( $post_data[ $field ] );
     406                                }
     407                        }
     408                }
     409
    399410                if ( $do_update && $post_data ) {
    400411                        $post_data['ID'] = $post_id;
Note: See TracChangeset for help on using the changeset viewer.