Changeset 9052
- Timestamp:
- 07/17/2019 07:33:07 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
r9050 r9052 75 75 $tagged_versions = $data['tagged_versions']; 76 76 $blocks = $data['blocks']; 77 $block_files = $data['block_files']; 77 78 78 79 $content = ''; … … 189 190 // Store the block data, if known 190 191 if ( count( $blocks ) ) { 191 update_post_meta( $plugin->ID, 'all_blocks', $blocks ); 192 $changed = update_post_meta( $plugin->ID, 'all_blocks', $blocks ); 193 if ( $changed || count ( get_post_meta( $plugin->ID, 'block_name' ) ) !== count ( $blocks ) ) { 194 delete_post_meta( $plugin->ID, 'block_name' ); 195 foreach ( $blocks as $block ) { 196 add_post_meta( $plugin->ID, 'block_name', $block->name, false ); 197 } 198 } 192 199 } else { 193 200 delete_post_meta( $plugin->ID, 'all_blocks' ); 201 delete_post_meta( $plugin->ID, 'block_name' ); 202 } 203 204 // Only store block_files for plugins in the block directory 205 if ( count( $block_files ) && has_term( 'block', 'plugin_section', $plugin->ID ) ) { 206 update_post_meta( $plugin->ID, 'block_files', $block_files ); 207 } else { 208 delete_post_meta( $plugin->ID, 'block_files' ); 194 209 } 195 210 … … 440 455 } 441 456 442 return compact( 'readme', 'stable_tag', 'tmp_dir', 'plugin_headers', 'assets', 'tagged_versions', 'blocks' ); 457 // Find blocks dist/build JS files 458 $block_files = array(); 459 $dist_files = SVN::ls( 'https://plugins.svn.wordpress.org' . "/{$plugin_slug}/trunk/dist" ) ?: array(); 460 $build_files = SVN::ls( 'https://plugins.svn.wordpress.org' . "/{$plugin_slug}/trunk/build" ) ?: array(); 461 462 foreach ( $dist_files as $file ) { 463 #$block_files[] = 'https://plugins.svn.wordpress.org' . "/{$plugin_slug}/trunk/dist/" . $file; 464 $block_files[] = '/trunk/dist/' . $file; 465 } 466 467 foreach ( $build_files as $file ) { 468 #$block_files[] = 'https://plugins.svn.wordpress.org' . "/{$plugin_slug}/trunk/build/" . $file; 469 $block_files[] = '/trunk/build/' . $file; 470 } 471 472 return compact( 'readme', 'stable_tag', 'tmp_dir', 'plugin_headers', 'assets', 'tagged_versions', 'blocks', 'block_files' ); 443 473 } 444 474
Note: See TracChangeset
for help on using the changeset viewer.