Changeset 12175
- Timestamp:
- 11/01/2022 05:41:04 AM (11 months ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php
r11770 r12175 203 203 */ 204 204 public function approved( $post_id, $post ) { 205 $attachments = get_attached_media( 'application/zip', $post_id );206 205 $plugin_author = get_user_by( 'id', $post->post_author ); 207 206 … … 214 213 /* 215 214 Temporarily disable SVN prefill from ZIP files 215 $attachments = get_attached_media( 'application/zip', $post_id ); 216 216 if ( $attachments ) { 217 217 $attachment = end( $attachments ); … … 229 229 SVN::import( $dir, 'http://plugins.svn.wordpress.org/' . $post->post_name, sprintf( 'Adding %1$s by %2$s.', $post->post_title, $plugin_author->user_login ) ); 230 230 231 // Delete zips.232 foreach ( $attachments as $attachment ) {233 wp_delete_attachment( $attachment->ID, true );234 }235 236 231 // Grant commit access. 237 232 Tools::grant_plugin_committer( $post->post_name, $plugin_author ); … … 255 250 $original_permalink = $post->post_name; 256 251 $submission_date = get_the_modified_date( 'F j, Y', $post_id ); 257 258 // Delete zips.259 foreach ( get_attached_media( 'application/zip', $post_id ) as $attachment ) {260 wp_delete_attachment( $attachment->ID, true );261 }262 252 263 253 // Change slug to 'rejected-plugin-name-rejected' to free up 'plugin-name'. -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-review-tools.php
r12166 r12175 113 113 ] ); 114 114 115 if ( in_array( $post->post_status, [ 'draft', 'pending', 'new' ], true ) ) {116 117 $zip_files = array();118 foreach ( get_attached_media( 'application/zip', $post ) as $zip_file ) {119 $zip_files[ $zip_file->post_date ] = array( wp_get_attachment_url( $zip_file->ID ), $zip_file ); 120 }115 $zip_files = array(); 116 foreach ( get_attached_media( 'application/zip', $post ) as $zip_file ) { 117 $zip_files[ $zip_file->post_date ] = array( wp_get_attachment_url( $zip_file->ID ), $zip_file ); 118 } 119 120 if ( $zip_files ) { 121 121 uksort( $zip_files, function ( $a, $b ) { 122 122 return strtotime( $a ) < strtotime( $b ); 123 123 } ); 124 125 $zip_url = get_post_meta( $post->ID, '_submitted_zip', true );126 if ( $zip_url ) {127 // Back-compat only.128 $zip_files['User provided URL'] = array( $zip_url, null );129 }130 124 131 125 echo '<p><strong>Zip files:</strong></p>'; … … 133 127 foreach ( $zip_files as $zip_date => $zip ) { 134 128 list( $zip_url, $zip_file ) = $zip; 135 $zip_size = is_object( $zip_file ) ? size_format( filesize( get_attached_file( $zip_file->ID ) ), 1 ) : 'unknown size'; 136 137 printf( '<li>%s <a href="%s">%s</a> (%s)</li>', esc_html( $zip_date ), esc_url( $zip_url ), esc_html( $zip_url ), esc_html( $zip_size ) ); 129 $zip_size = size_format( filesize( get_attached_file( $zip_file->ID ) ), 1 ); 130 131 printf( 132 '<li>%1$s <a href="%2$s">%3$s</a> (%4$s)</li>', 133 esc_html( $zip_date ), 134 esc_url( $zip_url ), 135 esc_html( basename( $zip_url ) ), 136 esc_html( $zip_size ) 137 ); 138 138 } 139 139 echo '</ul>'; 140 140 } 141 142 if ( in_array( $post->post_status, [ 'draft', 'pending', 'new' ], true ) ) { 141 143 $slug_restricted = []; 142 144 $slug_reserved = []; -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-manager.php
r10230 r12175 24 24 add_action( 'plugin_directory_update_api_check', array( __NAMESPACE__ . '\API_Update_Updater', 'cron_trigger' ) ); 25 25 add_action( 'plugin_directory_translation_sync', array( __NAMESPACE__ . '\Translation_Sync', 'cron_trigger' ) ); 26 add_action( 'plugin_directory_zip_cleanup', array( __NAMESPACE__ . '\Zip_Cleanup', 'cron_trigger' ) ); 26 27 27 28 // A cronjob to check cronjobs … … 259 260 wp_schedule_event( time() + 60, 'daily', 'plugin_directory_translation_sync' ); 260 261 } 262 if ( ! wp_next_scheduled ( 'plugin_directory_zip_cleanup' ) ) { 263 wp_schedule_event( time() + 60, 'daily', 'plugin_directory_zip_cleanup' ); 264 } 261 265 262 266 // Check to see if `WP_CORE_LATEST_RELEASE` has changed since we last ran.
Note: See TracChangeset
for help on using the changeset viewer.