Changeset 4423 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-meta-sync.php
- Timestamp:
- 11/26/2016 03:47:38 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-meta-sync.php
r4420 r4423 24 24 $this->sync_downloads(); 25 25 $this->sync_ratings(); 26 $this->update_tested_up_to(); 26 27 } 27 28 … … 39 40 FROM `{$wpdb->posts}` p 40 41 JOIN `{$bbpress_topic_slug_table}` t ON p.post_name = t.topic_slug 41 LEFTJOIN `{$download_count_table}` c on t.topic_id = c.topic_id42 JOIN `{$download_count_table}` c on t.topic_id = c.topic_id 42 43 LEFT JOIN `{$wpdb->postmeta}` pm ON p.id = pm.post_id AND pm.meta_key = 'downloads' 43 44 … … 96 97 update_option( 'plugin_last_review_sync', $current_review_time, 'no' ); 97 98 } 99 100 /** 101 * After WordPress is released, update the 'tested' meta keys to the latest version as 102 * specified by `wporg_get_version_equivalents()`. 103 */ 104 function update_tested_up_to() { 105 global $wpdb; 106 if ( ! function_exists( 'wporg_get_version_equivalents' ) ) { 107 return; 108 } 109 110 $equivs = wporg_get_version_equivalents(); 111 $equivs_key = md5( serialize( $equivs ) ); 112 if ( $equivs_key === get_option( 'plugin_last_tested_sync' ) ) { 113 return; 114 } 115 116 $latest_equiv = array(); 117 foreach ( $equivs as $latest_compatible_version => $compatible_with ) { 118 foreach ( $compatible_with as $version ) { 119 $latest_equiv[ $version ] = $latest_compatible_version; 120 } 121 } 122 123 $tested_meta_value_esc_sql = '"' . implode( '", "', array_map( 'esc_sql', array_keys( $latest_equiv ) ) ) . '"'; 124 $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} )" ); 125 126 foreach ( $tested_values as $row ) { 127 update_post_meta( 128 $row->post_id, 129 'tested', 130 $latest_equiv[ $row->meta_value ] 131 ); 132 } 133 134 update_option( 'plugin_last_tested_sync', $equivs_key ); 135 } 98 136 }
Note: See TracChangeset
for help on using the changeset viewer.