Changeset 13637
- Timestamp:
- 05/01/2024 01:51:39 AM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
r13551 r13637 29 29 // Readme fields which get stored in plugin meta 30 30 public $readme_fields = array( 31 'tested',32 31 'donate_link', 33 32 'license', … … 37 36 38 37 // These headers are stored as post meta, but are handled separately. 38 // 'tested', 39 39 // 'requires', 40 40 // 'requires_php', … … 320 320 } 321 321 322 // Update the tested-up-to value323 $tested = $readme->tested;324 if ( function_exists( 'wporg_get_version_equivalents' ) ) {325 foreach ( wporg_get_version_equivalents() as $latest_compatible_version => $compatible_with ) {326 if ( in_array( $readme->tested, $compatible_with, true ) ) {327 $tested = $latest_compatible_version;328 break;329 }330 }331 }332 333 322 // Update all readme meta 334 323 foreach ( $this->readme_fields as $readme_field ) { 335 $value = ( 'tested' == $readme_field ) ? $tested : $readme->$readme_field; 336 update_post_meta( $plugin->ID, $readme_field, wp_slash( $value ) ); 324 update_post_meta( $plugin->ID, $readme_field, wp_slash( $readme->$readme_field ) ); 337 325 } 338 326 … … 342 330 } 343 331 344 // Update the Requires and Requires PHPfields, prefering those from the Plugin Headers.332 // Update the Requires, Requires PHP, and Tested up to fields, prefering those from the Plugin Headers. 345 333 // Unfortunately the value within $headers is not always a well-formed value. 346 334 $requires = $readme->requires; 347 335 $requires_php = $readme->requires_php; 336 $tested = $readme->tested; 348 337 if ( $headers->RequiresWP && preg_match( '!^[\d.]{3,}$!', $headers->RequiresWP ) ) { 349 338 $requires = $headers->RequiresWP; … … 351 340 if ( $headers->RequiresPHP && preg_match( '!^[\d.]{3,}$!', $headers->RequiresPHP ) ) { 352 341 $requires_php = $headers->RequiresPHP; 342 } 343 if ( $headers->TestedUpTo && preg_match( '!^[\d.]{3,}$!', $headers->TestedUpTo ) ) { 344 $tested = $headers->TestedUpTo; 345 } 346 347 // Sanitize the tested version. 348 if ( function_exists( 'wporg_get_version_equivalents' ) ) { 349 foreach ( wporg_get_version_equivalents() as $latest_compatible_version => $compatible_with ) { 350 if ( in_array( $tested, $compatible_with, true ) ) { 351 $tested = $latest_compatible_version; 352 break; 353 } 354 } 353 355 } 354 356 … … 364 366 update_post_meta( $plugin->ID, 'requires', wp_slash( $requires ) ); 365 367 update_post_meta( $plugin->ID, 'requires_php', wp_slash( $requires_php ) ); 368 update_post_meta( $plugin->ID, 'tested', wp_slash( $tested ) ); 366 369 update_post_meta( $plugin->ID, 'tagged_versions', wp_slash( array_keys( $tagged_versions ) ) ); 367 370 update_post_meta( $plugin->ID, 'sections', wp_slash( array_keys( $readme->sections ) ) ); … … 973 976 if ( ! isset( $headers['RequiresPlugins'] ) ) { 974 977 $headers['RequiresPlugins'] = 'Requires Plugins'; 978 } 979 // https://meta.trac.wordpress.org/ticket/4621 980 if ( ! isset( $headers['TestedUpTo'] ) ) { 981 $headers['TestedUpTo'] = 'Tested up to'; 975 982 } 976 983
Note: See TracChangeset
for help on using the changeset viewer.