protected function copy($src, $dst, $name)
{
$srcStat = $this->stat($src);
$this->clearcache();
if (!empty($srcStat['thash'])) {
$target = $this->decode($srcStat['thash']);
$stat = $this->stat($target);
$this->clearcache();
return $stat && $this->_symlink($target, $dst, $name) ? $this->_joinPath($dst, $name) : $this->setError(elFinder::ERROR_COPY, $this->_path($src));
}
if ($srcStat['mime'] == 'directory') {
$test = $this->stat($this->_joinPath($dst, $name));
if ($test && $test['mime'] != 'directory' || !$this->_mkdir($dst, $name)) {
return $this->setError(elFinder::ERROR_COPY, $this->_path($src));
}
$dst = $this->_joinPath($dst, $name);
foreach ($this->getScandir($src) as $stat) {
if (empty($stat['hidden'])) {
$name = $stat['name'];
if (!$this->copy($this->_joinPath($src, $name), $dst, $name)) {
$this->remove($dst, true);
// fall back
return false;
}
}
}
$this->clearcache();
return $dst;
}
return $this->_copy($src, $dst, $name) ? $this->_joinPath($dst, $name) : $this->setError(elFinder::ERROR_COPY, $this->_path($src));
}