You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #11312 Make assets:install smarter with symlinks (Roy Van Ginneken)
This PR was squashed before being merged into the 2.6-dev branch (closes#11312).
Discussion
----------
Make assets:install smarter with symlinks
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | -
| Fixed tickets | #11297
| License | MIT
| Doc PR | -
Commits
-------
6537333 Make assets:install smarter with symlinks
"Resources/public" directory of each bundle will be copied into it.
48
49
49
50
To create a symlink to each bundle instead of copying its assets, use the
50
-
<info>--symlink</info> option:
51
+
<info>--symlink</info> option (will fall back to hard copies when symbolic links aren't possible:
51
52
52
53
<info>php %command.full_name% web --symlink</info>
53
54
@@ -73,17 +74,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
73
74
thrownew \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));
74
75
}
75
76
76
-
if (!function_exists('symlink') && $input->getOption('symlink')) {
77
-
thrownew \InvalidArgumentException('The symlink() function is not available on your system. You need to install the assets without the --symlink option.');
@@ -307,9 +308,12 @@ public function symlink($originDir, $targetDir, $copyOnWindows = false)
307
308
thrownewIOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?');
308
309
}
309
310
}
310
-
311
311
thrownewIOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
312
312
}
313
+
314
+
if (!file_exists($targetDir)) {
315
+
thrownewIOException(sprintf('Symbolic link "%s" is created but appears to be broken.', $targetDir), 0, null, $targetDir);
316
+
}
313
317
}
314
318
}
315
319
@@ -388,7 +392,7 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o
388
392
}
389
393
390
394
$copyOnWindows = false;
391
-
if (isset($options['copy_on_windows']) && !function_exists('symlink')) {
0 commit comments