Neos\Flow\Utility\Environment::createTemporaryDirectory PHP Method

createTemporaryDirectory() protected method

For each Flow Application Context, we create an extra temporary folder, and for nested contexts, the folders are prefixed with "SubContext" to avoid ambiguity, and look like: Data/Temporary/Production/SubContextLive
protected createTemporaryDirectory ( string $temporaryDirectoryBase ) : string
$temporaryDirectoryBase string Full path to the base for the temporary directory
return string The full path to the temporary directory
    protected function createTemporaryDirectory($temporaryDirectoryBase)
    {
        $temporaryDirectoryBase = Files::getUnixStylePath($temporaryDirectoryBase);
        if (substr($temporaryDirectoryBase, -1, 1) !== '/') {
            $temporaryDirectoryBase .= '/';
        }
        $temporaryDirectory = $temporaryDirectoryBase . str_replace('/', '/SubContext', (string) $this->context) . '/';
        if (!is_dir($temporaryDirectory) && !is_link($temporaryDirectory)) {
            try {
                Files::createDirectoryRecursively($temporaryDirectory);
            } catch (ErrorException $exception) {
                throw new UtilityException('The temporary directory "' . $temporaryDirectory . '" could not be created. Please make sure permissions are correct for this path or define another temporary directory in your Settings.yaml with the path "Neos.Flow.utility.environment.temporaryDirectoryBase".', 1335382361);
            }
        }
        if (!is_writable($temporaryDirectory)) {
            throw new UtilityException('The temporary directory "' . $temporaryDirectory . '" is not writable. Please make this directory writable or define another temporary directory in your Settings.yaml with the path "Neos.Flow.utility.environment.temporaryDirectoryBase".', 1216287176);
        }
        return $temporaryDirectory;
    }