Commit 41169778 authored by Joe Hoyle's avatar Joe Hoyle Committed by GitHub
Browse files

Merge pull request #194 from dsawardekar/feature/improve-file-detection-in-migrate-attachments

Ignores copy if file path is a directory
parents ef0aa43d 682e62ed
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -105,7 +105,12 @@ class S3_Uploads_WP_CLI_Command extends WP_CLI_Command {
		$old_upload_dir = $instance->get_original_upload_dir();
		$upload_dir = wp_upload_dir();

		$files = array( get_post_meta( $args[0], '_wp_attached_file', true ) );
		$files         = array();
		$attached_file = get_post_meta( $args[0], '_wp_attached_file', true );

		if ( ! empty( $attached_file ) ) {
			$files[] = $attached_file;
		}

		$meta_data = wp_get_attachment_metadata( $args[0] );