Making WordPress.org


Ignore:
Timestamp:
03/12/2024 02:27:28 AM (3 years ago)
Author:
dd32
Message:

Plugin Directory: Upload: Don't overwrite the post_date field when uploading a new version of the plugin.

This will allow for more performant queries for pending plugins.

See #7384

File:
1 edited

Legend:

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

    r13259 r13308  
    18341834                $slug  = $args['post_name'] ?: sanitize_title( $title );
    18351835
     1836                // Remove null items (date-related fields) to fallback to the defaults below.
     1837                $args = array_filter(
     1838                        $args,
     1839                        function( $item ) {
     1840                                return ! is_null( $item );
     1841                        }
     1842                );
     1843
    18361844                $post_date     = current_time( 'mysql' );
    18371845                $post_date_gmt = current_time( 'mysql', 1 );
     
    18471855                ) );
    18481856
    1849                 $update = ! empty( $args['ID'] );
    18501857                $result = wp_insert_post( $args, true );
    18511858
    18521859                if ( ! is_wp_error( $result ) ) {
    18531860                        wp_cache_set( $result, $slug, 'plugin-slugs' );
     1861
    18541862                        $result = get_post( $result );
    1855 
    1856                         if ( ! $update ) {
    1857                                 $owner = get_userdata( $result->post_author );
    1858                                 Tools::audit_log( sprintf(
    1859                                         'Submitted by <a href="%s">%s</a>.',
    1860                                         esc_url( 'https://profiles.wordpress.org/' . $owner->user_nicename . '/' ),
    1861                                         $owner->user_login
    1862                                 ), $result->ID );
    1863                         }
    18641863                }
    18651864
Note: See TracChangeset for help on using the changeset viewer.