Skip to content

Commit

Permalink
5.9.8
Browse files Browse the repository at this point in the history
  • Loading branch information
aliyilmaz committed May 12, 2024
1 parent 3e89c0d commit a4d5aa0
Showing 1 changed file with 16 additions and 23 deletions.
39 changes: 16 additions & 23 deletions src/Mind.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
*
* @package Mind
* @version Release: 5.9.7
* @version Release: 5.9.8
* @license GPL3
* @author Ali YILMAZ <[email protected]>
* @category Php Framework, Design pattern builder for PHP.
Expand Down Expand Up @@ -5898,32 +5898,25 @@ public function captcha($level=3, $length=8, $width=320, $height=60){
* @return bool
*/
public function rm_r($paths) {

if(!is_array($paths)){
$paths = array($paths);
}

foreach ($paths as $path) {

if(is_file($path)){
return unlink($path);
if (is_array($paths)) {
foreach ($paths as $path) {
$this->rm_r($path);
}

if(is_dir($path)){

$files = array_diff(scandir($path), array('.','..'));
foreach ($files as $file) {
$this->rm_r($path.'/'.$file);
} else {
if (is_file($paths)) {
unlink($paths);
$dirPath = dirname($paths);
while (is_dir($dirPath)) {
$files = scandir($dirPath);
if (count($files) === 2 && in_array('.', $files) && in_array('..', $files)) {
rmdir($dirPath);
$dirPath = dirname($dirPath);
} else {
break;
}
}
return rmdir($path);

} else {
return false;
}

}

return true;
}

/**
Expand Down

0 comments on commit a4d5aa0

Please sign in to comment.