mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding Folder::rmdir().
Removed empty lines from basics file git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4101 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
b5face3516
commit
b8a46e14d7
2 changed files with 34 additions and 7 deletions
|
@ -352,5 +352,32 @@ function slashTerm($path) {
|
|||
}
|
||||
return $size;
|
||||
}
|
||||
/**
|
||||
* Recursively Remove directories if system allow.
|
||||
*
|
||||
* @param string $path
|
||||
* @return boolean
|
||||
*/
|
||||
function rmdir($path) {
|
||||
if (substr($path, -1, 1) != "/") {
|
||||
$path .= "/";
|
||||
}
|
||||
foreach (glob($path . "*") as $file) {
|
||||
if (is_file($file) === true) {
|
||||
@unlink($file);
|
||||
}
|
||||
elseif (is_dir($file) === true) {
|
||||
if($this->rmdir($file) === false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_dir($path) === true) {
|
||||
if(rmdir($path) === false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Reference in a new issue