merged branch alexpods/patch-1 (PR #7891)
This PR was merged into the master branch.
Discussion
----------
[FrameworkBundle] Place initialization of $bundlesDir out of the foreach loop.
Code enhancement. $bundlesDir variable doesn't need any bundle information for initialization. So it must be placed out of the loop to not process unnecessary operations.
Commits
-------
9cca065
[FrameworkBundle] Place initialization of $bundlesDir out of foreach loop
This commit is contained in:
commit
36a8194c95
@ -80,13 +80,13 @@ EOT
|
|||||||
$filesystem = $this->getContainer()->get('filesystem');
|
$filesystem = $this->getContainer()->get('filesystem');
|
||||||
|
|
||||||
// Create the bundles directory otherwise symlink will fail.
|
// Create the bundles directory otherwise symlink will fail.
|
||||||
$filesystem->mkdir($targetArg.'/bundles/', 0777);
|
$bundlesDir = $targetArg.'/bundles/';
|
||||||
|
$filesystem->mkdir($bundlesDir, 0777);
|
||||||
|
|
||||||
$output->writeln(sprintf("Installing assets using the <comment>%s</comment> option", $input->getOption('symlink') ? 'symlink' : 'hard copy'));
|
$output->writeln(sprintf("Installing assets using the <comment>%s</comment> option", $input->getOption('symlink') ? 'symlink' : 'hard copy'));
|
||||||
|
|
||||||
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
|
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
|
||||||
if (is_dir($originDir = $bundle->getPath().'/Resources/public')) {
|
if (is_dir($originDir = $bundle->getPath().'/Resources/public')) {
|
||||||
$bundlesDir = $targetArg.'/bundles/';
|
|
||||||
$targetDir = $bundlesDir.preg_replace('/bundle$/', '', strtolower($bundle->getName()));
|
$targetDir = $bundlesDir.preg_replace('/bundle$/', '', strtolower($bundle->getName()));
|
||||||
|
|
||||||
$output->writeln(sprintf('Installing assets for <comment>%s</comment> into <comment>%s</comment>', $bundle->getNamespace(), $targetDir));
|
$output->writeln(sprintf('Installing assets for <comment>%s</comment> into <comment>%s</comment>', $bundle->getNamespace(), $targetDir));
|
||||||
|
Reference in New Issue
Block a user