WordPress.org

Making WordPress.org


Ignore:
Timestamp:
04/04/2017 08:44:06 AM (3 years ago)
Author:
dd32
Message:

Plugin Directory: Update API: Fix a bug in the update api updater which would cause new plugins not to get a row added to the version lookup table for the update api.
This also removes the ability for a plugin in approved state from being inserted, just to limit the size of the table from the thousands of approved-but-not-uploaded plugins.

See #2112

File:
1 edited

Legend:

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

    r5194 r5236  
    2424                p.post_type = 'plugin'
    2525                AND (
    26                     p.post_status IN( 'publish', 'approved', 'disabled', 'closed' ) OR
     26                    p.post_status IN( 'publish', 'disabled', 'closed' ) OR
    2727                    u.plugin_id IS NOT NULL
    2828                )
     
    5656        $post = Plugin_Directory::get_plugin_post( $plugin_slug );
    5757
    58         if ( ! $post ) {
     58        if ( ! $post || ! in_array( $post->post_status, array( 'publish', 'disabled', 'closed' ) ) ) {
    5959            $wpdb->delete(  $wpdb->prefix . 'update_source', compact( 'plugin_slug' ) );
    6060            return true;
     
    8080
    8181        if (
    82             $wpdb->update( $wpdb->prefix . 'update_source', $data, array( 'plugin_slug' => $post->post_name ) ) &&
     82            ! $wpdb->update( $wpdb->prefix . 'update_source', $data, array( 'plugin_slug' => $post->post_name ) ) &&
    8383            ! $wpdb->get_var( $wpdb->prepare( "SELECT `plugin_slug` FROM `{$wpdb->prefix}update_source` WHERE `plugin_slug` = %s", $post->post_name ) )
    8484        ) {
Note: See TracChangeset for help on using the changeset viewer.