Skip to content

Commit f086661

Browse files
Merge branch '3.2' into 3.3
* 3.2: fixed bad merge [Cache] Handle APCu failures gracefully [FrameworkBundle] Do not remove files from assets dir bumped Symfony version to 3.2.11 updated VERSION for 3.2.10 updated CHANGELOG for 3.2.10 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 900d78b + 34ad52b commit f086661

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
@@ -121,7 +121,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
121121
continue;
122122
}
123123

124-
$targetDir = $bundlesDir.preg_replace('/bundle$/', '', strtolower($bundle->getName()));
124+
$assetDir = preg_replace('/bundle$/', '', strtolower($bundle->getName()));
125+
$targetDir = $bundlesDir.$assetDir;
126+
$validAssetDirs[] = $assetDir;
125127

126128
if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
127129
$message = sprintf("%s\n-> %s", $bundle->getName(), $targetDir);
@@ -153,14 +155,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
153155
$exitCode = 1;
154156
$rows[] = array(sprintf('<fg=red;options=bold>%s</>', '\\' === DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */), $message, $e->getMessage());
155157
}
156-
$validAssetDirs[] = $targetDir;
157158
}
158159
// remove the assets of the bundles that no longer exist
159-
foreach (new \FilesystemIterator($bundlesDir) as $dir) {
160-
if (!in_array($dir, $validAssetDirs)) {
161-
$this->filesystem->remove($dir);
162-
}
163-
}
160+
$dirsToRemove = Finder::create()->depth(0)->directories()->exclude($validAssetDirs)->in($bundlesDir);
161+
$this->filesystem->remove($dirsToRemove);
164162

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

0 commit comments

Comments
 (0)