Delete a document and all empty parent directories if there are any.
public deleteDocument ( |
||
$p | the path of a document to delete |
public function deleteDocument(Path $p, array $ifMatch = null) { if (null !== $ifMatch && !in_array($this->md->getVersion($p), $ifMatch)) { throw new PreconditionFailedException('version mismatch'); } $deletedEntities = $this->d->deleteDocument($p); foreach ($deletedEntities as $d) { $this->md->deleteNode(new Path($d)); } // increment the version from the folder containing the last deleted // folder and up to the user root, we cannot conveniently do this from // the MetadataStorage class :( foreach ($p->getFolderTreeToUserRoot() as $i) { if (null !== $this->md->getVersion(new Path($i))) { $this->md->updateFolder(new Path($i)); } } }