Skip to content

Commit 2853768

Browse files
committed
Removed redundant creation of cache folder
1 parent 3cc2b4d commit 2853768

2 files changed

Lines changed: 4 additions & 44 deletions

File tree

src/core/etl/src/Flow/ETL/Config/Cache/CacheConfigBuilder.php

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use function Flow\Filesystem\DSL\protocol;
88
use Flow\ETL\Cache;
99
use Flow\ETL\Cache\{Implementation\FilesystemCache};
10-
use Flow\ETL\Exception\{InvalidArgumentException, RuntimeException};
10+
use Flow\ETL\Exception\{InvalidArgumentException};
1111
use Flow\Filesystem\{FilesystemTable, Path};
1212
use Flow\Serializer\Serializer;
1313

@@ -23,25 +23,15 @@ final class CacheConfigBuilder
2323
public function build(FilesystemTable $fstab, Serializer $serializer) : CacheConfig
2424
{
2525
$cachePath = \getenv(CacheConfig::CACHE_DIR_ENV) ?: '';
26-
$cachePath = $cachePath !== '' ? $cachePath : \sys_get_temp_dir() . '/flow_php/cache';
27-
28-
if (!is_dir($cachePath)) {
29-
if (true === @mkdir($cachePath, 0777, true) || is_dir($cachePath)) {
30-
// Directory either was created or already exists, proceed
31-
} else {
32-
throw new RuntimeException(sprintf('Can\'t create cache directory: "%s" Please use a different one through %s environment variable', $cachePath, CacheConfig::CACHE_DIR_ENV));
33-
}
34-
} elseif (!is_writable($cachePath)) {
35-
throw new \RuntimeException(\sprintf('Unable to write in the "cache" directory (%s).', $cachePath));
36-
}
26+
$cachePath = Path::realpath($cachePath !== '' ? $cachePath : \sys_get_temp_dir() . '/flow_php/cache');
3727

3828
return new CacheConfig(
3929
cache: $this->cache ?? new FilesystemCache(
4030
$fstab->for(protocol('file')),
4131
$serializer,
42-
cacheDir: Path::realpath($cachePath)
32+
cacheDir: $cachePath
4333
),
44-
localFilesystemCacheDir: Path::realpath($cachePath),
34+
localFilesystemCacheDir: $cachePath,
4535
externalSortBucketsCount: $this->externalSortBucketsCount
4636
);
4737
}

web/landing/src/Flow/Website/Command/FlowCache.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)