Changeset 9050 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
- Timestamp:
- 07/16/2019 05:55:10 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
r8976 r9050 26 26 public $readme_fields = array( 27 27 'tested', 28 'requires',29 'requires_php',30 28 'donate_link', 31 29 'license', … … 33 31 'upgrade_notice', 34 32 'screenshots', 33 34 // These headers are stored as post meta, but are handled separately. 35 // 'requires', 36 // 'requires_php', 35 37 ); 36 38 … … 40 42 'Name' => 'header_name', 41 43 'PluginURI' => 'header_plugin_uri', 42 'Version' => 'version',43 44 'Author' => 'header_author', 44 45 'AuthorURI' => 'header_author_uri', 45 46 'TextDomain' => 'header_textdomain', 47 48 // These headers are stored in these fields, but are handled separately. 49 // 'Version' => 'version', 50 // 'RequiresWP' => 'requires', 51 // 'RequiresPHP' => 'requires_php', 46 52 ); 47 53 … … 147 153 } 148 154 155 // Store the plugin headers we need. Note that 'Version', 'RequiresWP', and 'RequiresPHP' are handled below. 149 156 foreach ( $this->plugin_headers as $plugin_header => $meta_field ) { 150 if ( 'Version' == $plugin_header ) {151 continue; // We'll specifically update the latest version after everything is built.152 }153 157 update_post_meta( $plugin->ID, $meta_field, ( isset( $headers->$plugin_header ) ? wp_slash( $headers->$plugin_header ) : '' ) ); 154 158 } 155 159 156 update_post_meta( $plugin->ID, 'tagged_versions', wp_slash( $tagged_versions ) ); 157 update_post_meta( $plugin->ID, 'sections', wp_slash( array_keys( $readme->sections ) ) ); 160 // Update the Requires and Requires PHP fields, prefering those from the Plugin Headers. 161 // Unfortunately the value within $headers is not always a well-formed value. 162 $requires = $readme->requires; 163 $requires_php = $readme->requires_php; 164 if ( $headers->RequiresWP && preg_match( '!^[\d.]{3,}$!', $headers->RequiresWP ) ) { 165 $requires = $headers->RequiresWP; 166 } 167 if ( $headers->RequiresPHP && preg_match( '!^[\d.]{3,}$!', $headers->RequiresPHP ) ) { 168 $requires_php = $headers->RequiresPHP; 169 } 170 171 update_post_meta( $plugin->ID, 'requires', wp_slash( $requires ) ); 172 update_post_meta( $plugin->ID, 'requires_php', wp_slash( $requires_php ) ); 173 update_post_meta( $plugin->ID, 'tagged_versions', wp_slash( $tagged_versions ) ); 174 update_post_meta( $plugin->ID, 'sections', wp_slash( array_keys( $readme->sections ) ) ); 158 175 update_post_meta( $plugin->ID, 'assets_screenshots', wp_slash( $assets['screenshot'] ) ); 159 update_post_meta( $plugin->ID, 'assets_icons', wp_slash( $assets['icon'] ) );160 update_post_meta( $plugin->ID, 'assets_banners', wp_slash( $assets['banner'] ) );161 update_post_meta( $plugin->ID, 'last_updated', wp_slash( $plugin->post_modified_gmt ) );162 update_post_meta( $plugin->ID, 'plugin_status', wp_slash( $plugin->post_status ) );176 update_post_meta( $plugin->ID, 'assets_icons', wp_slash( $assets['icon'] ) ); 177 update_post_meta( $plugin->ID, 'assets_banners', wp_slash( $assets['banner'] ) ); 178 update_post_meta( $plugin->ID, 'last_updated', wp_slash( $plugin->post_modified_gmt ) ); 179 update_post_meta( $plugin->ID, 'plugin_status', wp_slash( $plugin->post_status ) ); 163 180 164 181 // Calculate the 'plugin color' from the average color of the banner if provided. This is used for fallback icons.
Note: See TracChangeset
for help on using the changeset viewer.