Code Duplication    Length = 11-11 lines in 2 locations

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

@@ 401-411 (lines=11) @@
398
			return $post_check;
399
		}
400
401
		if ( $media_id_string ) {
402
			// Yes - this is really how wp-admin does it.
403
			$wpdb->query( $wpdb->prepare(
404
				"UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $media_id_string )",
405
				$post_id
406
			) );
407
			foreach ( $media_results['media_ids'] as $media_id ) {
408
				clean_attachment_cache( $media_id );
409
			}
410
			clean_post_cache( $post_id );
411
		}
412
413
		// set page template for this post..
414
		if ( isset( $input['page_template'] ) && 'page' == $post_type->name ) {

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

@@ 402-412 (lines=11) @@
399
			return $post_check;
400
		}
401
402
		if ( $media_id_string ) {
403
			// Yes - this is really how wp-admin does it.
404
			$wpdb->query( $wpdb->prepare(
405
				"UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $media_id_string )",
406
				$post_id
407
			) );
408
			foreach ( $media_results['media_ids'] as $media_id ) {
409
				clean_attachment_cache( $media_id );
410
			}
411
			clean_post_cache( $post_id );
412
		}
413
414
		// set page template for this post..
415
		if ( isset( $input['page_template'] ) && 'page' == $post_type->name ) {