From f8e74785830cdcd3191e6b0cbbe6f9b7caa37b10 Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Sun, 19 Nov 2017 16:22:06 +0100 Subject: [PATCH] [FrameworkBundle] Dont create empty bundles directory --- .../Command/AssetsInstallCommand.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index a674e731f50e..0f5e07237896 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -120,9 +120,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } } - // Create the bundles directory otherwise symlink will fail. $bundlesDir = $targetArg.'/bundles/'; - $this->filesystem->mkdir($bundlesDir, 0777); $io = new SymfonyStyle($input, $output); $io->newLine(); @@ -186,10 +184,14 @@ protected function execute(InputInterface $input, OutputInterface $output) } } // remove the assets of the bundles that no longer exist - $dirsToRemove = Finder::create()->depth(0)->directories()->exclude($validAssetDirs)->in($bundlesDir); - $this->filesystem->remove($dirsToRemove); + if (is_dir($bundlesDir)) { + $dirsToRemove = Finder::create()->depth(0)->directories()->exclude($validAssetDirs)->in($bundlesDir); + $this->filesystem->remove($dirsToRemove); + } - $io->table(array('', 'Bundle', 'Method / Error'), $rows); + if ($rows) { + $io->table(array('', 'Bundle', 'Method / Error'), $rows); + } if (0 !== $exitCode) { $io->error('Some errors occurred while installing assets.'); @@ -197,7 +199,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($copyUsed) { $io->note('Some assets were installed via copy. If you make changes to these assets you have to run this command again.'); } - $io->success('All assets were successfully installed.'); + $io->success($rows ? 'All assets were successfully installed.' : 'No assets were provided by any bundle.'); } return $exitCode;