8000 feature #24216 added clean option to assets install command (robinleh… · symfony/symfony@d220e28 · GitHub
[go: up one dir, main page]

Skip to content

Commit d220e28

Browse files
committed
feature #24216 added clean option to assets install command (robinlehrmann)
This PR was merged into the 4.1-dev branch. Discussion ---------- added clean option to assets install command | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #24204, #23416 | License | MIT Commits ------- 771f11b added clean option to assets install command
2 parents 04c3712 + 771f11b commit d220e28

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ protected function configure()
5858
))
5959
->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it')
6060
->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks')
61+
->addOption('no-cleanup', null, InputOption::VALUE_NONE, 'Do not remove the assets of the bundles that no longer exist')
6162
->setDescription('Installs bundles web assets under a public directory')
6263
->setHelp(<<<'EOT'
6364
The <info>%command.name%</info> command installs bundle assets into a given
@@ -162,7 +163,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
162163
}
163164
}
164165
// remove the assets of the bundles that no longer exist
165-
if (is_dir($bundlesDir)) {
166+
if (!$input->getOption('no-cleanup') && is_dir($bundlesDir)) {
166167
$dirsToRemove = Finder::create()->depth(0)->directories()->exclude($validAssetDirs)->in($bundlesDir);
167168
$this->filesystem->remove($dirsToRemove);
168169
}

0 commit comments

Comments
 (0)
0