mirror of
https://github.com/getgrav/grav.git
synced 2026-02-08 15:47:54 +01:00
Merge branch 'feature/setup_symlink_patch' into develop
This commit is contained in:
@@ -150,8 +150,13 @@ EOT
|
||||
$to = $this->destination . $target;
|
||||
|
||||
$output->writeln(' <cyan>' . $source . '</cyan> <comment>-></comment> ' . $to);
|
||||
@unlink ($to);
|
||||
symlink ($from, $to);
|
||||
|
||||
if (is_dir($to)) {
|
||||
$this->rmdir($to);
|
||||
} else {
|
||||
@unlink($to);
|
||||
}
|
||||
symlink($from, $to);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,4 +276,21 @@ EOT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function rmdir($dir) {
|
||||
$files = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS),
|
||||
\RecursiveIteratorIterator::CHILD_FIRST
|
||||
);
|
||||
|
||||
foreach ($files as $fileinfo) {
|
||||
if ($fileinfo->isDir()) {
|
||||
if (false === rmdir($fileinfo->getRealPath())) return false;
|
||||
} else {
|
||||
if (false === unlink($fileinfo->getRealPath())) return false;
|
||||
}
|
||||
}
|
||||
|
||||
return rmdir($dir);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user