Changeset 10065 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-block-plugin-checker.php
- Timestamp:
- 07/13/2020 07:40:02 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-block-plugin-checker.php
r10058 r10065 400 400 /** 401 401 * Does the plugin have a block name that already exists in the DB? 402 * Note that this isn't a blocker if we're re-running checks on a plugin that has already been uploaded, since it will match with itself. 402 * Note that this does not flag a match if we can tell it's the same plugin already in the repo. It will only 403 * trigger a warning if we identify the matched plugin to be the same author, and will trigger an error in all 404 * other cases. 403 405 */ 404 406 function check_for_duplicate_block_name() { 405 407 foreach ( $this->blocks as $block ) { 406 if ( ! trim( strval( $block->name ) ) )408 if ( ! trim( strval( $block->name ) ) ) { 407 409 continue; 410 } 408 411 409 412 $query_args = array( … … 413 416 'key' => 'block_name', 414 417 'value' => $block->name, 415 ) 416 ) 418 ), 419 ), 417 420 ); 418 421 … … 420 423 if ( $query->found_posts > 0 ) { 421 424 foreach ( $query->posts as $post ) { 422 if ( $this->slug && $this->slug === $post->post_name ) 423 continue; // It's this very same plugin 424 425 $this->record_result( __FUNCTION__, 426 'info', 427 sprintf( __( 'Block name %s already exists in plugin %s.', 'wporg-plugins' ), $block->name, $query->posts[0]->post_name ), 425 if ( $this->slug && $this->slug === $post->post_name ) { 426 continue; // It's this very same plugin. 427 } 428 429 $this->record_result( 430 __FUNCTION__, 431 // Check the author, since this might be the same plugin hosted on github. 432 ( get_current_user_id() === $post->post_author ) ? 'warning' : 'error', 433 sprintf( 434 // translators: %1$s is the block slug, %2$s is the found plugin title. 435 __( 'Block name %1$s already exists in the plugin "%2$s."', 'wporg-plugins' ), 436 '<code>' . $block->name . '</code>', 437 $query->posts[0]->post_title 438 ), 428 439 [ 'block_name' => $block->name, 'slug' => $post->post_name ] 429 440 );
Note: See TracChangeset
for help on using the changeset viewer.