Making WordPress.org


Ignore:
Timestamp:
06/05/2019 04:34:52 AM (7 years ago)
Author:
dd32
Message:

Plugin Directory: Jobs: Update the Tested-up-to version in the API update-check endpoints when the plugin directory automatically bumps the tested-up-to value for plugins.

This also runs the 'Meta Sync' cron task whenever a new WordPress release is made, to help speed up the rate at which Plugins show the latest version in their 'tested' fields.

Fixes #4468.

File:
1 edited

Legend:

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

    r6642 r8918  
    107107                }
    108108
    109                 $equivs     = wporg_get_version_equivalents();
    110                 $equivs_key = md5( serialize( $equivs ) );
    111                 if ( $equivs_key === get_option( 'plugin_last_tested_sync' ) ) {
    112                         return;
    113                 }
     109                $equivs = wporg_get_version_equivalents();
    114110
    115111                $latest_equiv = array();
    … …  
    121117
    122118                $tested_meta_value_esc_sql = '"' . implode( '", "', array_map( 'esc_sql', array_keys( $latest_equiv ) ) ) . '"';
    123                 $tested_values             = $wpdb->get_results( "SELECT post_id, meta_value FROM {$wpdb->postmeta} WHERE meta_key = 'tested' AND meta_value IN( {$tested_meta_value_esc_sql} )" );
     119                $tested_values             = $wpdb->get_results( "SELECT post_id, post_name, meta_value FROM {$wpdb->postmeta} pm JOIN {$wpdb->posts} p ON pm.post_id = p.ID WHERE meta_key = 'tested' AND meta_value IN( {$tested_meta_value_esc_sql} )" );
    124120
    125121                foreach ( $tested_values as $row ) {
    … …  
    129125                                $latest_equiv[ $row->meta_value ]
    130126                        );
     127
     128                        // Update the API endpoints with the new data
     129                        API_Update_Updater::update_single_plugin( $row->post_name );
    131130                }
    132 
    133                 update_option( 'plugin_last_tested_sync', $equivs_key );
    134131        }
    135132}
Note: See TracChangeset for help on using the changeset viewer.