当前位置: 首页>>代码示例>>PHP>>正文


PHP tao_helpers_File::delTree方法代码示例

本文整理汇总了PHP中tao_helpers_File::delTree方法的典型用法代码示例。如果您正苦于以下问题:PHP tao_helpers_File::delTree方法的具体用法?PHP tao_helpers_File::delTree怎么用?PHP tao_helpers_File::delTree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tao_helpers_File的用法示例。


在下文中一共展示了tao_helpers_File::delTree方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generate

 /**
  * Generate a new Booklet from a specific test
  * in a specific class and return a report
  * 
  * @param core_kernel_classes_Resource $test
  * @param core_kernel_classes_Class $class
  * @return common_report_Report
  */
 public static function generate(core_kernel_classes_Resource $test, core_kernel_classes_Class $class)
 {
     $report = new common_report_Report(common_report_Report::TYPE_SUCCESS);
     $model = \taoTests_models_classes_TestsService::singleton()->getTestModel($test);
     if ($model->getUri() != INSTANCE_TEST_MODEL_QTI) {
         $report->setType(common_report_Report::TYPE_ERROR);
         $report->setMessage(__('%s is not a QTI test', $test->getLabel()));
         return $report;
     }
     // generate file content
     $tmpFolder = \tao_helpers_File::createTempDir();
     $tmpFile = $tmpFolder . 'test.txt';
     $content = '';
     foreach (self::getItems($test) as $item) {
         $content .= self::renderItem($item);
     }
     file_put_contents($tmpFile, $content);
     // generate tao instance
     $instance = BookletClassService::singleton()->createBookletInstance($class, __('%s Booklet', $test->getLabel()), $tmpFile);
     \tao_helpers_File::delTree($tmpFolder);
     // return report with instance
     $report->setMessage(__('%s created', $instance->getLabel()));
     $report->setData($instance);
     return $report;
 }
开发者ID:nagyist,项目名称:extension-tao-booklet,代码行数:33,代码来源:BookletRenderer.php

示例2: run

 public function run()
 {
     $ext = common_ext_ExtensionsManager::singleton()->getExtensionById('ltiProvider');
     if ($ext->isInstalled()) {
         common_Logger::t('Uninstall ltiProvider');
         $db = core_kernel_classes_DbWrapper::singleton();
         $sql = "DELETE from extensions where id ='ltiProvider';";
         $db->exec($sql);
         tao_helpers_File::delTree($ext->getConstant('BASE_PATH'));
         $newExt = common_ext_ExtensionsManager::singleton()->getExtensionById('taoLti');
         taoUpdate_models_classes_DataMigrationService::singleton()->installExtension($newExt);
     }
 }
开发者ID:llecaque,项目名称:extension-tao-update,代码行数:13,代码来源:class.UninstallLtiProvider.php

示例3: deleteContent

 /**
  * (non-PHPdoc)
  * @see taoTests_models_classes_TestModel::onTestModelSet()
  */
 public function deleteContent(core_kernel_classes_Resource $test)
 {
     $propInstanceContent = new core_kernel_classes_Property(TEST_TESTCONTENT_PROP);
     /** @var \core_kernel_classes_Literal $directoryId */
     $directoryId = $test->getOnePropertyValue($propInstanceContent);
     if (is_null($directoryId)) {
         throw new \common_exception_FileSystemError(__('Unknown test directory'));
     }
     $directory = \tao_models_classes_service_FileStorage::singleton()->getDirectoryById($directoryId->literal);
     if (is_dir($directory->getPath())) {
         \tao_helpers_File::delTree($directory->getPath());
     }
     $test->removePropertyValues(new core_kernel_classes_Property(TEST_TESTCONTENT_PROP));
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:18,代码来源:TestModel.php

示例4: deleteDependencies

 protected static function deleteDependencies(\core_kernel_classes_Triple $triple)
 {
     if ($triple->predicate == 'http://www.tao.lu/Ontologies/TAOItem.rdf#ItemContent') {
         $file = new \core_kernel_versioning_File($triple->object);
         if ($file->exists()) {
             $sourceDir = dirname($file->getAbsolutePath());
             $file->delete();
             \tao_helpers_File::delTree($sourceDir);
         }
     } elseif (CloneHelper::isFileReference($triple)) {
         $file = new \core_kernel_versioning_File($triple->object);
         if ($file->exists()) {
             $file->delete();
         }
     }
 }
开发者ID:kendaop,项目名称:extension-tao-revision,代码行数:16,代码来源:DeleteHelper.php

示例5: testSend

 public function testSend()
 {
     $testfolder = tao_helpers_File::createTempDir();
     $expectedFilePath = $testfolder . 'testidentifier' . DIRECTORY_SEPARATOR . 'message.html';
     $this->assertFileNotExists($expectedFilePath);
     $userMock = $this->prophesize('oat\\oatbox\\user\\User');
     $userMock->getIdentifier()->willReturn('testidentifier');
     $userMock->getIdentifier()->should(new CallTimesPrediction(1));
     $messageMock = $this->prophesize('oat\\tao\\model\\messaging\\Message');
     $messageMock->getTo()->willReturn($userMock->reveal());
     $messageMock->getTo()->should(new CallTimesPrediction(1));
     $messageMock->getBody()->willReturn('testBody');
     $messageMock->getBody()->should(new CallTimesPrediction(1));
     $transporter = new FileSink(array(FileSink::CONFIG_FILEPATH => $testfolder));
     $result = $transporter->send($messageMock->reveal());
     $this->assertTrue($result);
     $this->assertFileExists($expectedFilePath);
     $messageContent = file_get_contents($expectedFilePath);
     $this->assertEquals('testBody', $messageContent);
     $userMock->checkProphecyMethodsPredictions();
     $messageMock->checkProphecyMethodsPredictions();
     tao_helpers_File::delTree($testfolder);
     $this->assertFalse(is_dir($testfolder));
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:24,代码来源:FileSink.php

示例6: import

 /**
  * Import a Portable element from an uploaded zip file
  *
  * @param $type
  * @param $zipFile
  * @return mixed
  * @throws PortableElementInconsistencyModelException
  */
 public function import($type, $zipFile)
 {
     /** @var PortableElementPackageParser $parser */
     $parser = $this->getPortableFactory()->getModel($type)->getPackageParser();
     $source = $parser->extract($zipFile);
     $object = $parser->getModel()->createDataObject($parser->getManifestContent($zipFile));
     $this->registerModel($object, $source);
     \tao_helpers_File::delTree($source);
     return $object;
 }
开发者ID:oat-sa,项目名称:extension-tao-itemqti,代码行数:18,代码来源:PortableElementService.php

示例7: deleteContent

 /**
  * Delete the content of a QTI test
  * @param core_kernel_classes_Resource $test
  * @throws common_exception_Error
  */
 public function deleteContent(core_kernel_classes_Resource $test)
 {
     $content = $test->getOnePropertyValue(new core_kernel_classes_Property(TEST_TESTCONTENT_PROP));
     if (!is_null($content)) {
         $file = new core_kernel_file_File($content);
         try {
             $path = $file->getAbsolutePath();
             if (is_dir($path)) {
                 if (!tao_helpers_File::delTree($path)) {
                     throw new common_exception_Error("Unable to remove test content directory located at '" . $file->getAbsolutePath() . "'.");
                 }
             }
         } catch (common_Exception $e) {
             // Empty file...
         }
         $file->delete();
         $test->removePropertyValue(new core_kernel_classes_Property(TEST_TESTCONTENT_PROP), $file);
     }
 }
开发者ID:nagyist,项目名称:extension-tao-testqti,代码行数:24,代码来源:class.QtiTestService.php

示例8: tearDown

 /**
  * Remove directory of $adapterFixture
  */
 public function tearDown()
 {
     \tao_helpers_File::delTree($this->privateDir);
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:7,代码来源:FileStorageTest.php

示例9: testTracing

 public function testTracing()
 {
     $events = array('{"name":"div","type":"click","time":"1288780765981","id":"qunit-fixture"}', '{"name":"BUSINESS","type":"TEST","time":"1288780765982","id":"12"}', '{"name":"h2","type":"click","time":"1288780766000","id":"qunit-banner"}', '{"name":"h1","type":"click","time":"1288780765999","id":"qunit-header"}');
     $folder = tao_helpers_File::createTempDir();
     $processId = '123456789';
     $eventFilter = $this->eventsService->getEventList($this->eventFile, 'server');
     $this->assertTrue($this->eventsService->traceEvent($events, $processId, $folder, $eventFilter));
     $this->assertTrue($this->eventsService->traceEvent($events, $processId, $folder));
     $this->assertTrue(file_exists($folder . '/' . $processId . '_0.xml'));
     foreach (glob($folder . '/' . $processId . '*') as $trace_file) {
         if (preg_match('/(xml|lock)$/', $trace_file)) {
             unlink($trace_file);
         }
     }
     tao_helpers_File::delTree($folder);
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:16,代码来源:EventsServiceTest.php

示例10: testIsIdentical

 public function testIsIdentical()
 {
     $testfolder = tao_helpers_File::createTempDir();
     $this->assertTrue(is_dir($testfolder));
     $zip = new ZipArchive();
     $this->assertTrue($zip->open(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . 'fileHelper.zip'));
     $this->assertTrue($zip->extractTo($testfolder));
     $zip->close();
     $reference = $testfolder . 'reference';
     $this->assertTrue(is_dir($reference));
     $testContent = $testfolder . DIRECTORY_SEPARATOR . 'testContent';
     $testEmptyDir = $testfolder . DIRECTORY_SEPARATOR . 'testEmptyDir';
     $testIdent = $testfolder . DIRECTORY_SEPARATOR . 'testIdent';
     $testMissingDir = $testfolder . DIRECTORY_SEPARATOR . 'testMissingDir';
     $testRenamedFile = $testfolder . DIRECTORY_SEPARATOR . 'testRenamedFile';
     $testRenamedEmptyDir = $testfolder . DIRECTORY_SEPARATOR . 'testRenamedEmptyDir';
     $this->assertTrue(tao_helpers_File::isIdentical($reference, $reference));
     $this->assertTrue(tao_helpers_File::isIdentical($reference, $testIdent));
     $this->assertFalse(tao_helpers_File::isIdentical($reference, $testContent));
     $this->assertFalse(tao_helpers_File::isIdentical($reference, $testEmptyDir));
     $this->assertFalse(tao_helpers_File::isIdentical($reference, $testMissingDir));
     $this->assertFalse(tao_helpers_File::isIdentical($reference, $testRenamedFile));
     $this->assertFalse(tao_helpers_File::isIdentical($reference, $testRenamedEmptyDir));
     $this->assertTrue(tao_helpers_File::delTree($testfolder));
     $this->assertFalse(is_dir($testfolder));
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:26,代码来源:FileHelperTest.php

示例11: testExport

 public function testExport()
 {
     $packageValid = dirname(__FILE__) . '/samples/package/likertScaleInteraction_v1.0.0';
     $pciModel = new PciModel('likertScaleInteraction', '1.0.0');
     $pciModel->exchangeArray(json_decode(file_get_contents($packageValid . DIRECTORY_SEPARATOR . PciModel::PCI_MANIFEST), true));
     $service = new PortableElementService();
     $service->setServiceLocator(ServiceManager::getServiceManager());
     $reflectionClass = new \ReflectionClass(PortableElementService::class);
     $reflectionMethod = $reflectionClass->getMethod('getRegistry');
     $reflectionMethod->setAccessible(true);
     $registry = $reflectionMethod->invoke($service, new PciModel());
     $registry->setSource($packageValid);
     $registry->register($pciModel);
     $exportDirectory = $registry->export($pciModel);
     $parser = new PortableElementPackageParser($exportDirectory);
     $parser->setModel(new PciModel());
     $source = $parser->extract();
     $original = $this->fillArrayWithFileNodes(new \DirectoryIterator($packageValid));
     $exported = $this->fillArrayWithFileNodes(new \DirectoryIterator($source));
     $this->assertEquals(preg_replace('/\\s+/', '', file_get_contents($packageValid . DIRECTORY_SEPARATOR . PciModel::PCI_MANIFEST)), preg_replace('/\\s+/', '', file_get_contents($source . DIRECTORY_SEPARATOR . PciModel::PCI_MANIFEST)));
     $this->assertTrue(empty($this->array_diff_assoc_recursive($original, $exported)));
     $registry->unregister($pciModel);
     \tao_helpers_File::delTree($source);
 }
开发者ID:oat-sa,项目名称:extension-tao-itemqti-pci,代码行数:24,代码来源:PciRegistryTest.php

示例12: tearDownAfterClass

 /**
  * Removes the temporary directory
  */
 public static function tearDownAfterClass()
 {
     tao_helpers_File::delTree(self::$tmpDir);
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:7,代码来源:TranslationBundleTest.php

示例13: testCompile

 public function testCompile()
 {
     //test with items
     $config = array('previous' => true);
     $items = array($this->item->getUri());
     $this->testModel->save($this->test, array('itemUris' => $items, 'config' => $config));
     $waitingReport = new \common_report_Report(\common_report_Report::TYPE_SUCCESS);
     $serviceCall = $this->getMockBuilder('tao_models_classes_service_ServiceCall')->disableOriginalConstructor()->setMethods(array('serializeToString'))->getMock();
     $serviceCall->expects($this->once())->method('serializeToString')->willReturn('greatString');
     $waitingReport->setData($serviceCall);
     $testCompiler = $this->getMockBuilder('oat\\taoTestLinear\\model\\TestCompiler')->setConstructorArgs(array($this->test, $this->storage))->setMethods(array('subCompile', 'spawnPrivateDirectory'))->getMock();
     $testCompiler->expects($this->once())->method('subCompile')->willReturn($waitingReport);
     //will spawn a new directory and store the content file
     $directoryMock = $this->getMockBuilder('tao_models_classes_service_StorageDirectory')->disableOriginalConstructor()->setMethods(array('getPath'))->getMock();
     $tmpDir = \tao_helpers_File::createTempDir();
     $this->assertFileExists($tmpDir);
     $directoryMock->expects($this->once())->method('getPath')->willReturn($tmpDir);
     $testCompiler->expects($this->once())->method('spawnPrivateDirectory')->willReturn($directoryMock);
     $report = $testCompiler->compile();
     $this->assertEquals(__('Test Compilation'), $report->getMessage(), __('Compilation should work'));
     $this->assertFileExists($tmpDir . 'data.json', __('Compilation file not created'));
     $compile = '{"items":{"http:\\/\\/myFancyDomain.com\\/myGreatResourceUriForItem":"greatString"},"previous":true}';
     $this->assertEquals($compile, file_get_contents($tmpDir . 'data.json', __('File content error')));
     \tao_helpers_File::delTree($tmpDir);
     $this->assertFileNotExists($tmpDir);
 }
开发者ID:oat-sa,项目名称:extension-tao-testlinear,代码行数:26,代码来源:TestCompilerTest.php

示例14: tearDown

 public function tearDown()
 {
     if (file_exists($this->directoryPath)) {
         \tao_helpers_File::delTree($this->directoryPath);
     }
 }
开发者ID:oat-sa,项目名称:extension-tao-delivery-rdf,代码行数:6,代码来源:DeliveryAssemblyServiceTest.php


注:本文中的tao_helpers_File::delTree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。