Example #1
0
 /**
  * Remove folder in file system
  * @param Folder $folder
  */
 private function removeFolderInFileSystem(Folder $folder)
 {
     $folderPath = $folder->getPath(DIRECTORY_SEPARATOR, true);
     $folderExternalPath = $this->getExternalPath() . $folderPath;
     $folderInternalPath = $this->getInternalPath() . $folderPath;
     //remove empty _size folders (or whatever the prefix is); we expect these folders to be empty
     foreach (array($folderExternalPath, $folderInternalPath) as $path) {
         $sizeBase = $path . DIRECTORY_SEPARATOR . self::RESERVED_DIR_SIZE;
         if (is_dir($sizeBase)) {
             foreach (glob($sizeBase . DIRECTORY_SEPARATOR . '*') as $subSize) {
                 @rmdir($subSize);
             }
             @rmdir($sizeBase);
         }
     }
     // we are ignoring that one of the folders might not exist
     $resultInternal = @rmdir($folderInternalPath);
     $resultExternal = @rmdir($folderExternalPath);
 }