Skip to content

Commit 34ad52b

Browse files
committed
Merge branch '2.8' into 3.2
* 2.8: [FrameworkBundle] Do not remove files from assets dir bumped Symfony version to 2.8.24 updated VERSION for 2.8.23 updated CHANGELOG for 2.8.23 bumped Symfony version to 2.7.31 updated VERSION for 2.7.30 update CONTRIBUTORS for 2.7.30 updated CHANGELOG for 2.7.30
2 parents 4177ee8 + a109993 commit 34ad52b

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Command/AssetsInstallCommand.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
117117
continue;
118118
}
119119

120-
$targetDir = $bundlesDir.preg_replace('/bundle$/', '', strtolower($bundle->getName()));
120+
$assetDir = preg_replace('/bundle$/', '', strtolower($bundle->getName()));
121+
$targetDir = $bundlesDir.$assetDir;
122+
$validAssetDirs[] = $assetDir;
121123

122124
if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
123125
$message = sprintf("%s\n-> %s", $bundle->getName(), $targetDir);
@@ -149,14 +151,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
149151
$exitCode = 1;
150152
$rows[] = array(sprintf('<fg=red;options=bold>%s</>', '\\' === DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */), $message, $e->getMessage());
151153
}
152-
$validAssetDirs[] = $targetDir;
153154
}
154155
// remove the assets of the bundles that no longer exist
155-
foreach (new \FilesystemIterator($bundlesDir) as $dir) {
156-
if (!in_array($dir, $validAssetDirs)) {
157-
$this->filesystem->remove($dir);
158-
}
159-
}
156+
$dirsToRemove = Finder::create()->depth(0)->directories()->exclude($validAssetDirs)->in($bundlesDir);
157+
$this->filesystem->remove($dirsToRemove);
160158

161159
$io->table(array('', 'Bundle', 'Method / Error'), $rows);
162160

0 commit comments

Comments
 (0)