[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:
nao-pon
2015-03-18 21:11:07 +09:00
parent 531266bcba
commit b0972749c4
2 changed files with 24 additions and 10 deletions
+3 -10
View File
@@ -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