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


PHP Files::removeDirectoryRecursively方法代码示例

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


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

示例1: removeTemporaryConfigurationRootPath

 /**
  * @param array $configuration
  */
 public function removeTemporaryConfigurationRootPath(array $configuration)
 {
     $configurationRootPath = $configuration['configurationRootPath'];
     $buildPath = $this->generateTemporaryConfigurationRootPath($configurationRootPath);
     if (@is_dir($buildPath)) {
         Files::removeDirectoryRecursively($buildPath);
     }
 }
开发者ID:neos,项目名称:doctools,代码行数:11,代码来源:SphinxConfiguration.php

示例2: deletePackage

 /**
  * Removes a package from registry and deletes it from filesystem
  *
  * @param string $packageKey package to remove
  * @return void
  * @throws Exception\UnknownPackageException if the specified package is not known
  * @throws Exception\ProtectedPackageKeyException if a package is protected and cannot be deleted
  * @throws Exception
  * @api
  */
 public function deletePackage($packageKey)
 {
     if (!$this->isPackageAvailable($packageKey)) {
         throw new Exception\UnknownPackageException('Package "' . $packageKey . '" is not available and cannot be removed.', 1166543253);
     }
     $package = $this->getPackage($packageKey);
     if ($package->isProtected()) {
         throw new Exception\ProtectedPackageKeyException('The package "' . $packageKey . '" is protected and cannot be removed.', 1220722120);
     }
     $packagePath = $package->getPackagePath();
     if ($this->isPackageActive($packageKey)) {
         $this->deactivatePackage($packageKey);
         $packagePath = Files::concatenatePaths([$this->packagesBasePath, $this->buildInactivePackageRelativePath($packagePath)]);
     }
     $this->unregisterPackage($package);
     try {
         Files::removeDirectoryRecursively($packagePath);
     } catch (UtilityException $exception) {
         throw new Exception('Please check file permissions. The directory "' . $packagePath . '" for package "' . $packageKey . '" could not be removed.', 1301491089, $exception);
     }
 }
开发者ID:cerlestes,项目名称:flow-development-collection,代码行数:31,代码来源:PackageManager.php

示例3: unpublishPersistentResourceRemovesTheResourceMirrorAndNoOtherFiles

 /**
  * @test
  */
 public function unpublishPersistentResourceRemovesTheResourceMirrorAndNoOtherFiles()
 {
     $temporaryDirectory = Files::concatenatePaths(array(realpath(sys_get_temp_dir()), 'FlowFileSystemPublishingTargetTestTarget')) . '/';
     Files::createDirectoryRecursively($temporaryDirectory);
     $mockResourcePointer = $this->getMock('TYPO3\\Flow\\Resource\\ResourcePointer', array(), array(), '', FALSE);
     $mockResourcePointer->expects($this->atLeastOnce())->method('getHash')->will($this->returnValue('ac9b6187f4c55b461d69e22a57925ff61ee89cb2'));
     $mockResource = $this->getMock('TYPO3\\Flow\\Resource\\Resource', array(), array(), '', FALSE);
     $mockResource->expects($this->atLeastOnce())->method('getResourcePointer')->will($this->returnValue($mockResourcePointer));
     mkdir($temporaryDirectory . 'Persistent');
     file_put_contents($temporaryDirectory . 'Persistent/ac9b6187f4c55b461d69e22a57925ff61ee89cb2.jpg', 'some data for deletion');
     file_put_contents($temporaryDirectory . 'Persistent/92cfceb39d57d914ed8b14d0e37643de0797ae56.jpg', 'must not be deleted');
     file_put_contents($temporaryDirectory . 'Persistent/186cd74009911bf433778c1fafff6ce90dd47b69.jpg', 'must not be deleted, too');
     $publishingTarget = new \TYPO3\Flow\Resource\Publishing\FileSystemPublishingTarget();
     $this->inject($publishingTarget, 'resourcesPublishingPath', $temporaryDirectory);
     $this->assertTrue(file_exists($temporaryDirectory . 'Persistent/ac9b6187f4c55b461d69e22a57925ff61ee89cb2.jpg'));
     $this->assertTrue(file_exists($temporaryDirectory . 'Persistent/92cfceb39d57d914ed8b14d0e37643de0797ae56.jpg'));
     $this->assertTrue(file_exists($temporaryDirectory . 'Persistent/186cd74009911bf433778c1fafff6ce90dd47b69.jpg'));
     $this->assertTrue($publishingTarget->unpublishPersistentResource($mockResource));
     $this->assertFalse(file_exists($temporaryDirectory . 'Persistent/ac9b6187f4c55b461d69e22a57925ff61ee89cb2.jpg'));
     $this->assertTrue(file_exists($temporaryDirectory . 'Persistent/92cfceb39d57d914ed8b14d0e37643de0797ae56.jpg'));
     $this->assertTrue(file_exists($temporaryDirectory . 'Persistent/186cd74009911bf433778c1fafff6ce90dd47b69.jpg'));
     Files::removeDirectoryRecursively($temporaryDirectory);
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:26,代码来源:FileSystemPublishingTargetTest.php

示例4: unlinkProperlyRemovesSymlinksPointingToDirectories

 /**
  * @test
  */
 public function unlinkProperlyRemovesSymlinksPointingToDirectories()
 {
     $targetPath = Files::concatenatePaths(array(dirname(tempnam($this->temporaryDirectory, '')), 'FlowFilesTestDirectory'));
     if (!is_dir($targetPath)) {
         Files::createDirectoryRecursively($targetPath);
     }
     $linkPath = Files::concatenatePaths(array(dirname(tempnam($this->temporaryDirectory, '')), 'FlowFilesTestDirectoryLink'));
     if (is_dir($linkPath)) {
         Files::removeDirectoryRecursively($linkPath);
     }
     symlink($targetPath, $linkPath);
     $this->assertTrue(Files::unlink($linkPath));
     $this->assertTrue(file_exists($targetPath));
     $this->assertFalse(file_exists($linkPath));
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:18,代码来源:FilesTest.php

示例5: tearDown

 /**
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     Files::removeDirectoryRecursively($this->temporaryDirectory);
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:8,代码来源:AssetRepositoryTest.php

示例6: publishStaticResources

 /**
  * Recursively publishes static resources located in the specified directory.
  * These resources are typically public package resources provided by the active packages.
  *
  * @param string $sourcePath The full path to the source directory which should be published (includes sub directories)
  * @param string $relativeTargetPath Path relative to the target's root where resources should be published to.
  * @return boolean TRUE if publication succeeded or FALSE if the resources could not be published
  */
 public function publishStaticResources($sourcePath, $relativeTargetPath)
 {
     if (!is_dir($sourcePath)) {
         return FALSE;
     }
     $sourcePath = rtrim(\TYPO3\Flow\Utility\Files::getUnixStylePath($this->realpath($sourcePath)), '/');
     $targetPath = rtrim(\TYPO3\Flow\Utility\Files::concatenatePaths(array($this->resourcesPublishingPath, 'Static', $relativeTargetPath)), '/');
     if ($this->settings['resource']['publishing']['fileSystem']['mirrorMode'] === 'link') {
         if (\TYPO3\Flow\Utility\Files::is_link($targetPath) && rtrim(\TYPO3\Flow\Utility\Files::getUnixStylePath($this->realpath($targetPath)), '/') === $sourcePath) {
             return TRUE;
         } elseif (is_dir($targetPath)) {
             \TYPO3\Flow\Utility\Files::removeDirectoryRecursively($targetPath);
         } elseif (is_link($targetPath)) {
             unlink($targetPath);
         } else {
             \TYPO3\Flow\Utility\Files::createDirectoryRecursively(dirname($targetPath));
         }
         symlink($sourcePath, $targetPath);
     } else {
         foreach (\TYPO3\Flow\Utility\Files::readDirectoryRecursively($sourcePath) as $sourcePathAndFilename) {
             if (substr(strtolower($sourcePathAndFilename), -4, 4) === '.php') {
                 continue;
             }
             $targetPathAndFilename = \TYPO3\Flow\Utility\Files::concatenatePaths(array($targetPath, str_replace($sourcePath, '', $sourcePathAndFilename)));
             if (!file_exists($targetPathAndFilename) || filemtime($sourcePathAndFilename) > filemtime($targetPathAndFilename)) {
                 $this->mirrorFile($sourcePathAndFilename, $targetPathAndFilename, TRUE);
             }
         }
     }
     return TRUE;
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:39,代码来源:FileSystemPublishingTarget.php

示例7: removeTestSitePackages

 /**
  * @BeforeScenario @fixtures
  */
 public function removeTestSitePackages()
 {
     $directories = glob(FLOW_PATH_PACKAGES . 'Sites/Test.*');
     if (is_array($directories)) {
         foreach ($directories as $directory) {
             \TYPO3\Flow\Utility\Files::removeDirectoryRecursively($directory);
         }
     }
 }
开发者ID:BlueM,项目名称:neos-development-collection,代码行数:12,代码来源:FeatureContext.php

示例8: tearDown

 protected function tearDown()
 {
     Files::removeDirectoryRecursively($this->testFilePath);
     unlink($this->logFilePath);
 }
开发者ID:beyond-agentur,项目名称:pt_extbase,代码行数:5,代码来源:SchedulerTaskTest.php

示例9: cleanupPersistentResourcesDirectory

 /**
  * Cleans up the directory for storing persistent resources during testing
  *
  * @return void
  * @throws \Exception
  */
 protected function cleanupPersistentResourcesDirectory()
 {
     $settings = self::$bootstrap->getObjectManager()->get(\TYPO3\Flow\Configuration\ConfigurationManager::class)->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS);
     $resourcesStoragePath = $settings['TYPO3']['Flow']['resource']['storages']['defaultPersistentResourcesStorage']['storageOptions']['path'];
     if (strpos($resourcesStoragePath, FLOW_PATH_DATA) === false) {
         throw new \Exception(sprintf('The storage path for persistent resources for the Testing context is "%s" but it must point to a directory below "%s". Please check the Flow settings for the Testing context.', $resourcesStoragePath, FLOW_PATH_DATA), 1382018388);
     }
     if (file_exists($resourcesStoragePath)) {
         Files::removeDirectoryRecursively($resourcesStoragePath);
     }
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:17,代码来源:FunctionalTestCase.php

示例10: tearDown

 /**
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     \TYPO3\Flow\Utility\Files::removeDirectoryRecursively($this->temporaryDirectory);
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:8,代码来源:AssetRepositoryTest.php

示例11: renderCommand

 /**
  * Renders reST files to fjson files which can be processed by the import command.
  *
  * @param string $bundle Bundle to render. If not specified all configured bundles will be rendered
  * @param string $format optional output format to be used
  * @return void
  */
 public function renderCommand($bundle = NULL, $format = NULL)
 {
     $bundles = $bundle !== NULL ? array($bundle) : array_keys($this->settings['bundles']);
     $defaultConfiguration = isset($this->settings['defaultConfiguration']) ? $this->settings['defaultConfiguration'] : array();
     if ($bundles === array()) {
         $this->outputLine('No bundles configured.');
         $this->quit(1);
     }
     foreach ($bundles as $bundle) {
         if (!isset($this->settings['bundles'][$bundle])) {
             $this->outputLine('Bundle "%s" is not configured.', array($bundle));
             $this->quit(1);
         }
         $configuration = Arrays::arrayMergeRecursiveOverrule($defaultConfiguration, $this->settings['bundles'][$bundle]);
         if ($this->arguments->getArgument('bundle')->getValue() === NULL && $configuration['renderByDefault'] !== TRUE) {
             $this->outputLine('Skipping bundle "%s".', array($bundle));
             continue;
         }
         $outputFormat = $format;
         if ($outputFormat === NULL && isset($configuration['renderingOutputFormat'])) {
             $outputFormat = $configuration['renderingOutputFormat'];
         } elseif ($outputFormat === NULL) {
             $outputFormat = 'json';
         }
         if ($outputFormat === NULL || !in_array($outputFormat, $this->supportedOutputFormats)) {
             $this->outputLine('ERROR: Output format "' . $outputFormat . '" is not supported. Choose one of the following: ' . implode(', ', $this->supportedOutputFormats));
             continue;
         }
         $this->outputLine('Rendering bundle <b>%s</b> with format %s into directory %s.', array($bundle, $outputFormat, $configuration['renderedDocumentationRootPath']));
         if (is_dir($configuration['renderedDocumentationRootPath']) && $outputFormat !== 'html') {
             Files::removeDirectoryRecursively($configuration['renderedDocumentationRootPath']);
         }
         $renderCommand = $this->sphinxConfiguration->buildRenderCommand($configuration, $outputFormat);
         exec($renderCommand, $output, $result);
         $this->sphinxConfiguration->removeTemporaryConfigurationRootPath($configuration);
         $this->outputLine(str_replace($configuration['documentationRootPath'], '', implode("\n", $output)), array(), 3);
         if ($result !== 0) {
             $this->outputLine('Could not execute sphinx-build command for Bundle %s. Tried to execute: "%s"', array($bundle, $renderCommand));
             continue;
         }
     }
 }
开发者ID:neos,项目名称:doctools,代码行数:49,代码来源:DocumentationCommandController.php

示例12: tearDown

 public function tearDown()
 {
     \TYPO3\Flow\Utility\Files::removeDirectoryRecursively($this->temporaryDirectoryPath);
     \TYPO3\Flow\Utility\Files::removeDirectoryRecursively($this->publishPath);
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:5,代码来源:PrivateResourcesPublishingAspectTest.php


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