@@ -21,12 +21,15 @@ class DownloadImages extends Command
2121 const OVERRIDE = 'override ' ;
2222 const FORCE = 'force ' ;
2323 const ENV = 'env ' ;
24+ const IGNORE_SYNC = 'ignore-synchronization ' ;
2425 /**#@- */
2526
2627 const OVERRIDE_CONFIRM_MESSAGE = "<question>Are you sure you want to override local files (y/n)[n]?</question> " ;
2728
2829 private $ _override = false ;
2930
31+ private $ _ignoreSync = false ;
32+
3033 /**
3134 * @var ObjectManagerInterface
3235 */
@@ -73,7 +76,7 @@ public function __construct(
7376 protected function configure ()
7477 {
7578 $ this ->setName ('cloudinary:download:all ' );
76- $ this ->setDescription ('Download images from Cloudinary to the local pub/media dir ' );
79+ $ this ->setDescription ('Download images from Cloudinary to the local pub/media dir. Optionally, ignore synchronization state and download everything ' );
7780 $ this ->setDefinition ([
7881 new InputOption (
7982 self ::OVERRIDE ,
@@ -94,6 +97,12 @@ protected function configure()
9497 'Cloudinary environment variable that will be used during the process ' ,
9598 null
9699 ),
100+ new InputOption (
101+ self ::IGNORE_SYNC ,
102+ '-i ' ,
103+ InputOption::VALUE_NONE ,
104+ 'Ignore synchronization state and download all images ' ,
105+ )
97106 ]);
98107 }
99108
@@ -119,8 +128,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
119128 if ($ input ->getOption (self ::FORCE )) {
120129 $ this ->coreRegistry ->register (Configuration::CONFIG_PATH_ENABLED , true );
121130 }
131+ if ($ input ->getOption (self ::IGNORE_SYNC )) {
132+ $ this ->_ignoreSync = true ;
133+ }
122134 $ this ->outputLogger ->setOutput ($ output );
123- $ this ->batchDownloader ->downloadUnsynchronisedImages ($ this ->outputLogger , $ this ->_override );
135+ $ this ->batchDownloader ->downloadUnsynchronisedImages ($ this ->outputLogger , $ this ->_override , $ this -> _ignoreSync );
124136
125137 return 1 ;
126138
0 commit comments