Code Duplication    Length = 11-11 lines in 2 locations

json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php 1 location

@@ 596-606 (lines=11) @@
593
			return $post_check;
594
		}
595
596
		if ( $media_id_string ) {
597
			// Yes - this is really how wp-admin does it.
598
			$wpdb->query( $wpdb->prepare(
599
				"UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $media_id_string )",
600
				$post_id
601
			) );
602
			foreach ( $media_results['media_ids'] as $media_id ) {
603
				clean_attachment_cache( $media_id );
604
			}
605
			clean_post_cache( $post_id );
606
		}
607
608
		// set page template for this post..
609
		if ( isset( $input['page_template'] ) && 'page' == $post_type->name ) {

json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php 1 location

@@ 567-577 (lines=11) @@
564
			return $post_check;
565
		}
566
567
		if ( $media_id_string ) {
568
			// Yes - this is really how wp-admin does it.
569
			$wpdb->query( $wpdb->prepare(
570
				"UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $media_id_string )",
571
				$post_id
572
			) );
573
			foreach ( $media_results['media_ids'] as $media_id ) {
574
				clean_attachment_cache( $media_id );
575
			}
576
			clean_post_cache( $post_id );
577
		}
578
579
		// set page template for this post..
580
		if ( isset( $input['page_template'] ) && 'page' == $post_type->name ) {