private function deleteDir($dirPath)
{
if (!is_dir($dirPath)) {
$success = unlink($dirPath);
} else {
$success = true;
foreach (array_reverse(elFinderVolumeFTP::listFilesInDirectory($dirPath, false)) as $path) {
$path = $dirPath . DIRECTORY_SEPARATOR . $path;
if (is_link($path)) {
unlink($path);
} else {
if (is_dir($path)) {
$success = rmdir($path);
} else {
$success = unlink($path);
}
}
if (!$success) {
break;
}
}
if ($success) {
$success = rmdir($dirPath);
}
}
if (!$success) {
$this->setError(elFinder::ERROR_RM, $dirPath);
return false;
}
return $success;
}