Making WordPress.org

Changeset 6873


Ignore:
Timestamp:
03/14/2018 05:14:59 AM (7 years ago)
Author:
dd32
Message:

Plugin Directory: Attempt to avoid storing invalid dates in postmeta for status changes. If the post modified date isn't available, assume now.

I'm not entirely sure post_modified_gmt is the correct field to use here, I suspect post_modified would be better, or perhaps even just using time() in all cases, but once again, I'm not sure why post_modified_gmt was used here instead.

Fixes #3511.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php

    r6534 r6873  
    151151
    152152        // Record the time a plugin was transitioned into a specific status.
    153         update_post_meta( $post->ID, "_{$new_status}", strtotime( $post->post_modified_gmt ) );
     153        if ( '0000-00-00 00:00:00' === $post->post_modified_gmt ) {
     154            // Assume now.
     155            update_post_meta( $post->ID, "_{$new_status}", time() );
     156        } else {
     157            update_post_meta( $post->ID, "_{$new_status}", strtotime( $post->post_modified_gmt ) );
     158        }
    154159    }
    155160
Note: See TracChangeset for help on using the changeset viewer.