You are here

private function FMDiskFileSystem::rmDirRecursive in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2

1 call to FMDiskFileSystem::rmDirRecursive()
FMDiskFileSystem::deleteDir in src/Flmngr/FlmngrServer/fs/FMDiskFileSystem.php
Deletes a directory.

File

src/Flmngr/FlmngrServer/fs/FMDiskFileSystem.php, line 107

Class

FMDiskFileSystem
Implements file system interface. Provides an interface to access file system (local disc FS). This is the correct module to replace if you want to implement some custom file system support (i. e. network file system like Amazon S3).

Namespace

Drupal\n1ed\Flmngr\FlmngrServer\fs

Code

private function rmDirRecursive($dir) {
  if (!file_exists($dir)) {
    return TRUE;
  }
  if (!is_dir($dir)) {
    return unlink($dir);
  }
  foreach (scandir($dir) as $item) {
    if ($item == '.' || $item == '..') {
      continue;
    }
    if (!$this
      ->rmDirRecursive($dir . DIRECTORY_SEPARATOR . $item)) {
      return FALSE;
    }
  }
  return rmdir($dir);
}