@@ -53,6 +53,7 @@ protected function configure(): void
53
53
new InputArgument ('pools ' , InputArgument::IS_ARRAY | InputArgument::OPTIONAL , 'A list of cache pools or cache pool clearers ' ),
54
54
])
55
55
->addOption ('all ' , null , InputOption::VALUE_NONE , 'Clear all cache pools ' )
56
+ ->addOption ('exclude ' , null , InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED , 'A list of cache pools or cache pool clearers to exclude ' )
56
57
->setHelp (<<<'EOF'
57
58
The <info>%command.name%</info> command clears the given cache pools or cache pool clearers.
58
59
@@ -70,17 +71,23 @@ protected function execute(InputInterface $input, OutputInterface $output): int
70
71
$ clearers = [];
71
72
72
73
$ poolNames = $ input ->getArgument ('pools ' );
74
+ $ excludedPoolNames = $ input ->getOption ('exclude ' );
73
75
if ($ input ->getOption ('all ' )) {
74
76
if (!$ this ->poolNames ) {
75
77
throw new InvalidArgumentException ('Could not clear all cache pools, try specifying a specific pool or cache clearer. ' );
76
78
}
77
79
78
- $ io ->comment ('Clearing all cache pools... ' );
80
+ if (!$ excludedPoolNames ) {
81
+ $ io ->comment ('Clearing all cache pools... ' );
82
+ }
83
+
79
84
$ poolNames = $ this ->poolNames ;
80
85
} elseif (!$ poolNames ) {
81
86
throw new InvalidArgumentException ('Either specify at least one pool name, or provide the --all option to clear all pools. ' );
82
87
}
83
88
89
+ $ poolNames = array_diff ($ poolNames , $ excludedPoolNames );
90
+
84
91
foreach ($ poolNames as $ id ) {
85
92
if ($ this ->poolClearer ->hasPool ($ id )) {
86
93
$ pools [$ id ] = $ id ;
0 commit comments