Loading inc/class-s3-uploads-changed-files-iterator.php +7 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ class S3_Uploads_ChangedFilesIterator extends Aws\S3\Sync\ChangedFilesIterator { public $dry_run = false; public function accept() { $current = $this->current(); Loading @@ -11,6 +12,12 @@ class S3_Uploads_ChangedFilesIterator extends Aws\S3\Sync\ChangedFilesIterator { 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)" ); } return false; } // Ensure it hasn't been modified since the mtime return $current->getMTime() > $data[1]; } Loading inc/class-s3-uploads-uploadsyncbuilder.php +5 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,10 @@ class S3_Uploads_UploadSyncBuilder extends Aws\S3\Sync\UploadSyncBuilder { public function __construct( $is_dry_run = false ) { $this->dry_run = $is_dry_run; } /** * Builds a UploadSync or DownloadSync object * Loading @@ -22,6 +26,7 @@ class S3_Uploads_UploadSyncBuilder extends Aws\S3\Sync\UploadSyncBuilder { $this->sourceConverter, $this->targetConverter ); $this->sourceIterator->dry_run = $this->dry_run; $this->sourceIterator->rewind(); } Loading inc/class-s3-uploads-wp-cli-command.php +2 −2 Original line number Diff line number Diff line Loading @@ -233,7 +233,7 @@ class S3_Uploads_WP_CLI_Command extends WP_CLI_Command { * Upload a directory to S3 * * @subcommand upload-directory * @synopsis <from> [<to>] [--sync] * @synopsis <from> [<to>] [--sync] [--dry-run] */ public function upload_directory( $args, $args_assoc ) { Loading Loading @@ -262,7 +262,7 @@ class S3_Uploads_WP_CLI_Command extends WP_CLI_Command { array( 'debug' => true, 'params' => array( 'ACL' => 'public-read' ), 'builder' => new S3_Uploads_UploadSyncBuilder(), 'builder' => new S3_Uploads_UploadSyncBuilder( ! empty( $args_assoc['dry-run'] ) ), 'force' => empty( $args_assoc['sync'] ) ) ); Loading Loading
inc/class-s3-uploads-changed-files-iterator.php +7 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ class S3_Uploads_ChangedFilesIterator extends Aws\S3\Sync\ChangedFilesIterator { public $dry_run = false; public function accept() { $current = $this->current(); Loading @@ -11,6 +12,12 @@ class S3_Uploads_ChangedFilesIterator extends Aws\S3\Sync\ChangedFilesIterator { 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)" ); } return false; } // Ensure it hasn't been modified since the mtime return $current->getMTime() > $data[1]; } Loading
inc/class-s3-uploads-uploadsyncbuilder.php +5 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,10 @@ class S3_Uploads_UploadSyncBuilder extends Aws\S3\Sync\UploadSyncBuilder { public function __construct( $is_dry_run = false ) { $this->dry_run = $is_dry_run; } /** * Builds a UploadSync or DownloadSync object * Loading @@ -22,6 +26,7 @@ class S3_Uploads_UploadSyncBuilder extends Aws\S3\Sync\UploadSyncBuilder { $this->sourceConverter, $this->targetConverter ); $this->sourceIterator->dry_run = $this->dry_run; $this->sourceIterator->rewind(); } Loading
inc/class-s3-uploads-wp-cli-command.php +2 −2 Original line number Diff line number Diff line Loading @@ -233,7 +233,7 @@ class S3_Uploads_WP_CLI_Command extends WP_CLI_Command { * Upload a directory to S3 * * @subcommand upload-directory * @synopsis <from> [<to>] [--sync] * @synopsis <from> [<to>] [--sync] [--dry-run] */ public function upload_directory( $args, $args_assoc ) { Loading Loading @@ -262,7 +262,7 @@ class S3_Uploads_WP_CLI_Command extends WP_CLI_Command { array( 'debug' => true, 'params' => array( 'ACL' => 'public-read' ), 'builder' => new S3_Uploads_UploadSyncBuilder(), 'builder' => new S3_Uploads_UploadSyncBuilder( ! empty( $args_assoc['dry-run'] ) ), 'force' => empty( $args_assoc['sync'] ) ) ); Loading