Making WordPress.org


Ignore:
Timestamp:
11/02/2017 05:37:31 AM (9 years ago)
Author:
dd32
Message:

Plugin Directory: Bump last_updated when the built ZIP changes, which may be as simple as a readme update.
This restores the behaviour of bumping the Tested up to header to allow plugins to avoid the 2 year unupdated banner.
This also fixes the expectation of last_updated being reflective of the last development changes, for example when the plugin uses trunk as it's stable_tag.

Fixes #2644

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php

    r6022 r6073  
    8282                $plugin->post_excerpt = trim( $readme->short_description ) ?: $headers->Description ?: $plugin->post_excerpt;
    8383
    84                 // Bump last updated if the version has changed, or if the post_modified is empty (which is the case for many initial checkins).
    85                 if ( ( !isset( $headers->Version ) || $headers->Version != get_post_meta( $plugin->ID, 'version', true ) ) ||
    86                          ( $plugin->post_modified == '0000-00-00 00:00:00' ) ) {
     84                /*
     85                 * Bump last updated if:
     86                 * - The version has changed.
     87                 * - The post_modified is empty, which is the case for many initial checkins.
     88                 * - A tag (or trunk) commit is made to the current stable. The build has changed, even if not new version.
     89                 */
     90                if (
     91                        ( !isset( $headers->Version ) || $headers->Version != get_post_meta( $plugin->ID, 'version', true ) ) ||
     92                        $plugin->post_modified == '0000-00-00 00:00:00' ||
     93                        ( $svn_changed_tags && in_array( $svn_changed_tags, ( $stable_tag ?: 'trunk' ), true ) )
     94                ) {
    8795                        $plugin->post_modified = $plugin->post_modified_gmt = current_time( 'mysql' );
    8896                }
     
    136144
    137145                foreach ( $this->plugin_headers as $plugin_header => $meta_field ) {
     146                        if ( 'Version' == $plugin_header ) {
     147                                continue; // We'll specifically update the latest version after everything is built.
     148                        }
    138149                        update_post_meta( $plugin->ID, $meta_field, ( isset( $headers->$plugin_header ) ? wp_slash( $headers->$plugin_header ) : '' ) );
    139150                }
     
    160171
    161172                // Finally, set the new version live.
    162                 update_post_meta( $plugin->ID, 'stable_tag', $stable_tag );
     173                update_post_meta( $plugin->ID, 'stable_tag', wp_slash( $stable_tag ) );
     174                update_post_meta( $plugin->ID, 'version',    wp_slash( $headers->Version ) );
    163175
    164176                // Ensure that the API gets the updated data
Note: See TracChangeset for help on using the changeset viewer.