getFolderTreeToUserRoot() публичный Метод

Пример #1
0
 /**
  * Delete a document and all empty parent directories if there are any.
  *
  * @param $p the path of a document to delete
  * @returns an array of all deleted objects
  */
 public function deleteDocument(Path $p)
 {
     $documentPath = $this->baseDir . $p->getPath();
     if (false === @unlink($documentPath)) {
         throw new DocumentStorageException('unable to delete file');
     }
     $deletedObjects = array();
     $deletedObjects[] = $p->getPath();
     // delete all empty folders in the tree up to the user root if
     // they are empty
     foreach ($p->getFolderTreeToUserRoot() as $pathItem) {
         if ($this->isEmptyFolder(new Path($pathItem))) {
             $this->deleteFolder(new Path($pathItem));
             $deletedObjects[] = $pathItem;
         }
     }
     return $deletedObjects;
 }