本文整理汇总了PHP中TYPO3\Flow\Utility\Files::createDirectoryRecursively方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::createDirectoryRecursively方法的具体用法?PHP Files::createDirectoryRecursively怎么用?PHP Files::createDirectoryRecursively使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Utility\Files
的用法示例。
在下文中一共展示了Files::createDirectoryRecursively方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareTemporaryDirectory
/**
* Builds a temporary directory to work on.
* @return void
*/
protected function prepareTemporaryDirectory()
{
$this->temporaryDirectory = \TYPO3\Flow\Utility\Files::concatenatePaths(array(FLOW_PATH_DATA, 'Temporary', 'Testing', str_replace('\\', '_', __CLASS__)));
if (!file_exists($this->temporaryDirectory)) {
\TYPO3\Flow\Utility\Files::createDirectoryRecursively($this->temporaryDirectory);
}
}
示例2: getDocumentAbsolutePath
/**
* @param string $filename
* @return string
* @throws \TYPO3\Flow\Utility\Exception
*/
public function getDocumentAbsolutePath($filename = null)
{
$path = str_replace('\\', '/', get_called_class());
$documentAbsolutePath = $this->temporaryDirectoryBase . $path . '/';
Files::createDirectoryRecursively($documentAbsolutePath);
return Files::getNormalizedPath($documentAbsolutePath) . $filename;
}
示例3: acquire
/**
* @param string $subject
* @param boolean $exclusiveLock TRUE to, acquire an exclusive (write) lock, FALSE for a shared (read) lock.
* @throws LockNotAcquiredException
* @throws \TYPO3\Flow\Utility\Exception
* @return void
*/
public function acquire($subject, $exclusiveLock)
{
if ($this->isWindowsOS()) {
return;
}
if (self::$temporaryDirectory === null) {
if (Bootstrap::$staticObjectManager === null || !Bootstrap::$staticObjectManager->isRegistered(\TYPO3\Flow\Utility\Environment::class)) {
throw new LockNotAcquiredException('Environment object could not be accessed', 1386680952);
}
$environment = Bootstrap::$staticObjectManager->get(\TYPO3\Flow\Utility\Environment::class);
$temporaryDirectory = Files::concatenatePaths(array($environment->getPathToTemporaryDirectory(), 'Lock'));
Files::createDirectoryRecursively($temporaryDirectory);
self::$temporaryDirectory = $temporaryDirectory;
}
$this->lockFileName = Files::concatenatePaths(array(self::$temporaryDirectory, md5($subject)));
if (($this->filePointer = @fopen($this->lockFileName, 'r')) === false) {
if (($this->filePointer = @fopen($this->lockFileName, 'w')) === false) {
throw new LockNotAcquiredException(sprintf('Lock file "%s" could not be opened', $this->lockFileName), 1386520596);
}
}
if ($exclusiveLock === false && flock($this->filePointer, LOCK_SH) === true) {
// Shared lock acquired
} elseif ($exclusiveLock === true && flock($this->filePointer, LOCK_EX) === true) {
// Exclusive lock acquired
} else {
throw new LockNotAcquiredException(sprintf('Could not lock file "%s"', $this->lockFileName), 1386520597);
}
}
示例4: create
/**
* Factory method which creates an EntityManager.
*
* @return \Doctrine\ORM\EntityManager
*/
public function create()
{
$config = new \Doctrine\ORM\Configuration();
$config->setClassMetadataFactoryName('TYPO3\\Flow\\Persistence\\Doctrine\\Mapping\\ClassMetadataFactory');
$cache = new \TYPO3\Flow\Persistence\Doctrine\CacheAdapter();
// must use ObjectManager in compile phase...
$cache->setCache($this->objectManager->get('TYPO3\\Flow\\Cache\\CacheManager')->getCache('Flow_Persistence_Doctrine'));
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);
$resultCache = new \TYPO3\Flow\Persistence\Doctrine\CacheAdapter();
// must use ObjectManager in compile phase...
$resultCache->setCache($this->objectManager->get('TYPO3\\Flow\\Cache\\CacheManager')->getCache('Flow_Persistence_Doctrine_Results'));
$config->setResultCacheImpl($resultCache);
if (class_exists($this->settings['doctrine']['sqlLogger'])) {
$config->setSQLLogger(new $this->settings['doctrine']['sqlLogger']());
}
$eventManager = $this->buildEventManager();
$flowAnnotationDriver = $this->objectManager->get('TYPO3\\Flow\\Persistence\\Doctrine\\Mapping\\Driver\\FlowAnnotationDriver');
$config->setMetadataDriverImpl($flowAnnotationDriver);
$proxyDirectory = \TYPO3\Flow\Utility\Files::concatenatePaths(array($this->environment->getPathToTemporaryDirectory(), 'Doctrine/Proxies'));
\TYPO3\Flow\Utility\Files::createDirectoryRecursively($proxyDirectory);
$config->setProxyDir($proxyDirectory);
$config->setProxyNamespace('TYPO3\\Flow\\Persistence\\Doctrine\\Proxies');
$config->setAutoGenerateProxyClasses(FALSE);
$entityManager = \Doctrine\ORM\EntityManager::create($this->settings['backendOptions'], $config, $eventManager);
$flowAnnotationDriver->setEntityManager($entityManager);
\Doctrine\DBAL\Types\Type::addType('objectarray', 'TYPO3\\Flow\\Persistence\\Doctrine\\DataTypes\\ObjectArray');
if (isset($this->settings['doctrine']['filters']) && is_array($this->settings['doctrine']['filters'])) {
foreach ($this->settings['doctrine']['filters'] as $filterName => $filterClass) {
$config->addFilter($filterName, $filterClass);
$entityManager->getFilters()->enable($filterName);
}
}
return $entityManager;
}
示例5: setUp
protected function setUp()
{
$this->prepareTestPaths();
Files::createDirectoryRecursively($this->testFilePath);
touch($this->logFilePath);
$this->schedulerTaskId = $this->getTestTaskId();
}
示例6: postUp
/**
* Move resource files to the new locations and adjust records.
*
* @param Schema $schema
* @return void
*/
public function postUp(Schema $schema)
{
$resourcesResult = $this->connection->executeQuery('SELECT persistence_object_identifier, sha1, filename FROM typo3_flow_resource_resource');
while ($resourceInfo = $resourcesResult->fetch(\PDO::FETCH_ASSOC)) {
$resourcePathAndFilename = FLOW_PATH_DATA . 'Persistent/Resources/' . $resourceInfo['sha1'];
$newResourcePathAndFilename = FLOW_PATH_DATA . 'Persistent/Resources/' . $resourceInfo['sha1'][0] . '/' . $resourceInfo['sha1'][1] . '/' . $resourceInfo['sha1'][2] . '/' . $resourceInfo['sha1'][3] . '/' . $resourceInfo['sha1'];
$mediaType = MediaTypes::getMediaTypeFromFilename($resourceInfo['filename']);
if (file_exists($resourcePathAndFilename)) {
$md5 = md5_file($resourcePathAndFilename);
$filesize = filesize($resourcePathAndFilename);
if (!file_exists(dirname($newResourcePathAndFilename))) {
Files::createDirectoryRecursively(dirname($newResourcePathAndFilename));
}
$result = @rename($resourcePathAndFilename, $newResourcePathAndFilename);
} elseif (file_exists($newResourcePathAndFilename)) {
$md5 = md5_file($newResourcePathAndFilename);
$filesize = filesize($newResourcePathAndFilename);
$result = TRUE;
} else {
$this->write(sprintf('Error while migrating database for the new resource management: the resource file "%s" (original filename: %s) was not found, but the resource object with uuid %s needs this file.', $resourcePathAndFilename, $resourceInfo['filename'], $resourceInfo['persistence_object_identifier']));
continue;
}
$this->connection->executeUpdate('UPDATE typo3_flow_resource_resource SET collectionname = ?, mediatype = ?, md5 = ?, filesize = ? WHERE persistence_object_identifier = ?', array('persistent', $mediaType, $md5, $filesize, $resourceInfo['persistence_object_identifier']));
if ($result === FALSE) {
$this->write(sprintf('Could not move the data file of resource "%s" from its legacy location at %s to the correct location %s.', $resourceInfo['sha1'], $resourcePathAndFilename, $newResourcePathAndFilename));
}
}
$this->connection->exec('ALTER TABLE typo3_flow_resource_resource ALTER md5 SET NOT NULL');
$this->connection->exec('ALTER TABLE typo3_flow_resource_resource ALTER collectionname SET NOT NULL');
$this->connection->exec('ALTER TABLE typo3_flow_resource_resource ALTER mediatype SET NOT NULL');
$this->connection->exec('ALTER TABLE typo3_flow_resource_resource ALTER filesize SET NOT NULL');
}
示例7: postUpdateAndInstall
/**
* Make sure required paths and files are available outside of Package
* Run on every Composer install or update - must be configured in root manifest
*
* @param CommandEvent $event
* @return void
*/
public static function postUpdateAndInstall(CommandEvent $event)
{
Files::createDirectoryRecursively('Configuration');
Files::createDirectoryRecursively('Data');
Files::copyDirectoryRecursively('Packages/Framework/TYPO3.Flow/Resources/Private/Installer/Distribution/Essentials', './', false, true);
Files::copyDirectoryRecursively('Packages/Framework/TYPO3.Flow/Resources/Private/Installer/Distribution/Defaults', './', true, true);
chmod('flow', 0755);
}
示例8: __construct
public function __construct()
{
parent::__construct();
$this->dumpDirectory = FLOW_PATH_DATA . 'Persistent/GermaniaSacra/Dump/';
if (!file_exists($this->dumpDirectory)) {
Files::createDirectoryRecursively($this->dumpDirectory);
}
}
示例9: getLanguagesScansFormatDirectoryAndReturnsLanguagesAsStrings
/**
* @test
*/
public function getLanguagesScansFormatDirectoryAndReturnsLanguagesAsStrings()
{
$formatPath = vfsStream::url('testDirectory') . '/';
\TYPO3\Flow\Utility\Files::createDirectoryRecursively($formatPath . 'en');
$format = new \TYPO3\Flow\Package\Documentation\Format('DocBook', $formatPath);
$availableLanguages = $format->getAvailableLanguages();
$this->assertEquals(array('en'), $availableLanguages);
}
示例10:
/**
* @test
*/
public function getDocumentationFormatsScansDocumentationDirectoryAndReturnsDocumentationFormatObjectsIndexedByFormatName()
{
$documentationPath = vfsStream::url('testDirectory') . '/';
$mockPackage = $this->getMock(\TYPO3\Flow\Package\PackageInterface::class);
\TYPO3\Flow\Utility\Files::createDirectoryRecursively($documentationPath . 'DocBook/en');
$documentation = new \TYPO3\Flow\Package\Documentation($mockPackage, 'Manual', $documentationPath);
$documentationFormats = $documentation->getDocumentationFormats();
$this->assertEquals('DocBook', $documentationFormats['DocBook']->getFormatName());
}
示例11: importTemporaryFileSkipsFilesThatAlreadyExist
/**
* @test
*/
public function importTemporaryFileSkipsFilesThatAlreadyExist()
{
$mockTempFile = vfsStream::newFile('SomeTemporaryFile', 0333)->withContent('fixture')->at($this->mockDirectory);
$finalTargetPathAndFilename = $this->writableFileSystemStorage->_call('getStoragePathAndFilenameByHash', sha1('fixture'));
Files::createDirectoryRecursively(dirname($finalTargetPathAndFilename));
file_put_contents($finalTargetPathAndFilename, 'existing file');
$this->writableFileSystemStorage->_call('importTemporaryFile', $mockTempFile->url(), 'default');
$this->assertSame('existing file', file_get_contents($finalTargetPathAndFilename));
}
示例12: setUp
/**
*/
public function setUp()
{
vfsStream::setup('Foo');
$temporaryDirectoryBase = realpath(sys_get_temp_dir()) . '/' . str_replace('\\', '_', __CLASS__);
$this->temporaryDirectoryPath = \TYPO3\Flow\Utility\Files::concatenatePaths(array($temporaryDirectoryBase, 'FlowPrivateResourcesPublishingAspectTestTemporaryDirectory'));
\TYPO3\Flow\Utility\Files::createDirectoryRecursively($this->temporaryDirectoryPath);
$this->publishPath = \TYPO3\Flow\Utility\Files::concatenatePaths(array($temporaryDirectoryBase, 'FlowPrivateResourcesPublishingAspectTestPublishDirectory'));
\TYPO3\Flow\Utility\Files::createDirectoryRecursively($this->publishPath);
}
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:11,代码来源:PrivateResourcesPublishingAspectTest.php
示例13: copyStats
/**
* @param StatsProcessorProcessible $simulation
*/
protected function copyStats(StatsProcessorProcessible $simulation)
{
$statsOutputDirectory = Files::concatenatePaths(array($this->statsOutputPath, $simulation->getCombinedSimulationName()));
Files::createDirectoryRecursively($statsOutputDirectory);
$statsSourcePath = $simulation->getReportFilePath();
$statsTargetPath = Files::concatenatePaths(array($statsOutputDirectory, 'LastBuild.json'));
$this->logger->log(sprintf("Copy global stats %s to %s\n", $statsSourcePath, $statsTargetPath));
copy($statsSourcePath, $statsTargetPath);
}
示例14: injectSettings
/**
* @param array $settings
*/
public function injectSettings(array $settings)
{
if (isset($settings['yamlPersistenceManager']['savePath'])) {
$this->savePath = $settings['yamlPersistenceManager']['savePath'];
if (!is_dir($this->savePath)) {
\TYPO3\Flow\Utility\Files::createDirectoryRecursively($this->savePath);
}
}
}
示例15: configureTemporaryDirectory
/**
* Sets the temporaryDirectory as static variable for the lock class.
*
* @throws LockNotAcquiredException
* @throws \TYPO3\Flow\Utility\Exception
* return void;
*/
protected function configureTemporaryDirectory()
{
if (Bootstrap::$staticObjectManager === null || !Bootstrap::$staticObjectManager->isRegistered(\TYPO3\Flow\Utility\Environment::class)) {
throw new LockNotAcquiredException('Environment object could not be accessed', 1386680952);
}
$environment = Bootstrap::$staticObjectManager->get('TYPO3\\Flow\\Utility\\Environment');
$temporaryDirectory = Files::concatenatePaths([$environment->getPathToTemporaryDirectory(), 'Lock']);
Files::createDirectoryRecursively($temporaryDirectory);
self::$temporaryDirectory = $temporaryDirectory;
}