Changeset 13769 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php
- Timestamp:
- 06/04/2024 02:10:08 AM (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php
r13747 r13769 63 63 $upload_result = false; 64 64 65 /* 66 * Determine the maximum number of plugins a user can have in the queue. 67 * 68 * Plugin owners with more than 1m active installs can have up to 10 plugins in the queue. 69 * 70 * @see https://meta.trac.wordpress.org/ticket/76641 71 */ 72 $maximum_plugins_in_queue = 1; 73 $user_active_installs = array_sum( 74 wp_list_pluck( 75 get_posts( [ 76 'author' => get_current_user_id(), 77 'post_type' => 'plugin', 78 'post_status' => 'publish', // Only count published plugins. 79 'numberposts' => -1 80 ] ), 81 '_active_installs' 82 ) 83 ); 84 if ( $user_active_installs > 1000000 /* 1m+ */ ) { 85 $maximum_plugins_in_queue = 10; 86 } 87 65 88 list( $submitted_plugins, $submitted_counts ) = self::get_submitted_plugins(); 89 $can_submit_new_plugin = $submitted_counts->total < $maximum_plugins_in_queue; 66 90 67 91 if ( … … 70 94 ( 71 95 // New submission. 72 ! $submitted_counts->total &&73 96 empty( $_POST['plugin_id'] ) && 74 wp_verify_nonce( $_POST['_wpnonce'], 'wporg-plugins-upload' ) && 75 'upload' === $_POST['action'] 97 'upload' === $_POST['action'] && 98 $can_submit_new_plugin && 99 wp_verify_nonce( $_POST['_wpnonce'], 'wporg-plugins-upload' ) 76 100 ) || ( 77 101 // Existing submission … … 94 118 // Refresh the lists. 95 119 list( $submitted_plugins, $submitted_counts ) = self::get_submitted_plugins(); 120 $can_submit_new_plugin = $submitted_counts->total < $maximum_plugins_in_queue; 96 121 97 122 if ( ! empty( $message ) ) { … … 100 125 } 101 126 102 if ( ! is_wp_error( $upload_result ) || $submitted_counts->total ) :127 if ( ! is_wp_error( $upload_result ) || $submitted_counts->total /* has a plugin in the review queue */ ) : 103 128 $plugins = wp_count_posts( 'plugin', 'readable' ); 104 129 $oldest_plugin = get_posts( [ 'post_type' => 'plugin', 'post_status' => 'new', 'order' => 'ASC', 'orderby' => 'post_date_gmt', 'numberposts' => 1 ] ); … … 359 384 "</p></div>\n"; 360 385 361 } else if ( ! $submitted_counts->total && ( ! $upload_result || is_wp_error( $upload_result ) ) ) : ?> 386 } else if ( $can_submit_new_plugin && ( ! $upload_result || is_wp_error( $upload_result ) ) ) : 387 if ( $maximum_plugins_in_queue > 1 && $submitted_counts->total ) { 388 printf( 389 '<div class="notice notice-info notice-alt"><p>%s</p></div>', 390 sprintf( 391 /* translators: %s: Maximum number of plugins in the queue. */ 392 __( 'You can have up to %s plugins in the queue at a time. You may submit an additional plugin for review below.', 'wporg-plugins' ), 393 '<strong>' . number_format_i18n( $maximum_plugins_in_queue ) . '</strong>' 394 ) 395 ); 396 } 397 398 ?> 362 399 <form id="upload_form" class="plugin-upload-form" enctype="multipart/form-data" method="POST" action=""> 363 400 <?php wp_nonce_field( 'wporg-plugins-upload' ); ?> … … 461 498 <input id="upload_button" class="wp-block-button__link" type="submit" value="<?php esc_attr_e( 'Upload', 'wporg-plugins' ); ?>"/> 462 499 </form> 463 <?php endif; // ! $submitted_counts->total500 <?php endif; // $can_submit_new_plugin 464 501 465 502 return ob_get_clean();
Note: See TracChangeset
for help on using the changeset viewer.