mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Fixes #15335: Added FileHelper::unlink()
that works well under all OSes
This commit is contained in:

committed by
GitHub

parent
adc441de83
commit
efac23dde7
@ -250,13 +250,13 @@ class DevController extends Controller
|
||||
{
|
||||
if (is_link($link = "$dir/vendor/yiisoft/yii2")) {
|
||||
$this->stdout("Removing symlink $link.\n");
|
||||
$this->unlink($link);
|
||||
FileHelper::unlink($link);
|
||||
}
|
||||
$extensions = $this->findDirs("$dir/vendor/yiisoft");
|
||||
foreach ($extensions as $ext) {
|
||||
if (is_link($link = "$dir/vendor/yiisoft/yii2-$ext")) {
|
||||
$this->stdout("Removing symlink $link.\n");
|
||||
$this->unlink($link);
|
||||
FileHelper::unlink($link);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -293,20 +293,6 @@ class DevController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Properly removes symlinked directory under Windows, MacOS and Linux.
|
||||
*
|
||||
* @param string $file path to symlink
|
||||
*/
|
||||
protected function unlink($file)
|
||||
{
|
||||
if (is_dir($file) && DIRECTORY_SEPARATOR === '\\') {
|
||||
rmdir($file);
|
||||
} else {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of subdirectories for directory specified.
|
||||
* @param string $dir directory to read
|
||||
|
Reference in New Issue
Block a user