Commit 6977ae79 authored by Joe Hoyle's avatar Joe Hoyle
Browse files

Fixed --dry-run on new files

parent 43eb7d75
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -7,17 +7,18 @@ class S3_Uploads_ChangedFilesIterator extends Aws\S3\Sync\ChangedFilesIterator {

		$current = $this->current();

		$key = $this->sourceConverter->convert((string) $current);
		if (!($data = $this->getTargetData($key))) {
			return true;
		}

		if ( ! empty( $this->dry_run ) && defined( 'WP_CLI' ) ) {
			if ( $current->getMTime() > $data[1] ) {
				WP_CLI::line( "(dry-run) Uploading {$current->getPathname()} ({$data[0]} bytes)" );
				WP_CLI::line( "(dry-run) Uploading {$current->getPathname()}" );
			}
			return false;			
		}

		$key = $this->sourceConverter->convert((string) $current);
		if (!($data = $this->getTargetData($key))) {
			return true;
		}

		// Ensure it hasn't been modified since the mtime
		return $current->getMTime() > $data[1];
	}