Making WordPress.org


Ignore:
Timestamp:
04/11/2017 04:28:33 AM (8 years ago)
Author:
dd32
Message:

Plugin Directory: The plugin post_type's post_modified date should only ever be changed in response to a SVN action, and not just because wp_update_post() was called.
This moves the code responsible for handling this special case from the plugin importer to globally affecting the site.

See #2605

File:
1 edited

Legend:

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

    r5247 r5316  
    9494        }
    9595
    96         add_filter( 'wp_insert_post_data', array( $this, 'filter_wp_insert_post_data' ), 10, 2 );
    9796        wp_update_post( $plugin );
    98         remove_filter( 'wp_insert_post_data', array( $this, 'filter_wp_insert_post_data' ) );
    9997
    10098        // Set categories if there aren't any yet. wp-admin takes precedent.
     
    379377
    380378    /**
    381      * Filters `wp_insert_post()` to respect the presented data.
    382      * This function overrides `wp_insert_post()`s constant updating of
    383      * the post_modified fields.
    384      *
    385      * @param array $data    The data to be inserted into the database.
    386      * @param array $postarr The raw data passed to `wp_insert_post()`.
    387      *
    388      * @return array The data to insert into the database.
    389      */
    390     public function filter_wp_insert_post_data( $data, $postarr ) {
    391         if ( 'plugin' === $postarr['post_type'] ) {
    392             $data['post_modified']     = $postarr['post_modified'];
    393             $data['post_modified_gmt'] = $postarr['post_modified_gmt'];
    394         }
    395         return $data;
    396     }
    397 
    398     /**
    399379     * Find the plugin readme file.
    400380     *
Note: See TracChangeset for help on using the changeset viewer.