Making WordPress.org

Changeset 13024


Ignore:
Timestamp:
12/07/2023 08:38:27 AM (3 months ago)
Author:
dd32
Message:

Plugin Directory: Reviewer Tools: Make the Zip & LOC columns sortable, cleanup the sort metadata after the ZIP is removed.

See #7285.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
3 edited

Legend:

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

    r13017 r13024  
    241241        }
    242242
    243         if ( 'assigned_reviewer_time' === $query->query['orderby'] ?? '' ) {
     243        $orderby                    = $query->query['orderby'] ?? '';
     244        $possible_orderby_meta_keys = [
     245            'assigned_reviewer_time',
     246            '_submitted_zip_loc',
     247            '_submitted_zip_size',
     248        ];
     249        if ( in_array( $orderby, $possible_orderby_meta_keys, true ) ) {
    244250            $meta_query = $query->get( 'meta_query' ) ?: [];
    245251
    246             $meta_query['assigned_reviewer_time'] = [
    247                 'key'     => 'assigned_reviewer_time',
     252            $meta_query[ $orderby ] = [
     253                'key'     => $orderby,
    248254                'type'    => 'unsigned',
    249255            ];
     
    251257            $query->set( 'meta_query', $meta_query );
    252258        }
    253 
    254259    }
    255260
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php

    r13021 r13024  
    667667        }
    668668
    669         $attachments = get_posts( [
    670             'post_parent'    => $post->ID,
    671             'post_type'      => 'attachment',
    672             'post_mime_type' => 'application/zip',
    673             'posts_per_page' => 1,
    674             'orderby'        => 'post_date',
    675             'order'          => 'DESC',
    676         ] )[0];
    677 
    678669        foreach ( get_attached_media( 'application/zip', $post ) as $zip_file ) {
    679670            $zip_size = size_format( filesize( get_attached_file( $zip_file->ID ) ), 1 );
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-zip-cleanup.php

    r12191 r13024  
    8484            }
    8585
     86            // Cleanup ZIP-related metadata.
     87            delete_post_meta( $plugin->ID, '_submitted_zip_size' );
     88            delete_post_meta( $plugin->ID, '_submitted_zip_loc' );
     89
    8690            // Include some log output for debugging.
    8791            $filename = basename( wp_get_attachment_url( $attachment->ID ) );
Note: See TracChangeset for help on using the changeset viewer.