public function testDeepDelete()
 {
     $this->assertFileExists(__DIR__ . '/sample/test.xml');
     list($file, $resource) = $this->getResource('/sample/test.xml');
     $this->assertTrue($file->exists());
     //delete resource
     DeleteHelper::deepDelete($resource);
     $this->assertFalse($file->exists());
 }
 public function testDeepDelete()
 {
     //create resources
     $repository = \tao_models_classes_FileSourceService::singleton()->addLocalSource("Label Test", \tao_helpers_File::createTempDir());
     /** @var \core_kernel_versioning_File $file */
     $file = $repository->createFile("test.xml", "sample");
     mkdir($repository->getPath() . 'sample');
     copy(__DIR__ . '/sample/test.xml', $repository->getPath() . 'sample/test.xml');
     $dirname = $file->getFileInfo()->getPath();
     $this->assertFileExists($dirname . '/test.xml');
     //delete resource
     DeleteHelper::deepDelete($file);
     DeleteHelper::deepDelete($repository);
     //see if all is deleted
     //try to get the resource
     $resourceTest = new \core_kernel_classes_Resource($repository->getUri());
     $fileTest = new \core_kernel_classes_Resource($file->getUri());
     $this->assertFileNotExists($dirname . '/test.xml');
     $this->assertCount(0, $resourceTest->getRdfTriples());
     $this->assertCount(0, $fileTest->getRdfTriples());
 }
 /**
  * (non-PHPdoc)
  * @see \oat\taoRevision\model\Repository::restore()
  */
 public function restore(Revision $revision)
 {
     $resourceId = $revision->getResourceId();
     $data = $this->getStorage()->getData($revision);
     $resource = new \core_kernel_classes_Resource($resourceId);
     $originFilesystemMap = CloneHelper::getPropertyStorageMap($resource->getRdfTriples());
     DeleteHelper::deepDelete($resource);
     foreach (CloneHelper::deepCloneTriples($data, $originFilesystemMap) as $triple) {
         ModelManager::getModel()->getRdfInterface()->add($triple);
     }
     return true;
 }
 protected function release(Lock $lock)
 {
     $workcopy = $lock->getWorkCopy();
     // deletes the dependencies
     DeleteHelper::deepDelete($workcopy);
     // deletes the workcopy
     $this->getWorkspaceModel()->getRdfsInterface()->getResourceImplementation()->delete($workcopy);
     SqlStorage::remove($lock);
     WorkspaceMap::getCurrentUserMap()->reload();
     return true;
 }