protected function remove($path, $force = false)
{
$stat = $this->stat($path);
$stat['realpath'] = $path;
$this->rmTmb($stat);
$this->clearcache();
if (empty($stat)) {
return $this->setError(elFinder::ERROR_RM, $this->_path($path), elFinder::ERROR_FILE_NOT_FOUND);
}
if (!$force && !empty($stat['locked'])) {
return $this->setError(elFinder::ERROR_LOCKED, $this->_path($path));
}
if ($stat['mime'] == 'directory') {
foreach ($this->_scandir($path) as $p) {
$name = $this->_basename($p);
if ($name != '.' && $name != '..' && !$this->remove($p)) {
return false;
}
}
if (!$this->_rmdir($path)) {
return $this->setError(elFinder::ERROR_RM, $this->_path($path));
}
} else {
if (!$this->_unlink($path)) {
return $this->setError(elFinder::ERROR_RM, $this->_path($path));
}
}
$this->removed[] = $stat;
return true;
}