Code Duplication    Length = 7-7 lines in 2 locations

includes/admin/wc-admin-functions.php 2 locations

@@ 72-78 (lines=7) @@
69
		}
70
	}
71
72
	if ( strlen( $page_content ) > 0 ) {
73
		// Search for an existing page with the specified page content (typically a shortcode)
74
		$valid_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' ) AND post_content LIKE %s LIMIT 1;", "%{$page_content}%" ) );
75
	} else {
76
		// Search for an existing page with the specified page slug
77
		$valid_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' )  AND post_name = %s LIMIT 1;", $slug ) );
78
	}
79
80
	$valid_page_found = apply_filters( 'woocommerce_create_page_id', $valid_page_found, $slug, $page_content );
81
@@ 90-96 (lines=7) @@
87
	}
88
89
	// Search for a matching valid trashed page
90
	if ( strlen( $page_content ) > 0 ) {
91
		// Search for an existing page with the specified page content (typically a shortcode)
92
		$trashed_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_content LIKE %s LIMIT 1;", "%{$page_content}%" ) );
93
	} else {
94
		// Search for an existing page with the specified page slug
95
		$trashed_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_name = %s LIMIT 1;", $slug ) );
96
	}
97
98
	if ( $trashed_page_found ) {
99
		$page_id   = $trashed_page_found;