Skip to content

Commit 32da56d

Browse files
committed
bug #25033 [FrameworkBundle] Dont create empty bundles directory by default (ro0NL)
This PR was merged into the 3.4 branch. Discussion ---------- [FrameworkBundle] Dont create empty bundles directory by default | Q | A | ------------- | --- | Branch? | 3.4 / 4.1? | Bug fix? | yes? | New feature? | no | BC breaks? | no? | Deprecations? | no | Tests pass? | yes | Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | symfony/symfony-docs#... <!--highly recommended for new features--> we still run `assets:install` by default, which in bundle-less apps gives this annoying empty public/bundles dir and some useless cli output, all the time. This fixes it. Commits ------- f8e7478583 [FrameworkBundle] Dont create empty bundles directory
2 parents b10f2f2 + dd0285e commit 32da56d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Command/AssetsInstallCommand.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
120120
}
121121
}
122122

123-
// Create the bundles directory otherwise symlink will fail.
124123
$bundlesDir = $targetArg.'/bundles/';
125-
$this->filesystem->mkdir($bundlesDir, 0777);
126124

127125
$io = new SymfonyStyle($input, $output);
128126
$io->newLine();
@@ -186,18 +184,22 @@ protected function execute(InputInterface $input, OutputInterface $output)
186184
}
187185
}
188186
// remove the assets of the bundles that no longer exist
189-
$dirsToRemove = Finder::create()->depth(0)->directories()->exclude($validAssetDirs)->in($bundlesDir);
190-
$this->filesystem->remove($dirsToRemove);
187+
if (is_dir($bundlesDir)) {
188+
$dirsToRemove = Finder::create()->depth(0)->directories()->exclude($validAssetDirs)->in($bundlesDir);
189+
$this->filesystem->remove($dirsToRemove);
190+
}
191191

192-
$io->table(array('', 'Bundle', 'Method / Error'), $rows);
192+
if ($rows) {
193+
$io->table(array('', 'Bundle', 'Method / Error'), $rows);
194+
}
193195

194196
if (0 !== $exitCode) {
195197
$io->error('Some errors occurred while installing assets.');
196198
} else {
197199
if ($copyUsed) {
198200
$io->note('Some assets were installed via copy. If you make changes to these assets you have to run this command again.');
199201
}
200-
$io->success('All assets were successfully installed.');
202+
$io->success($rows ? 'All assets were successfully installed.' : 'No assets were provided by any bundle.');
201203
}
202204

203205
return $exitCode;

0 commit comments

Comments
 (0)