mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-08 08:56:23 +08:00
Merge pull request #7662 from fedemotta/feature/createSymlink
Enabling and improving createSymlink functionality
This commit is contained in:
@ -72,7 +72,7 @@ foreach ($files as $file) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$callbacks = ['setCookieValidationKey', 'setWritable', 'setExecutable'];
|
$callbacks = ['setCookieValidationKey', 'setWritable', 'setExecutable', 'createSymlink'];
|
||||||
foreach ($callbacks as $callback) {
|
foreach ($callbacks as $callback) {
|
||||||
if (!empty($env[$callback])) {
|
if (!empty($env[$callback])) {
|
||||||
$callback($root, $env[$callback]);
|
$callback($root, $env[$callback]);
|
||||||
@ -194,12 +194,11 @@ function setCookieValidationKey($root, $paths)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createSymlink($links)
|
function createSymlink($root, $links) {
|
||||||
{
|
|
||||||
foreach ($links as $link => $target) {
|
foreach ($links as $link => $target) {
|
||||||
echo " symlink $target as $link\n";
|
echo " symlink " . $root . "/" . $target . " " . $root . "/" . $link . "\n";
|
||||||
if (!is_link($link)) {
|
//first removing folders to avoid errors if the folder already exists
|
||||||
symlink($target, $link);
|
@rmdir($root . "/" . $link);
|
||||||
}
|
@symlink($root . "/" . $target, $root . "/" . $link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user