Changeset 10214 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
- Timestamp:
- 08/28/2020 05:36:38 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
r10199 r10214 7 7 use WordPressdotorg\Plugin_Directory\Block_JSON; 8 8 use WordPressdotorg\Plugin_Directory\Plugin_Directory; 9 use WordPressdotorg\Plugin_Directory\Email\Release_Confirmation as Release_Confirmation_Email; 9 10 use WordPressdotorg\Plugin_Directory\Readme\Parser; 10 11 use WordPressdotorg\Plugin_Directory\Template; … … 75 76 $headers = $data['plugin_headers']; 76 77 $stable_tag = $data['stable_tag']; 78 $last_committer = $data['last_committer']; 79 $last_revision = $data['last_revision']; 77 80 $tagged_versions = $data['tagged_versions']; 78 81 $last_modified = $data['last_modified']; 79 82 $blocks = $data['blocks']; 80 83 $block_files = $data['block_files']; 84 85 // Release confirmation 86 if ( $plugin->release_confirmation ) { 87 if ( 'trunk' === $stable_tag ) { 88 throw new Exception( 'Plugin cannot be released from trunk due to release confirmation being enabled.' ); 89 } 90 91 $release = Plugin_Directory::get_release( $plugin, $stable_tag ); 92 93 // This tag is unknown? Trigger email. 94 if ( ! $release ) { 95 Plugin_Directory::add_release( 96 [ 97 'tag' => $stable_tag, 98 'version' => $headers->Version, 99 'committer' => [ $last_committer ], 100 'revision' => [ $last_revision ] 101 ] 102 ); 103 104 $email = new Release_Confirmation_Email( 105 $plugin, 106 Tools::get_plugin_committers( $plugin_slug ), 107 [ 108 'release' => $releases[ $stable_tag ], 109 'who' => $last_committer, 110 'readme' => $readme, 111 'headers' => $headers, 112 ] 113 ); 114 $email->send(); 115 116 throw new Exception( 'Plugin release not confirmed; email triggered.' ); 117 } 118 119 // Check that the tag is approved. 120 if ( ! $release['confirmed'] ) { 121 122 if ( ! in_array( $last_committer, $release['committer'], true ) ) { 123 $release['committer'][] = $last_committer; 124 } 125 if ( ! in_array( $last_revision, $release['revision'], true ) ) { 126 $release['revision'][] = $last_revision; 127 } 128 129 // Update with ^ 130 Plugin_Directory::add_release( $plugin, $release ); 131 132 throw new Exception( 'Plugin release not confirmed.' ); 133 } 134 135 // At this point we can assume that the release was confirmed, and should be imported. 136 } 81 137 82 138 $content = ''; … … 261 317 } 262 318 319 $plugin = Plugin_Directory::get_plugin_post( $plugin_slug ); 320 321 // Don't rebuild release-confirmation-required tags. 322 if ( $plugin->release_confirmation ) { 323 foreach ( $versions_to_build as $i => $tag ) { 324 $release = Plugin_Directory::get_release( $plugin, $tag ); 325 326 if ( ! $release || ( $release['zips_built'] && $release['confirmations_required'] ) ) { 327 unset( $versions_to_build[ $i ] ); 328 } else { 329 $release['zips_built'] = true; 330 Plugin_Directory::add_release( $release ); 331 } 332 333 } 334 } 335 336 if ( ! $versions_to_build ) { 337 return false; 338 } 339 263 340 // Rebuild/Build $build_zips 264 341 try { … … 390 467 } 391 468 469 $last_committer = $svn_info['result']['Last Changed Author'] ?? ''; 470 $last_revision = $svn_info['result']['Last Changed Rev'] ?? 0; 471 392 472 $svn_export = SVN::export( 393 473 $stable_url, … … 549 629 } ) ); 550 630 551 return compact( 'readme', 'stable_tag', 'last_modified', ' tmp_dir', 'plugin_headers', 'assets', 'tagged_versions', 'blocks', 'block_files' );631 return compact( 'readme', 'stable_tag', 'last_modified', 'last_committer', 'last_revision', 'tmp_dir', 'plugin_headers', 'assets', 'tagged_versions', 'blocks', 'block_files' ); 552 632 } 553 633
Note: See TracChangeset
for help on using the changeset viewer.