mirror of
https://github.com/Studio-42/elFinder
synced 2026-06-08 12:37:09 +00:00
[VD:abstract] new misc function rmdirRecursive($dir)
/** * Remove directory recursive on local file system * * @param string $dir Target dirctory path * @return boolean */
This commit is contained in:
@@ -669,7 +669,7 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver {
|
||||
}
|
||||
|
||||
// insurance unexpected shutdown
|
||||
register_shutdown_function(array(&$this, 'delTree'), realpath($dir));
|
||||
register_shutdown_function(array($this, 'rmdirRecursive'), realpath($dir));
|
||||
|
||||
chmod($dir, 0777);
|
||||
|
||||
@@ -787,15 +787,8 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver {
|
||||
* @return boolean
|
||||
* @author Naoki Sawada
|
||||
*/
|
||||
public function delTree($localpath) {
|
||||
if (is_dir($localpath)) {
|
||||
foreach (array_diff(scandir($localpath), array('.', '..')) as $file) {
|
||||
@set_time_limit(30);
|
||||
$path = $localpath . '/' . $file;
|
||||
(is_dir($path)) ? $this->delTree($path) : @unlink($path);
|
||||
}
|
||||
return rmdir($localpath);
|
||||
}
|
||||
protected function delTree($localpath) {
|
||||
return $this->rmdirRecursive($localpath);
|
||||
}
|
||||
|
||||
} // END class
|
||||
|
||||
Reference in New Issue
Block a user