File tree 1 file changed +6
-7
lines changed
Filter options
src/Symfony/Bundle/FrameworkBundle/Command 1 file changed +6
-7
lines changed
Original file line number Diff line number Diff line change @@ -92,7 +92,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
92
92
$ validAssetDirs = array ();
93
93
foreach ($ this ->getContainer ()->get ('kernel ' )->getBundles () as $ bundle ) {
94
94
if (is_dir ($ originDir = $ bundle ->getPath ().'/Resources/public ' )) {
95
- $ targetDir = $ bundlesDir .preg_replace ('/bundle$/ ' , '' , strtolower ($ bundle ->getName ()));
95
+ $ assetDir = preg_replace ('/bundle$/ ' , '' , strtolower ($ bundle ->getName ()));
96
+ $ targetDir = $ bundlesDir .$ assetDir ;
97
+ $ validAssetDirs [] = $ assetDir ;
96
98
97
99
$ output ->writeln (sprintf ('Installing assets for <comment>%s</comment> into <comment>%s</comment> ' , $ bundle ->getNamespace (), $ targetDir ));
98
100
@@ -132,15 +134,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
132
134
} else {
133
135
$ this ->hardCopy ($ originDir , $ targetDir );
134
136
}
135
- $ validAssetDirs [] = $ targetDir ;
136
137
}
137
138
}
139
+
138
140
// remove the assets of the bundles that no longer exist
139
- foreach (new \FilesystemIterator ($ bundlesDir ) as $ dir ) {
140
- if (!in_array ($ dir , $ validAssetDirs )) {
141
- $ filesystem ->remove ($ dir );
142
- }
143
- }
141
+ $ dirsToRemove = Finder::create ()->depth (0 )->directories ()->exclude ($ validAssetDirs )->in ($ bundlesDir );
142
+ $ filesystem ->remove ($ dirsToRemove );
144
143
}
145
144
146
145
/**
You can’t perform that action at this time.
0 commit comments